aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/x86_64
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2011-10-18 09:59:04 -0400
committerUlrich Drepper <drepper@gmail.com>2011-10-18 09:59:04 -0400
commit4855e3ddf5061dd8ddcefafc7185f6f70937434b (patch)
tree7e29eb6e22a1dda9a7133e577787ac9f9b6c17e7 /sysdeps/x86_64
parent23ce5627803ad1e6686355965cd68bb23d05fb28 (diff)
downloadglibc-4855e3ddf5061dd8ddcefafc7185f6f70937434b.zip
glibc-4855e3ddf5061dd8ddcefafc7185f6f70937434b.tar.gz
glibc-4855e3ddf5061dd8ddcefafc7185f6f70937434b.tar.bz2
Provide combined internal feholdexcept/fesetround interface
Diffstat (limited to 'sysdeps/x86_64')
-rw-r--r--sysdeps/x86_64/fpu/math_private.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/sysdeps/x86_64/fpu/math_private.h b/sysdeps/x86_64/fpu/math_private.h
index 4886c64..28bd9ce 100644
--- a/sysdeps/x86_64/fpu/math_private.h
+++ b/sysdeps/x86_64/fpu/math_private.h
@@ -145,7 +145,7 @@ do { \
#undef libc_feholdexcept
#define libc_feholdexcept(e) \
- do { \
+ do { \
unsigned int mxcsr; \
asm ("stmxcsr %0" : "=m" (*&mxcsr)); \
(e)->__mxcsr = mxcsr; \
@@ -155,6 +155,18 @@ do { \
// #define libc_feholdexceptf(e) (void) feholdexcept (e)
// #define libc_feholdexceptl(e) (void) feholdexcept (e)
+#undef libc_feholdexcept_setround
+#define libc_feholdexcept_setround(e, r) \
+ do { \
+ unsigned int mxcsr; \
+ asm ("stmxcsr %0" : "=m" (*&mxcsr)); \
+ (e)->__mxcsr = mxcsr; \
+ mxcsr = ((mxcsr | 0x1f80) & ~0x603f) | ((r) << 3); \
+ asm volatile ("ldmxcsr %0" : : "m" (*&mxcsr)); \
+ } while (0)
+// #define libc_feholdexcept_setroundf(e, r) ...
+// #define libc_feholdexcept_setroundl(e, r) ...
+
#undef libc_fesetenv
#define libc_fesetenv(e) \
asm volatile ("ldmxcsr %0" : : "m" ((e)->__mxcsr))