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]

powerpc builtin_apply and -msoft-float


This testcase shows all the fp arg registers being set up, even when
compiled with -msoft-float.  I reckon that's wrong.

int foo (void (*func) (), void *cookie, long size)
{
  __builtin_return (__builtin_apply (func, cookie, size));
}

Fixed by the following.

	* config/rs6000/rs6000.h (FUNCTION_VALUE_REGNO_P): Respect
	TARGET_HARD_FLOAT.  Reformat.
	(FUNCTION_ARG_REGNO_P): Likewise, and remove unneeded casts.

Can this go on all branches?  Bootstrapped, regression tested powerpc-linux.

diff -urpN -xCVS -x'*~' -x'*.info*' -x'*.[17]' -xTAGS gcc-ppc64-32.orig/gcc/config/rs6000/rs6000.h gcc-ppc64-32/gcc/config/rs6000/rs6000.h
--- gcc-ppc64-32.orig/gcc/config/rs6000/rs6000.h	2003-02-27 11:59:51.000000000 +1030
+++ gcc-ppc64-32/gcc/config/rs6000/rs6000.h	2003-03-29 10:16:33.000000000 +1030
@@ -1543,20 +1554,20 @@ typedef struct rs6000_stack {
    as seen by the caller.
 
    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)	\
-				    || (TARGET_ALTIVEC &&	\
-					(N) == ALTIVEC_ARG_RETURN))
+#define FUNCTION_VALUE_REGNO_P(N)					\
+  ((N) == GP_ARG_RETURN							\
+   || ((N) == FP_ARG_RETURN && TARGET_HARD_FLOAT)			\
+   || ((N) == ALTIVEC_ARG_RETURN && TARGET_ALTIVEC))
 
 /* 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) < (unsigned)(GP_ARG_NUM_REG))	\
-   || (TARGET_ALTIVEC &&						\
-       (unsigned)((N) - ALTIVEC_ARG_MIN_REG) < (unsigned)(ALTIVEC_ARG_NUM_REG)) \
-   || ((unsigned)((N) - FP_ARG_MIN_REG) < (unsigned)(FP_ARG_NUM_REG)))
-
+  ((unsigned) (N) - GP_ARG_MIN_REG < GP_ARG_NUM_REG			\
+   || ((unsigned) (N) - ALTIVEC_ARG_MIN_REG < ALTIVEC_ARG_NUM_REG	\
+       && TARGET_ALTIVEC)						\
+   || ((unsigned) (N) - FP_ARG_MIN_REG < FP_ARG_NUM_REG			\
+       && TARGET_HARD_FLOAT))
 
 /* A C structure for machine-specific, per-function data.
    This is added to the cfun structure.  */

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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