summaryrefslogtreecommitdiff
path: root/sysdeps/powerpc/fpu/feholdexcpt.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-05-10 06:44:30 +0000
committerJakub Jelinek <jakub@redhat.com>2007-05-10 06:44:30 +0000
commit96bad006f14ac46ca7a59dc4c5ba5ed9ef7a1560 (patch)
tree9e209798f73466fb9622bf0a9b14f4fabf00eb29 /sysdeps/powerpc/fpu/feholdexcpt.c
parent2a0a747e57ec96bab9d4a6b7c0b32df82a41316e (diff)
Updated to fedora-glibc-20070510T0634cvs/fedora-glibc-2_5_90-23
Diffstat (limited to 'sysdeps/powerpc/fpu/feholdexcpt.c')
-rw-r--r--sysdeps/powerpc/fpu/feholdexcpt.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/sysdeps/powerpc/fpu/feholdexcpt.c b/sysdeps/powerpc/fpu/feholdexcpt.c
index 150becd678..c9432248db 100644
--- a/sysdeps/powerpc/fpu/feholdexcpt.c
+++ b/sysdeps/powerpc/fpu/feholdexcpt.c
@@ -22,17 +22,24 @@
int
feholdexcept (fenv_t *envp)
{
- fenv_union_t u;
+ fenv_union_t old, new;
- /* Get the current state. */
- u.fenv = *envp = fegetenv_register ();
+ /* Save the currently set exceptions. */
+ old.fenv = *envp = fegetenv_register ();
- /* Clear everything except for the rounding mode and non-IEEE arithmetic
+ /* Clear everything except for the rounding modes and non-IEEE arithmetic
flag. */
- u.l[1] = u.l[1] & 7;
+ new.l[1] = old.l[1] & 7;
+ new.l[0] = old.l[0];
+
+ /* If the old env had any eabled exceptions, then mask SIGFPE in the
+ MSR FE0/FE1 bits. This may allow the FPU to run faster because it
+ always takes the default action and can not generate SIGFPE. */
+ if ((old.l[1] & 0x000000F8) != 0)
+ (void)__fe_mask_env ();
/* Put the new state in effect. */
- fesetenv_register (u.fenv);
+ fesetenv_register (new.fenv);
return 0;
}