diff options
author | Wilco <wdijkstr@arm.com> | 2014-05-15 15:18:40 +0100 |
---|---|---|
committer | Marcus Shawcroft <marcus.shawcroft@arm.com> | 2014-05-15 15:23:27 +0100 |
commit | 1a2f40e5d14ed6450696feacf04fca5eeceae7ef (patch) | |
tree | f08d34c9426d8833b6daef1509a1ac431e0b3c0b /sysdeps/arm/fsetexcptflg.c | |
parent | cf26a0cb6a0bbaca46a01ddad6662e5e5159a32a (diff) | |
download | glibc-1a2f40e5d14ed6450696feacf04fca5eeceae7ef.tar.gz |
ARM: Improve fenv implementation
Diffstat (limited to 'sysdeps/arm/fsetexcptflg.c')
-rw-r--r-- | sysdeps/arm/fsetexcptflg.c | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/sysdeps/arm/fsetexcptflg.c b/sysdeps/arm/fsetexcptflg.c index 7e3d007e96..1a610ff912 100644 --- a/sysdeps/arm/fsetexcptflg.c +++ b/sysdeps/arm/fsetexcptflg.c @@ -25,24 +25,19 @@ int fesetexceptflag (const fexcept_t *flagp, int excepts) { - if (ARM_HAVE_VFP) - { - fexcept_t temp; + fpu_control_t fpscr; - /* Get the current environment. */ - _FPU_GETCW (temp); + /* Fail if a VFP unit isn't present unless nothing needs to be done. */ + if (!ARM_HAVE_VFP) + return (excepts != 0); - /* Set the desired exception mask. */ - temp &= ~(excepts & FE_ALL_EXCEPT); - temp |= (*flagp & excepts & FE_ALL_EXCEPT); + _FPU_GETCW (fpscr); - /* Save state back to the FPU. */ - _FPU_SETCW (temp); + /* Set the desired exception mask. */ + fpscr &= ~(excepts & FE_ALL_EXCEPT); + fpscr |= (*flagp & excepts & FE_ALL_EXCEPT); - /* Success. */ - return 0; - } - - /* Unsupported, so fail unless nothing needs to be done. */ - return (excepts != 0); + /* Save state back to the FPU. */ + _FPU_SETCW (fpscr); + return 0; } |