diff options
author | Wilco <wdijkstr@arm.com> | 2014-05-15 15:18:40 +0100 |
---|---|---|
committer | Will Newton <will.newton@linaro.org> | 2014-06-06 11:50:29 +0100 |
commit | 074ae1942e811a459e811674a7b70186d3abc6ff (patch) | |
tree | fccd7f52155fd602b0ccbd0ee15e1a0828e89d46 /libc/ports/sysdeps/arm/fedisblxcpt.c | |
parent | 0c7017122ba59c4366b89d0b78f0834e458a69b5 (diff) |
ARM: Improve fenv implementation
Diffstat (limited to 'libc/ports/sysdeps/arm/fedisblxcpt.c')
-rw-r--r-- | libc/ports/sysdeps/arm/fedisblxcpt.c | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/libc/ports/sysdeps/arm/fedisblxcpt.c b/libc/ports/sysdeps/arm/fedisblxcpt.c index 88da53943..f2956cd32 100644 --- a/libc/ports/sysdeps/arm/fedisblxcpt.c +++ b/libc/ports/sysdeps/arm/fedisblxcpt.c @@ -25,23 +25,17 @@ int fedisableexcept (int excepts) { - if (ARM_HAVE_VFP) - { - unsigned long int new_exc, old_exc; + fpu_control_t fpscr, new_fpscr; - _FPU_GETCW(new_exc); + /* Fail if a VFP unit isn't present. */ + if (!ARM_HAVE_VFP) + return -1; - old_exc = (new_exc >> FE_EXCEPT_SHIFT) & FE_ALL_EXCEPT; + _FPU_GETCW (fpscr); + excepts &= FE_ALL_EXCEPT; + new_fpscr = fpscr & ~(excepts << FE_EXCEPT_SHIFT); - excepts &= FE_ALL_EXCEPT; + _FPU_SETCW (new_fpscr); - new_exc &= ~(excepts << FE_EXCEPT_SHIFT); - - _FPU_SETCW(new_exc); - - return old_exc; - } - - /* Unsupported, so return -1 for failure. */ - return -1; + return (fpscr >> FE_EXCEPT_SHIFT) & FE_ALL_EXCEPT; } |