This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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]

e500 port: fix fpu_control.h constant values


e500 port testing shows that the values in the e500 case in
fpu_control.h, which I took originally from the fpu_control.h in
Aldy's SPE add-on, don't actually correspond correctly to bits in
SPEFSCR.  I've no idea where the values in the SPE add-on originated,
but this patch corrects various values to match the architecture
documentation.

(Note: the _FPU_DEFAULT value is the one needed for correct operation;
without exceptions enabled at the hardware level, you get such things
as flush-to-zero of denormal operands causing libm functions to go
into infinite loops, so can't run the testsuite.  I'll prepare a
kernel patch to make the kernel actually use that as the default
value; in the absence of such a kernel fix, glibc would need support
for disabling the present assumption that the initial control word
setting is _FPU_DEFAULT and __setfpucw doesn't need calling on startup
unless __fpu_control has a different value.)

2013-09-26  Joseph Myers  <joseph@codesourcery.com>

	* sysdeps/powerpc/fpu_control.h [__NO_FPRS__ && !_SOFT_FLOAT]
	(_FPU_MASK_OM): Define as 0x04.
	[__NO_FPRS__ && !_SOFT_FLOAT] (_FPU_MASK_UM): Define as 0x08.
	[__NO_FPRS__ && !_SOFT_FLOAT] (_FPU_RESERVED): Define as
	0x00c10080.
	[__NO_FPRS__ && !_SOFT_FLOAT] (_FPU_DEFAULT): Define as
	0x0000007c.
	[__NO_FPRS__ && !_SOFT_FLOAT] (_FPU_IEEE): Define as _FPU_DEFAULT.

diff --git a/sysdeps/powerpc/fpu_control.h b/sysdeps/powerpc/fpu_control.h
index c61a2e1..1771722 100644
--- a/sysdeps/powerpc/fpu_control.h
+++ b/sysdeps/powerpc/fpu_control.h
@@ -38,20 +38,18 @@ extern fpu_control_t __fpu_control;
 
 /* masking of interrupts */
 # define _FPU_MASK_ZM  0x10 /* zero divide */
-# define _FPU_MASK_OM  0x40 /* overflow */
-# define _FPU_MASK_UM  0x80 /* underflow */
+# define _FPU_MASK_OM  0x04 /* overflow */
+# define _FPU_MASK_UM  0x08 /* underflow */
 # define _FPU_MASK_XM  0x40 /* inexact */
 # define _FPU_MASK_IM  0x20 /* invalid operation */
 
-# define _FPU_RESERVED 0xff3fff7f /* These bits are reserved and not changed. */
-
-/* The fdlibm code requires no interrupts for exceptions.  */
-# define _FPU_DEFAULT  0x00000000 /* Default value.  */
+# define _FPU_RESERVED 0x00c10080 /* These bits are reserved and not changed. */
 
-/* IEEE:  same as above, but (some) exceptions;
-   we leave the 'inexact' exception off.
- */
-# define _FPU_IEEE     0x000003c0
+/* Correct IEEE semantics require traps to be enabled at the hardware
+   level; the kernel then does the emulation and determines whether
+   generation of signals from those traps was enabled using prctl.  */
+# define _FPU_DEFAULT  0x0000007c /* Default value.  */
+# define _FPU_IEEE     _FPU_DEFAULT
 
 /* Type of the control word.  */
 typedef unsigned int fpu_control_t;

-- 
Joseph S. Myers
joseph@codesourcery.com


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