about summary refs log tree commit diff
path: root/sysdeps/powerpc/fpu/fpu_control.h
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2013-01-17 02:08:51 +0000
committerJoseph Myers <joseph@codesourcery.com>2013-01-17 02:08:51 +0000
commit59981e9b0df84aa91c52d21c54a7ed158a356aaa (patch)
treef49bb0bfd1bdaef1f26763b91ecf5760d28d4db4 /sysdeps/powerpc/fpu/fpu_control.h
parentcfa8054fbb6212e64d54a3d4926972a6a20e3498 (diff)
downloadglibc-59981e9b0df84aa91c52d21c54a7ed158a356aaa.tar.gz
glibc-59981e9b0df84aa91c52d21c54a7ed158a356aaa.tar.xz
glibc-59981e9b0df84aa91c52d21c54a7ed158a356aaa.zip
Adapt installed powerpc headers better for soft-float / no-FPRs.
Diffstat (limited to 'sysdeps/powerpc/fpu/fpu_control.h')
-rw-r--r--sysdeps/powerpc/fpu/fpu_control.h43
1 files changed, 28 insertions, 15 deletions
diff --git a/sysdeps/powerpc/fpu/fpu_control.h b/sysdeps/powerpc/fpu/fpu_control.h
index 09342fbe39..159543beed 100644
--- a/sysdeps/powerpc/fpu/fpu_control.h
+++ b/sysdeps/powerpc/fpu/fpu_control.h
@@ -19,42 +19,53 @@
 #ifndef _FPU_CONTROL_H
 #define _FPU_CONTROL_H
 
+#if defined _SOFT_FLOAT || defined __NO_FPRS__
+
+# define _FPU_RESERVED 0xffffffff
+# define _FPU_DEFAULT  0x00000000 /* Default value.  */
+typedef unsigned int fpu_control_t;
+# define _FPU_GETCW(cw) (cw) = 0
+# define _FPU_SETCW(cw) (void) (cw)
+extern fpu_control_t __fpu_control;
+
+#else /* PowerPC 6xx floating-point.  */
+
 /* rounding control */
-#define _FPU_RC_NEAREST 0x00   /* RECOMMENDED */
-#define _FPU_RC_DOWN    0x03
-#define _FPU_RC_UP      0x02
-#define _FPU_RC_ZERO    0x01
+# define _FPU_RC_NEAREST 0x00   /* RECOMMENDED */
+# define _FPU_RC_DOWN    0x03
+# define _FPU_RC_UP      0x02
+# define _FPU_RC_ZERO    0x01
 
-#define _FPU_MASK_NI  0x04 /* non-ieee mode */
+# define _FPU_MASK_NI  0x04 /* non-ieee mode */
 
 /* masking of interrupts */
-#define _FPU_MASK_ZM  0x10 /* zero divide */
-#define _FPU_MASK_OM  0x40 /* overflow */
-#define _FPU_MASK_UM  0x20 /* underflow */
-#define _FPU_MASK_XM  0x08 /* inexact */
-#define _FPU_MASK_IM  0x80 /* invalid operation */
+# define _FPU_MASK_ZM  0x10 /* zero divide */
+# define _FPU_MASK_OM  0x40 /* overflow */
+# define _FPU_MASK_UM  0x20 /* underflow */
+# define _FPU_MASK_XM  0x08 /* inexact */
+# define _FPU_MASK_IM  0x80 /* invalid operation */
 
-#define _FPU_RESERVED 0xffffff00 /* These bits are reserved are not changed. */
+# define _FPU_RESERVED 0xffffff00 /* These bits are reserved are not changed. */
 
 /* The fdlibm code requires no interrupts for exceptions.  */
-#define _FPU_DEFAULT  0x00000000 /* Default value.  */
+# define _FPU_DEFAULT  0x00000000 /* Default value.  */
 
 /* IEEE:  same as above, but (some) exceptions;
    we leave the 'inexact' exception off.
  */
-#define _FPU_IEEE     0x000000f0
+# define _FPU_IEEE     0x000000f0
 
 /* Type of the control word.  */
 typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__SI__)));
 
 /* Macros for accessing the hardware control word.  */
-#define _FPU_GETCW(__cw) ( { \
+# define _FPU_GETCW(__cw) ( { \
   union { double d; fpu_control_t cw[2]; } \
     tmp __attribute__ ((__aligned__(8))); \
   __asm__ ("mffs 0; stfd%U0 0,%0" : "=m" (tmp.d) : : "fr0"); \
   (__cw)=tmp.cw[1]; \
   tmp.cw[1]; } )
-#define _FPU_SETCW(__cw) { \
+# define _FPU_SETCW(__cw) { \
   union { double d; fpu_control_t cw[2]; } \
     tmp __attribute__ ((__aligned__(8))); \
   tmp.cw[0] = 0xFFF80000; /* More-or-less arbitrary; this is a QNaN. */ \
@@ -65,4 +76,6 @@ typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__SI__)));
 /* Default control word set at startup.  */
 extern fpu_control_t __fpu_control;
 
+#endif /* PowerPC 6xx floating-point.  */
+
 #endif /* _FPU_CONTROL_H */