diff options
Diffstat (limited to 'sysdeps/x86_64')
-rw-r--r-- | sysdeps/x86_64/fpu/math_private.h | 23 |
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 |