This patch extends the other mode_supports* function to take an optional
second argument to specificy particular reload register class, and it defaults
to REG_RELOAD_ANY which says some reload register supports the feature.

I have built bootstrap compilers with the first 4 patches including this patch
on both big and little endian power8 systems.  There were no regressions.

2018-03-21  Michael Meissner  <meiss...@linux.vnet.ibm.com>

        * config/rs6000/rs6000.c (mode_supports_pre_incdec_p): Add
        additional argument to specify the reload register class to use,
        defaulting to RELOAD_REG_ANY.
        (mode_supports_pre_modify_p): Likewise.
        (mode_supports_dq_form): Likewise.

-- 
Michael Meissner, IBM
IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA
email: meiss...@linux.vnet.ibm.com, phone: +1 (978) 899-4797
Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c  (revision 258726)
+++ gcc/config/rs6000/rs6000.c  (working copy)
@@ -537,20 +537,22 @@ struct rs6000_reg_addr {
 
 static struct rs6000_reg_addr reg_addr[NUM_MACHINE_MODES];
 
-/* Helper function to say whether a mode supports PRE_INC or PRE_DEC.  */
+/* Helper function to say whether a mode supports PRE_INC or PRE_DEC in a given
+   reload register class or if some reload register class supports it.  */
 static inline bool
-mode_supports_pre_incdec_p (machine_mode mode)
+mode_supports_pre_incdec_p (machine_mode mode,
+                           enum rs6000_reload_reg_type rt = RELOAD_REG_ANY)
 {
-  return ((reg_addr[mode].addr_mask[RELOAD_REG_ANY] & RELOAD_REG_PRE_INCDEC)
-         != 0);
+  return ((reg_addr[mode].addr_mask[rt] & RELOAD_REG_PRE_INCDEC) != 0);
 }
 
-/* Helper function to say whether a mode supports PRE_MODIFY.  */
+/* Helper function to say whether a mode supports PRE_MODIFY in a given
+   reload register class or if some reload register class supports it..  */
 static inline bool
-mode_supports_pre_modify_p (machine_mode mode)
+mode_supports_pre_modify_p (machine_mode mode,
+                           enum rs6000_reload_reg_type rt = RELOAD_REG_ANY)
 {
-  return ((reg_addr[mode].addr_mask[RELOAD_REG_ANY] & RELOAD_REG_PRE_MODIFY)
-         != 0);
+  return ((reg_addr[mode].addr_mask[rt] & RELOAD_REG_PRE_MODIFY) != 0);
 }
 
 /* Return true if we have D-form addressing (register+offset) in either a
@@ -563,14 +565,14 @@ mode_supports_d_form (machine_mode mode,
   return ((reg_addr[mode].addr_mask[rt] & RELOAD_REG_OFFSET) != 0);
 }
 
-/* Return true if we have D-form addressing in VSX registers.  This addressing
-   is more limited than normal d-form addressing in that the offset must be
-   aligned on a 16-byte boundary.  */
+/* Return true if we have DQ-form addressing in a given reload register class
+   or if some reload register class supports it.  DQ-form addressing must have
+   the bottom 4 bits set to 0.  */
 static inline bool
-mode_supports_dq_form (machine_mode mode)
+mode_supports_dq_form (machine_mode mode,
+                      enum rs6000_reload_reg_type rt = RELOAD_REG_ANY)
 {
-  return ((reg_addr[mode].addr_mask[RELOAD_REG_ANY] & RELOAD_REG_QUAD_OFFSET)
-         != 0);
+  return ((reg_addr[mode].addr_mask[rt] & RELOAD_REG_QUAD_OFFSET) != 0);
 }
 
 /* Given that there exists at least one variable that is set (produced)

Reply via email to