about summary refs log tree commit diff
path: root/sysdeps/x86_64
diff options
context:
space:
mode:
authorRichard Henderson <rth@twiddle.net>2012-03-10 08:55:53 -0800
committerRichard Henderson <rth@twiddle.net>2012-03-19 06:49:44 -0700
commiteb92c487b35e26aa1e08815c4480d0bc5cc9f370 (patch)
tree99b3d94fcac1b61ea4c23f5575c109508db5e590 /sysdeps/x86_64
parent7d2e8012cfb4fa30086ef330ef1b993cfcc3dd99 (diff)
downloadglibc-eb92c487b35e26aa1e08815c4480d0bc5cc9f370.tar.gz
glibc-eb92c487b35e26aa1e08815c4480d0bc5cc9f370.tar.xz
glibc-eb92c487b35e26aa1e08815c4480d0bc5cc9f370.zip
Create and use SET_RESTORE_ROUND{,_NOEX,_53BIT}{,F,L}.
Diffstat (limited to 'sysdeps/x86_64')
-rw-r--r--sysdeps/x86_64/fpu/math_private.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/sysdeps/x86_64/fpu/math_private.h b/sysdeps/x86_64/fpu/math_private.h
index 8b1fe70d2c..3289afc58b 100644
--- a/sysdeps/x86_64/fpu/math_private.h
+++ b/sysdeps/x86_64/fpu/math_private.h
@@ -119,6 +119,29 @@ libc_feupdateenv (fenv_t *e)
 #define libc_feupdateenv  libc_feupdateenv
 #define libc_feupdateenvf libc_feupdateenv
 
+static __always_inline void
+libc_feholdsetround (fenv_t *e, int r)
+{
+  unsigned int mxcsr;
+  asm (STMXCSR " %0" : "=m" (*&mxcsr));
+  e->__mxcsr = mxcsr;
+  mxcsr = (mxcsr & ~0x6000) | (r << 3);
+  asm volatile (LDMXCSR " %0" : : "m" (*&mxcsr));
+}
+#define libc_feholdsetround  libc_feholdsetround
+#define libc_feholdsetroundf libc_feholdsetround
+
+static __always_inline void
+libc_feresetround (fenv_t *e)
+{
+  unsigned int mxcsr;
+  asm (STMXCSR " %0" : "=m" (*&mxcsr));
+  mxcsr = (mxcsr & ~0x6000) | (e->__mxcsr & 0x6000);
+  asm volatile (LDMXCSR " %0" : : "m" (*&mxcsr));
+}
+#define libc_feresetround  libc_feresetround
+#define libc_feresetroundf libc_feresetround
+
 #include_next <math_private.h>
 
 extern __always_inline double