diff options
author | Wilco <wdijkstr@arm.com> | 2014-06-24 12:04:27 +0000 |
---|---|---|
committer | Wilco <wdijkstr@arm.com> | 2014-06-24 12:04:27 +0000 |
commit | 001f7b773c637560ecfa686452a5e68d60d07db3 (patch) | |
tree | 08bd670c6b892304a287c56f6cbeb00e92276567 /sysdeps/arm/setfpucw.c | |
parent | 4841e6a6c2fa691201fb52dfaf6b6a8920229bac (diff) | |
download | glibc-001f7b773c637560ecfa686452a5e68d60d07db3.tar.gz |
Speed up the ARM fenv implementation by avoiding unnecessary FPSCR
writes if the FPSCR remains unchanged.
2014-06-24 Wilco <wdijkstr@arm.com>
* sysdeps/arm/fclrexcpt.c (feclearexcept):
Optimize to avoid unnecessary FPSCR writes.
* sysdeps/arm/fedisblxcpt.c (fedisableexcept): Likewise.
* sysdeps/arm/feenablxcpt.c (feenableexcept): Likewise.
* sysdeps/arm/fsetexcptflg.c (fesetexceptflag): Likewise.
* sysdeps/arm/setfpucw.c (__setfpucw): Likewise.
Diffstat (limited to 'sysdeps/arm/setfpucw.c')
-rw-r--r-- | sysdeps/arm/setfpucw.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sysdeps/arm/setfpucw.c b/sysdeps/arm/setfpucw.c index 7416377f9e..259b020f81 100644 --- a/sysdeps/arm/setfpucw.c +++ b/sysdeps/arm/setfpucw.c @@ -24,19 +24,20 @@ void __setfpucw (fpu_control_t set) { - fpu_control_t fpscr; + fpu_control_t fpscr, new_fpscr; /* Do nothing if a VFP unit isn't present. */ if (!ARM_HAVE_VFP) return; - /* Fetch the current control word. */ _FPU_GETCW (fpscr); /* Preserve the reserved bits, and set the rest as the user specified (or the default, if the user gave zero). */ - fpscr &= _FPU_RESERVED; - fpscr |= set & ~_FPU_RESERVED; + new_fpscr = fpscr & _FPU_RESERVED; + new_fpscr |= set & ~_FPU_RESERVED; - _FPU_SETCW (fpscr); + /* Write FPSCR if changed. */ + if (new_fpscr != fpscr) + _FPU_SETCW (fpscr); } |