[PATCH] PowerPC address support clean, patch 3 of 4

Michael Meissner meissner@linux.ibm.com
Thu May 3 17:22:00 GMT 2018


These patches were previously posted in March as a RFC, and I would like to
check them into the trunk.  These patches make the mode_supports* functions use
similar names for the functions that return if a mode supports D-FORM, DS-FORM,
and/or DQ-FORM instructions, and add the ability to ask whether a particular
reload register class supports a particular D*-form instruction.

This is patch #3 of 4.

I have done a bootstrap with patches 1-4 and did a make check comparison on a
little endian power8 system, and there were no regressions.  Can I check it in?

2018-05-03  Michael Meissner  <meissner@linux.vnet.ibm.com>

	* config/rs6000/rs6000.c (mode_supports_d_form): Rename
	mode_supports_vmx_dform to mode_supports_d_form.  Add an optional
	argument to say which reload register class to use.  Change all
	callers to pass in the RELOAD_REG_VMX class explicitly.
	(rs6000_secondary_reload): Likewise.
	(rs6000_preferred_reload_class): Likewise.
	(rs6000_secondary_reload_class): Likewise.

-- 
Michael Meissner, IBM
IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA
email: meissner@linux.ibm.com, phone: +1 (978) 899-4797
-------------- next part --------------
Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c	(revision 259877)
+++ gcc/config/rs6000/rs6000.c	(working copy)
@@ -553,11 +553,14 @@ mode_supports_pre_modify_p (machine_mode
 	  != 0);
 }
 
-/* Return true if we have D-form addressing in altivec registers.  */
+/* Return true if we have D-form addressing (register+offset) in either a
+   specific reload register class or whether some reload register class
+   supports d-form addressing.  */
 static inline bool
-mode_supports_vmx_dform (machine_mode mode)
+mode_supports_d_form (machine_mode mode,
+		      enum rs6000_reload_reg_type rt = RELOAD_REG_ANY)
 {
-  return ((reg_addr[mode].addr_mask[RELOAD_REG_VMX] & RELOAD_REG_OFFSET) != 0);
+  return ((reg_addr[mode].addr_mask[rt] & RELOAD_REG_OFFSET) != 0);
 }
 
 /* Return true if we have D-form addressing in VSX registers.  This addressing
@@ -19415,7 +19418,7 @@ rs6000_secondary_reload (bool in_p,
      point register, unless we have D-form addressing.  Also make sure that
      non-zero constants use a FPR.  */
   if (!done_p && reg_addr[mode].scalar_in_vmx_p
-      && !mode_supports_vmx_dform (mode)
+      && !mode_supports_d_form (mode, RELOAD_REG_VMX)
       && (rclass == VSX_REGS || rclass == ALTIVEC_REGS)
       && (memory_p || (GET_CODE (x) == CONST_DOUBLE)))
     {
@@ -19978,7 +19981,7 @@ rs6000_preferred_reload_class (rtx x, en
 	}
 
       /* D-form addressing can easily reload the value.  */
-      if (mode_supports_vmx_dform (mode)
+      if (mode_supports_d_form (mode, RELOAD_REG_VMX)
 	  || mode_supports_dq_form (mode))
 	return rclass;
 
@@ -20135,7 +20138,7 @@ rs6000_secondary_reload_class (enum reg_
      instead of reloading the secondary memory address for Altivec moves.  */
   if (TARGET_VSX
       && GET_MODE_SIZE (mode) < 16
-      && !mode_supports_vmx_dform (mode)
+      && !mode_supports_d_form (mode, RELOAD_REG_VMX)
       && (((rclass == GENERAL_REGS || rclass == BASE_REGS)
            && (regno >= 0 && ALTIVEC_REGNO_P (regno)))
           || ((rclass == VSX_REGS || rclass == ALTIVEC_REGS)


More information about the Gcc-patches mailing list