diff options
author | Carlos O'Donell <carlos@systemhalted.org> | 2015-03-11 02:42:27 -0400 |
---|---|---|
committer | Carlos O'Donell <carlos@systemhalted.org> | 2015-03-11 02:48:59 -0400 |
commit | e4363cfb5760d88a9f353c69383b15d5c2705070 (patch) | |
tree | d45136a41ea523d4ee293b62fcbe98b2095a16d6 /sysdeps/hppa/fpu/fsetexcptflg.c | |
parent | fae1aa8d226ce860124efd67ede03004b19b89e2 (diff) | |
download | glibc-e4363cfb5760d88a9f353c69383b15d5c2705070.tar.gz glibc-e4363cfb5760d88a9f353c69383b15d5c2705070.tar.xz glibc-e4363cfb5760d88a9f353c69383b15d5c2705070.zip |
hppa: Fix feupdateenv and fesetexceptflag (Bug 18111).
The function feupdateenv has been fixed to correctly handle FE_DFL_ENV and FE_NOMASK_ENV. The fesetexceptflag function has been fixed to correctly handle setting the new flags instead of just OR-ing the existing flags. This fixes the test-fenv-return and test-fenvinline failures on hppa.
Diffstat (limited to 'sysdeps/hppa/fpu/fsetexcptflg.c')
-rw-r--r-- | sysdeps/hppa/fpu/fsetexcptflg.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/sysdeps/hppa/fpu/fsetexcptflg.c b/sysdeps/hppa/fpu/fsetexcptflg.c index 2c34a1e287..c31de8bbe4 100644 --- a/sysdeps/hppa/fpu/fsetexcptflg.c +++ b/sysdeps/hppa/fpu/fsetexcptflg.c @@ -18,19 +18,25 @@ <http://www.gnu.org/licenses/>. */ #include <fenv.h> -#include <math.h> +#include <fpu_control.h> int fesetexceptflag (const fexcept_t *flagp, int excepts) { - union { unsigned long long l; unsigned int sw[2]; } s; + fpu_control_t fpsr; + fpu_control_t fpsr_new; /* Get the current status word. */ - __asm__ ("fstd %%fr0,0(%1)" : "=m" (s.l) : "r" (&s.l) : "%r0"); - /* Install new raised trap bits */ - s.sw[0] |= (*flagp & excepts & FE_ALL_EXCEPT) << 27; + _FPU_GETCW (fpsr); + excepts &= FE_ALL_EXCEPT; + + /* Install new raised flags. */ + fpsr_new = fpsr & ~(excepts << _FPU_HPPA_SHIFT_FLAGS); + fpsr_new |= (*flagp & excepts) << _FPU_HPPA_SHIFT_FLAGS; + /* Store the new status word. */ - __asm__ ("fldd 0(%0),%%fr0" : : "r" (&s.l), "m" (s.l) : "%r0"); + if (fpsr != fpsr_new) + _FPU_SETCW (fpsr_new); /* Success. */ return 0; |