diff options
Diffstat (limited to 'sysdeps/i386/fpu')
-rw-r--r-- | sysdeps/i386/fpu/fesetround.c | 4 | ||||
-rw-r--r-- | sysdeps/i386/fpu/ftestexcept.c | 12 |
2 files changed, 12 insertions, 4 deletions
diff --git a/sysdeps/i386/fpu/fesetround.c b/sysdeps/i386/fpu/fesetround.c index 342ed42318..fae74d33b6 100644 --- a/sysdeps/i386/fpu/fesetround.c +++ b/sysdeps/i386/fpu/fesetround.c @@ -43,8 +43,8 @@ fesetround (int round) unsigned int xcw; __asm__ ("stmxcsr %0" : "=m" (*&xcw)); - cw &= ~0x6000; - cw |= round << 3; + xcw &= ~0x6000; + xcw |= round << 3; __asm__ ("ldmxcsr %0" : : "m" (*&xcw)); } diff --git a/sysdeps/i386/fpu/ftestexcept.c b/sysdeps/i386/fpu/ftestexcept.c index cee7b83bb4..e449571c04 100644 --- a/sysdeps/i386/fpu/ftestexcept.c +++ b/sysdeps/i386/fpu/ftestexcept.c @@ -1,5 +1,5 @@ /* Test exception in current environment. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -19,14 +19,22 @@ 02111-1307 USA. */ #include <fenv.h> +#include <unistd.h> +#include <dl-procinfo.h> +#include <ldsodefs.h> int fetestexcept (int excepts) { int temp; + int xtemp = 0; /* Get current exceptions. */ __asm__ ("fnstsw %0" : "=a" (temp)); - return temp & excepts & FE_ALL_EXCEPT; + /* If the CPU supports SSE we test the MXCSR as well. */ + if ((GL(dl_hwcap_mask) & HWCAP_I386_XMM) != 0) + __asm__ ("stmxcsr %0" : "=m" (*&xtemp)); + + return (temp | xtemp) & excepts & FE_ALL_EXCEPT; } |