This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH], Committed, PR target/78688, fix PowerPC bootstrap issue


A recent change to enable signed vs. unsigned comparisons to be flagged as an
error broke the PowerPC bootstrap.

The issue was with the FUNCTION_VALUE_REGNO_P macro.  I changed it and the
FUNCTION_ARG_REGNO_P to both use IN_RANGE instead of doing a subtraction of the
first value and comparing it to the second value minus the first value plus 1.

I committed this patch as obvious to get the PowerPC bootstrapping once again.
Segher, if you want me to reformat it let me know.

2016-12-05  Michael Meissner  <meissner@linux.vnet.ibm.com>

	PR target/78688
	* config/rs6000/rs6000.h (FUNCTION_VALUE_REGNO_P): Use IN_RANGE
	instead of ((N) >= (X) && (N) <= (Y-X)) to silence warnings about
	comparing signed to unsigned values.
	(FUNCTION_ARG_REGNO_P): Likewise.

Index: gcc/config/rs6000/rs6000.h
===================================================================
--- gcc/config/rs6000/rs6000.h	(revision 243270)
+++ gcc/config/rs6000/rs6000.h	(working copy)
@@ -1866,19 +1866,19 @@ extern enum reg_class rs6000_constraints
    On RS/6000, this is r3, fp1, and v2 (for AltiVec).  */
 #define FUNCTION_VALUE_REGNO_P(N)					\
   ((N) == GP_ARG_RETURN							\
-   || ((N) >= FP_ARG_RETURN && (N) <= FP_ARG_MAX_RETURN			\
+   || (IN_RANGE ((N), FP_ARG_RETURN, FP_ARG_MAX_RETURN)			\
        && TARGET_HARD_FLOAT && TARGET_FPRS)				\
-   || ((N) >= ALTIVEC_ARG_RETURN && (N) <= ALTIVEC_ARG_MAX_RETURN	\
+   || (IN_RANGE ((N), ALTIVEC_ARG_RETURN, ALTIVEC_ARG_MAX_RETURN)	\
        && TARGET_ALTIVEC && TARGET_ALTIVEC_ABI))
 
 /* 1 if N is a possible register number for function argument passing.
    On RS/6000, these are r3-r10 and fp1-fp13.
    On AltiVec, v2 - v13 are used for passing vectors.  */
 #define FUNCTION_ARG_REGNO_P(N)						\
-  ((unsigned) (N) - GP_ARG_MIN_REG < GP_ARG_NUM_REG			\
-   || ((unsigned) (N) - ALTIVEC_ARG_MIN_REG < ALTIVEC_ARG_NUM_REG	\
+  (IN_RANGE ((N), GP_ARG_MIN_REG, GP_ARG_MAX_REG)			\
+   || (IN_RANGE ((N), ALTIVEC_ARG_MIN_REG, ALTIVEC_ARG_MAX_REG)		\
        && TARGET_ALTIVEC && TARGET_ALTIVEC_ABI)				\
-   || ((unsigned) (N) - FP_ARG_MIN_REG < FP_ARG_NUM_REG			\
+   || (IN_RANGE ((N), FP_ARG_MIN_REG, FP_ARG_MAX_REG)			\
        && TARGET_HARD_FLOAT && TARGET_FPRS))
 
 /* Define a data type for recording info about an argument list

-- 
Michael Meissner, IBM
IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA
email: meissner@linux.vnet.ibm.com, phone: +1 (978) 899-4797


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]