about summary refs log tree commit diff
path: root/sysdeps/i386
diff options
context:
space:
mode:
authorAndreas Jaeger <aj@suse.de>2012-03-14 17:20:10 +0100
committerAndreas Jaeger <aj@suse.de>2012-03-14 17:20:10 +0100
commitc4814b6b3a2b4f264a461a27667a139387968ee1 (patch)
treee2e5aed10a4ab7861c357f3a88abf8ffbd22451b /sysdeps/i386
parent1e2405c8fa877d7cb3c06626c94356faaa7bd1e0 (diff)
downloadglibc-c4814b6b3a2b4f264a461a27667a139387968ee1.tar.gz
glibc-c4814b6b3a2b4f264a461a27667a139387968ee1.tar.xz
glibc-c4814b6b3a2b4f264a461a27667a139387968ee1.zip
Implement and use libc_feholdexcept_setround_53bit and libc_feupdateenv_53bit
so that double arithmetic in s_sin is done in 53 bit (without extend i386 double precision)
Diffstat (limited to 'sysdeps/i386')
-rw-r--r--sysdeps/i386/fpu/math_private.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/sysdeps/i386/fpu/math_private.h b/sysdeps/i386/fpu/math_private.h
index 5253998a57..d96996fadf 100644
--- a/sysdeps/i386/fpu/math_private.h
+++ b/sysdeps/i386/fpu/math_private.h
@@ -16,4 +16,33 @@ do							\
 while (0)
 
 #include_next <math_private.h>
+
+# include <fpu_control.h>
+
+# undef libc_feholdexcept_setround_53bit
+# define libc_feholdexcept_setround_53bit(e, r)	\
+  do						\
+    {						\
+      fpu_control_t cw;				\
+      libc_feholdexcept_setround (e, r);	\
+      _FPU_GETCW (cw);				\
+      cw &= ~(fpu_control_t) _FPU_EXTENDED;	\
+      cw |= _FPU_DOUBLE;			\
+      _FPU_SETCW (cw);				\
+    }						\
+  while (0)
+
+# undef libc_feupdateenv_53bit
+# define libc_feupdateenv_53bit(e)		\
+  do						\
+    {						\
+      fpu_control_t cw;				\
+      libc_feupdateenv (e);			\
+      _FPU_GETCW (cw);				\
+      cw &= ~(fpu_control_t) _FPU_EXTENDED;	\
+      cw |= _FPU_EXTENDED;			\
+      _FPU_SETCW (cw);				\
+    }						\
+  while (0)
+
 #endif