diff options
Diffstat (limited to 'sysdeps/i386')
-rw-r--r-- | sysdeps/i386/Makefile | 8 | ||||
-rw-r--r-- | sysdeps/i386/fpu/fenv_private.h | 18 |
2 files changed, 21 insertions, 5 deletions
diff --git a/sysdeps/i386/Makefile b/sysdeps/i386/Makefile index 1682394..c0a4fe1 100644 --- a/sysdeps/i386/Makefile +++ b/sysdeps/i386/Makefile @@ -5,6 +5,14 @@ asm-CPPFLAGS += -DGAS_SYNTAX # The i386 `long double' is a distinct type we support. long-double-fcts = yes +ifeq ($(subdir),math) +# These functions change the rounding mode internally and need to +# update both the SSE2 rounding mode and the 387 rounding mode. See +# the handling of MATH_SET_BOTH_ROUNDING_MODES in +# sysdeps/i386/fpu/fenv_private.h. +CFLAGS-e_gamma_r.c += -DMATH_SET_BOTH_ROUNDING_MODES +endif + ifeq ($(subdir),string) sysdep_routines += cacheinfo endif diff --git a/sysdeps/i386/fpu/fenv_private.h b/sysdeps/i386/fpu/fenv_private.h index 59e83d8..637dae5 100644 --- a/sysdeps/i386/fpu/fenv_private.h +++ b/sysdeps/i386/fpu/fenv_private.h @@ -460,11 +460,19 @@ libc_feupdateenv_387_ctx (struct rm_ctx *ctx) #endif /* __SSE_MATH__ */ #ifdef __SSE2_MATH__ -# define libc_feholdexcept_setround_ctx libc_feholdexcept_setround_sse_ctx -# define libc_fesetenv_ctx libc_fesetenv_sse_ctx -# define libc_feupdateenv_ctx libc_feupdateenv_sse_ctx -# define libc_feholdsetround_ctx libc_feholdsetround_sse_ctx -# define libc_feresetround_ctx libc_feresetround_sse_ctx +# if defined (__x86_64__) || !defined (MATH_SET_BOTH_ROUNDING_MODES) +# define libc_feholdexcept_setround_ctx libc_feholdexcept_setround_sse_ctx +# define libc_fesetenv_ctx libc_fesetenv_sse_ctx +# define libc_feupdateenv_ctx libc_feupdateenv_sse_ctx +# define libc_feholdsetround_ctx libc_feholdsetround_sse_ctx +# define libc_feresetround_ctx libc_feresetround_sse_ctx +# else +# define libc_feholdexcept_setround_ctx default_libc_feholdexcept_setround_ctx +# define libc_fesetenv_ctx default_libc_fesetenv_ctx +# define libc_feupdateenv_ctx default_libc_feupdateenv_ctx +# define libc_feholdsetround_ctx default_libc_feholdsetround_ctx +# define libc_feresetround_ctx default_libc_feresetround_ctx +# endif #else # define libc_feholdexcept_setround_ctx libc_feholdexcept_setround_387_ctx # define libc_feupdateenv_ctx libc_feupdateenv_387_ctx |