From 4855e3ddf5061dd8ddcefafc7185f6f70937434b Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 18 Oct 2011 09:59:04 -0400 Subject: Provide combined internal feholdexcept/fesetround interface --- sysdeps/x86_64/fpu/math_private.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'sysdeps/x86_64/fpu') diff --git a/sysdeps/x86_64/fpu/math_private.h b/sysdeps/x86_64/fpu/math_private.h index 4886c64dc3..28bd9cee2d 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)) -- cgit v1.2.3