summaryrefslogtreecommitdiff
path: root/sysdeps/aarch64/fpu/feholdexcpt.c
diff options
context:
space:
mode:
authorIan Bolton <ian.bolton@arm.com>2014-04-24 07:15:33 +0100
committerMarcus Shawcroft <marcus.shawcroft@linaro.org>2014-04-24 07:15:33 +0100
commite5e0d9a4f632735cf3bb440eecb5caee5eea44c1 (patch)
tree51c5774783bb0479b35a33f9a22b86db00c20cbe /sysdeps/aarch64/fpu/feholdexcpt.c
parentbacc75f7be11656387c239831f490155f5fb3700 (diff)
downloadglibc-e5e0d9a4f632735cf3bb440eecb5caee5eea44c1.tar.gz
[AArch64] Suppress unnecessary FPSR and FPCR writes.
Diffstat (limited to 'sysdeps/aarch64/fpu/feholdexcpt.c')
-rw-r--r--sysdeps/aarch64/fpu/feholdexcpt.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/sysdeps/aarch64/fpu/feholdexcpt.c b/sysdeps/aarch64/fpu/feholdexcpt.c
index 0514ac15b5..973ba4a56a 100644
--- a/sysdeps/aarch64/fpu/feholdexcpt.c
+++ b/sysdeps/aarch64/fpu/feholdexcpt.c
@@ -22,8 +22,10 @@
int
feholdexcept (fenv_t *envp)
{
- fpu_fpsr_t fpsr;
fpu_control_t fpcr;
+ fpu_control_t fpcr_new;
+ fpu_fpsr_t fpsr;
+ fpu_fpsr_t fpsr_new;
_FPU_GETCW (fpcr);
envp->__fpcr = fpcr;
@@ -32,14 +34,16 @@ feholdexcept (fenv_t *envp)
envp->__fpsr = fpsr;
/* Now set all exceptions to non-stop. */
- fpcr &= ~(FE_ALL_EXCEPT << FE_EXCEPT_SHIFT);
+ fpcr_new = fpcr & ~(FE_ALL_EXCEPT << FE_EXCEPT_SHIFT);
/* And clear all exception flags. */
- fpsr &= ~FE_ALL_EXCEPT;
+ fpsr_new = fpsr & ~FE_ALL_EXCEPT;
- _FPU_SETFPSR (fpsr);
+ if (fpsr != fpsr_new)
+ _FPU_SETFPSR (fpsr_new);
- _FPU_SETCW (fpcr);
+ if (fpcr != fpcr_new)
+ _FPU_SETCW (fpcr_new);
return 0;
}