This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RFA: Add a builtin define for when the floating point registers arenot available
- From: Nick Clifton <nickc at redhat dot com>
- To: aldyh at redhat dot com, geoffk at geoffk dot org, dje at watson dot ibm dot com
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 19 May 2005 12:05:37 +0100
- Subject: RFA: Add a builtin define for when the floating point registers arenot available
Hi Aldy, Hi Geoff, Hi Dave,
I have another powerpc patch for your consideration.
This one adds the definition of a C preprocessor builtin called
__NO_FPRS__ if the floating point registers are not available. This
is the default for the powerpc-eabispe port and can be triggered in
other powerpc ports via the use of the -msoft-float or the
-mfloat-gprs=no gcc command line switches.
The reason that this is important is in building glibc. In
glibc/sysdeps/powerpc/fpu/fenv_libc.h there are two macro
definitions:
#define fegetenv_register() \
({ fenv_t env; asm volatile ("mffs %0" : "=f" (env)); env; })
#define fesetenv_register(env) \
({ double d = (env); asm volatile ("mtfsf 0xff,%0" : : "f" (d)); })
These definitions only work if the "f" register type is valid, which
means that both TARGET_HARD_FLOAT and TARGET_FPRS have to be true.
Thus attempting to build glibc using a powerpc-linux-gnuspe
toolchain results in the error message:
error: impossible constraint in 'asm'
The patch below is part of a fix for this problem. It provides for
the definition of __NO_FPRS__ when the floating point registers are
not available, and with such a definition I could modify the macro
definitions to be, for example:
#if defined __NO_FPRS__
#define fegetenv_register() \
({ fenv_t env; asm volatile ("mffs %0" : "=r" (env)); env; })
#else
#define fegetenv_register() \
({ fenv_t env; asm volatile ("mffs %0" : "=f" (env)); env; })
#endif
So - may I apply this patch please ?
Tested by building a powerpc-linux-gnu toolchain and a
powerpc-linux-gnuspe toolchain using a three stage gcc/glibc/kernel
build script.
Cheers
Nick
gcc/ChangeLog
2005-05-19 Nick Clifton <nickc@redhat.com>
* config/rs6000/eabi.h (TARGET_OS_CPP_BUILTINS): Define
__NO_FPRS__ if the 'f' register type is not available.
Index: eabi.h
===================================================================
RCS file: /cvs/cvsfiles/gnupro/gcc/config/rs6000/eabi.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -c -3 -p -r1.4 -r1.5
*** eabi.h 8 Feb 2005 17:34:57 -0000 1.4
--- eabi.h 19 May 2005 09:37:34 -0000 1.5
***************
*** 41,46 ****
--- 41,48 ----
builtin_assert ("cpu=powerpc"); \
builtin_assert ("machine=powerpc"); \
TARGET_OS_SYSV_CPP_BUILTINS (); \
+ if (TARGET_SOFT_FLOAT || !TARGET_FPRS) \
+ builtin_define ("__NO_FPRS__"); \
} \
while (0)