This match renames the d-form mode support function and makes it more general. It was originally written to test whether we have the ISA 3.0 new D*-form instruction, but I believe in the future, I will want to use it also for GPR and tradiational floating point registers.
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_d_form): Rename mode_supports_vmx_dform to mode_supports_d_form. Add an optional argument to say which reload register class to use. Chagne 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: meiss...@linux.vnet.ibm.com, phone: +1 (978) 899-4797
Index: gcc/config/rs6000/rs6000.c =================================================================== --- gcc/config/rs6000/rs6000.c (revision 258725) +++ 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 @@ -20081,7 +20084,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))) { @@ -20644,7 +20647,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; @@ -20801,7 +20804,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)