summaryrefslogtreecommitdiff
path: root/sysdeps/arm/fesetenv.c
diff options
context:
space:
mode:
authorMarcus Shawcroft <marcus.shawcroft@arm.com>2014-05-19 09:08:59 +0100
committerMarcus Shawcroft <marcus.shawcroft@arm.com>2014-05-19 09:08:59 +0100
commit18f8524d2cf5e9f699055ed2c2cdeb56cd3b4cc4 (patch)
tree92b5d3167160de1067a52ba0fec81393f8e196cf /sysdeps/arm/fesetenv.c
parent834caf06f33d79be54cff63c274fba2845513593 (diff)
Revert "ARM: Improve fenv implementation"
This reverts commit c0c08d02c82275353f5c556f935a1a01714d9d7f.
Diffstat (limited to 'sysdeps/arm/fesetenv.c')
-rw-r--r--sysdeps/arm/fesetenv.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/sysdeps/arm/fesetenv.c b/sysdeps/arm/fesetenv.c
index 9e2aa81f9b..62031d596d 100644
--- a/sysdeps/arm/fesetenv.c
+++ b/sysdeps/arm/fesetenv.c
@@ -16,43 +16,43 @@
License along with the GNU C Library. If not, see
<http://www.gnu.org/licenses/>. */
-#include <fenv_private.h>
+#include <fenv.h>
+#include <fpu_control.h>
#include <arm-features.h>
int
fesetenv (const fenv_t *envp)
{
+ fpu_control_t fpscr;
+
/* Fail if a VFP unit isn't present. */
if (!ARM_HAVE_VFP)
return 1;
- if ((envp == FE_DFL_ENV) || (envp == FE_NOMASK_ENV))
- {
- fpu_control_t fpscr, new_fpscr;
-
- _FPU_GETCW (fpscr);
+ _FPU_GETCW (fpscr);
- /* Preserve the reserved FPSCR flags. */
- new_fpscr = fpscr & _FPU_RESERVED;
+ /* Preserve the reserved FPSCR flags. */
+ fpscr &= _FPU_RESERVED;
- if (envp == FE_DFL_ENV)
- _FPU_SETCW (new_fpscr | _FPU_DEFAULT);
- else
- {
- _FPU_SETCW (new_fpscr | _FPU_IEEE);
- /* Not all VFP architectures support trapping exceptions, so
- test whether the relevant bits were set and fail if not. */
- _FPU_GETCW (fpscr);
+ if (envp == FE_DFL_ENV)
+ fpscr |= _FPU_DEFAULT;
+ else if (envp == FE_NOMASK_ENV)
+ fpscr |= _FPU_IEEE;
+ else
+ fpscr |= envp->__cw & ~_FPU_RESERVED;
- if ((fpscr & _FPU_IEEE) != _FPU_IEEE)
- return 1;
- }
+ _FPU_SETCW (fpscr);
- return 0;
+ if (envp == FE_NOMASK_ENV)
+ {
+ /* Not all VFP architectures support trapping exceptions, so
+ test whether the relevant bits were set and fail if not. */
+ _FPU_GETCW (fpscr);
+ if ((fpscr & _FPU_IEEE) != _FPU_IEEE)
+ return 1;
}
- libc_fesetenv_vfp (envp);
return 0;
}