In the patch: https://gcc.gnu.org/ml/gcc-patches/2019-12/msg01201.html
Segher Boessenkool asked me to submit a patch to rename the macros used to see if a number is a valid signed 16 or 34-bit value: > Please follow up with a patch to not call random numbers "OFFSET". This patch does this, renaming: SIGNED_34BIT_OFFSET_P -> SIGNED_INTEGER_34BIT_P SIGNED_16BIT_OFFSET_P -> SIGNED_INTEGER_16BIT_P I did not change the secondary macros (SIGNED_34BIT_OFFSET_EXTRA_P and SIGNED_16BIT_OFFSET_P), since those are exclusively used for offset calculations. But I can if you prefer it that way. I also converted one a use in num_insns_constant_gpr to use the macro (it had been in previous patches, but I dropped in the last patch just to get the minimal change in). I've bootstrapped compilers with these patches and there was no regression in the test suite. Can I check this into the trunk? Some of the remaining patches in the V10 series will need to be modified as well. I will submit those patches (after I rework the vector extract stuff) in a new series. 2019-12-17 Michael Meissner <meiss...@linux.ibm.com> * config/rs6000/predicates.md (cint34_operand): Use SIGNED_INTEGER_34BIT_P macro. * config/rs6000/rs6000.c (num_insns_constant_gpr): Use the SIGNED_INTEGER_16BIT_P and SIGNED_INTEGER_34BIT_P macros. (address_to_insn_form): Use the SIGNED_INTEGER_16BIT_P and SIGNED_INTEGER_34BIT_P macros. * config/rs6000/rs6000.h (SIGNED_INTEGER_NBIT_P): New macro. (SIGNED_INTEGER_16BIT_P): Rename SIGNED_16BIT_OFFSET_P to be SIGNED_INTEGER_34BIT_P. (SIGNED_INTEGER_34BIT_P): Rename SIGNED_34BIT_OFFSET_P to be SIGNED_INTEGER_34BIT_P. Index: gcc/config/rs6000/predicates.md =================================================================== --- gcc/config/rs6000/predicates.md (revision 279478) +++ gcc/config/rs6000/predicates.md (working copy) @@ -309,7 +309,7 @@ (define_predicate "cint34_operand" if (!TARGET_PREFIXED_ADDR) return 0; - return SIGNED_34BIT_OFFSET_P (INTVAL (op)); + return SIGNED_INTEGER_34BIT_P (INTVAL (op)); }) ;; Return 1 if op is a register that is not special. Index: gcc/config/rs6000/rs6000.c =================================================================== --- gcc/config/rs6000/rs6000.c (revision 279478) +++ gcc/config/rs6000/rs6000.c (working copy) @@ -5557,7 +5557,7 @@ static int num_insns_constant_gpr (HOST_WIDE_INT value) { /* signed constant loadable with addi */ - if (((unsigned HOST_WIDE_INT) value + 0x8000) < 0x10000) + if (SIGNED_INTEGER_16BIT_P (value)) return 1; /* constant loadable with addis */ @@ -5566,7 +5566,7 @@ num_insns_constant_gpr (HOST_WIDE_INT va return 1; /* PADDI can support up to 34 bit signed integers. */ - else if (TARGET_PREFIXED_ADDR && SIGNED_34BIT_OFFSET_P (value)) + else if (TARGET_PREFIXED_ADDR && SIGNED_INTEGER_34BIT_P (value)) return 1; else if (TARGET_POWERPC64) @@ -24770,7 +24770,7 @@ address_to_insn_form (rtx addr, return INSN_FORM_BAD; HOST_WIDE_INT offset = INTVAL (op1); - if (!SIGNED_34BIT_OFFSET_P (offset)) + if (!SIGNED_INTEGER_34BIT_P (offset)) return INSN_FORM_BAD; /* Check for local and external PC-relative addresses. Labels are always @@ -24789,7 +24789,7 @@ address_to_insn_form (rtx addr, return INSN_FORM_BAD; /* Large offsets must be prefixed. */ - if (!SIGNED_16BIT_OFFSET_P (offset)) + if (!SIGNED_INTEGER_16BIT_P (offset)) { if (TARGET_PREFIXED_ADDR) return INSN_FORM_PREFIXED_NUMERIC; Index: gcc/config/rs6000/rs6000.h =================================================================== --- gcc/config/rs6000/rs6000.h (revision 279478) +++ gcc/config/rs6000/rs6000.h (working copy) @@ -2529,18 +2529,16 @@ typedef struct GTY(()) machine_function #pragma GCC poison TARGET_FLOAT128 OPTION_MASK_FLOAT128 MASK_FLOAT128 #endif -/* Whether a given VALUE is a valid 16 or 34-bit signed offset. */ -#define SIGNED_16BIT_OFFSET_P(VALUE) \ +/* Whether a given VALUE is a valid 16 or 34-bit signed integer. */ +#define SIGNED_INTEGER_NBIT_P(VALUE, N) \ IN_RANGE ((VALUE), \ - -(HOST_WIDE_INT_1 << 15), \ - (HOST_WIDE_INT_1 << 15) - 1) + -(HOST_WIDE_INT_1 << ((N)-1)), \ + (HOST_WIDE_INT_1 << ((N)-1)) - 1) -#define SIGNED_34BIT_OFFSET_P(VALUE) \ - IN_RANGE ((VALUE), \ - -(HOST_WIDE_INT_1 << 33), \ - (HOST_WIDE_INT_1 << 33) - 1) +#define SIGNED_INTEGER_16BIT_P(VALUE) SIGNED_INTEGER_NBIT_P (VALUE, 16) +#define SIGNED_INTEGER_34BIT_P(VALUE) SIGNED_INTEGER_NBIT_P (VALUE, 34) -/* Like SIGNED_16BIT_OFFSET_P and SIGNED_34BIT_OFFSET_P, but with an extra +/* Like SIGNED_INTEGER_16BIT_P and SIGNED_INTEGER_34BIT_P, but with an extra argument that gives a length to validate a range of addresses, to allow for splitting insns into several insns, each of which has an offsettable address. */ -- 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