, PowerPC, Patch #8, rename rs6000_prefixed_address
diff mbox series

Message ID 20190711121152.GA12708@ibm-toto.the-meissners.org
State New
Headers show
Series
  • , PowerPC, Patch #8, rename rs6000_prefixed_address
Related show

Commit Message

Michael Meissner July 11, 2019, 12:11 p.m. UTC
In a future patch, I plan to introduce a new function that says whether an
address is prefixed based on the address format (D-form, DS-form, DQ-form) used
by the instruction.  I plan on naming the new function:

	rs6000_prefixed_address_format

This means the existing function that takes a mode argument will be renamed to:

	rs6000_prefixed_address_mode

Rs6000_prefixed_address_mode will have a table mapping the mode into the
expected address format, and then call rs6000_prefixed_address_format.  This is
due to the number of irregularities in the PowerPC architecture:

	LWA is DS-form, but LWZ is D-form
	LFD is D-form, LXSD is DS-form

In the tests that will occur after register allocation, we can check the
register type, and more accurately determine if a prefixed instruction must be
used if the offset is odd (for DS-form) or the offset is not aligned on a
16-byte boundary (for DQ-form).

This patch prepares the way by renaming the current function, and changing its
one use.  I have bootstrapped a compiler on a little endian power8 and there
were no regressions in the test suite.  Can I check this patch into the trunk?

2019-07-10  Michael Meissner  <meissner@linux.ibm.com>

	* config/rs6000/predicates.md (prefixed_mem_operand): Call
	rs6000_prefixed_address_mode instead of rs6000_prefixed_address.
	* config/rs6000/rs6000-protos.h (rs6000_prefixed_address_mode):
	Rename fucntion from rs6000_prefixed_address.
	* config/rs6000/rs6000.c (rs6000_prefixed_address_mode): Rename
	fucntion from rs6000_prefixed_address.

Comments

Segher Boessenkool July 11, 2019, 9:03 p.m. UTC | #1
[ Please do not send patches as replies. ]

On Thu, Jul 11, 2019 at 08:11:52AM -0400, Michael Meissner wrote:
> In a future patch, I plan to introduce a new function that says whether an
> address is prefixed based on the address format (D-form, DS-form, DQ-form) used
> by the instruction.  I plan on naming the new function:
> 
> 	rs6000_prefixed_address_format
> 
> This means the existing function that takes a mode argument will be renamed to:
> 
> 	rs6000_prefixed_address_mode

D/DQ/DS are the "instruction form", not "address format".  Let's not
invent new similar names :-/

> Rs6000_prefixed_address_mode will have a table mapping the mode into the
> expected address format, and then call rs6000_prefixed_address_format.  This is
> due to the number of irregularities in the PowerPC architecture:
> 
> 	LWA is DS-form, but LWZ is D-form
> 	LFD is D-form, LXSD is DS-form

Great isn't it?

> In the tests that will occur after register allocation, we can check the
> register type, and more accurately determine if a prefixed instruction must be
> used if the offset is odd (for DS-form) or the offset is not aligned on a
> 16-byte boundary (for DQ-form).

Is not 0 mod 4, for DS, even.

> --- gcc/config/rs6000/predicates.md	(revision 273368)
> +++ gcc/config/rs6000/predicates.md	(working copy)
> @@ -1686,7 +1686,7 @@ (define_predicate "pcrel_external_addres
>  (define_predicate "prefixed_mem_operand"
>    (match_code "mem")
>  {
> -  return rs6000_prefixed_address (XEXP (op, 0), GET_MODE (op));
> +  return rs6000_prefixed_address_mode (XEXP (op, 0), GET_MODE (op));
>  })

That sounds like it returns a mode.  rs6000_prefixed_address_mode_p or
rs6000_is_prefixed_address_mode, maybe?  Well you use _p alredy, so
please do that here as well.

Okay for trunk with that change.  Thanks!


Segher

Patch
diff mbox series

Index: gcc/config/rs6000/predicates.md
===================================================================
--- gcc/config/rs6000/predicates.md	(revision 273368)
+++ gcc/config/rs6000/predicates.md	(working copy)
@@ -1686,7 +1686,7 @@  (define_predicate "pcrel_external_addres
 (define_predicate "prefixed_mem_operand"
   (match_code "mem")
 {
-  return rs6000_prefixed_address (XEXP (op, 0), GET_MODE (op));
+  return rs6000_prefixed_address_mode (XEXP (op, 0), GET_MODE (op));
 })
 
 ;; Return 1 if op is a memory operand to an external variable when we
Index: gcc/config/rs6000/rs6000-protos.h
===================================================================
--- gcc/config/rs6000/rs6000-protos.h	(revision 273367)
+++ gcc/config/rs6000/rs6000-protos.h	(working copy)
@@ -154,7 +154,7 @@  extern align_flags rs6000_loop_align (rt
 extern void rs6000_split_logical (rtx [], enum rtx_code, bool, bool, bool);
 extern bool rs6000_pcrel_p (struct function *);
 extern bool rs6000_fndecl_pcrel_p (const_tree);
-extern bool rs6000_prefixed_address (rtx, machine_mode);
+extern bool rs6000_prefixed_address_mode (rtx, machine_mode);
 #endif /* RTX_CODE */
 
 #ifdef TREE_CODE
Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c	(revision 273368)
+++ gcc/config/rs6000/rs6000.c	(working copy)
@@ -21514,7 +21514,7 @@  mode_supports_prefixed_address_p (machin
    mode MODE.  */
 
 bool
-rs6000_prefixed_address (rtx addr, machine_mode mode)
+rs6000_prefixed_address_mode (rtx addr, machine_mode mode)
 {
   if (!TARGET_PREFIXED_ADDR || !mode_supports_prefixed_address_p (mode))
     return false;