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 <meiss...@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. 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; -- Michael Meissner, IBM IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA email: meiss...@linux.ibm.com, phone: +1 (978) 899-4797