about summary refs log tree commit diff
path: root/sysdeps/s390/fpu/fclrexcpt.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/s390/fpu/fclrexcpt.c')
-rw-r--r--sysdeps/s390/fpu/fclrexcpt.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sysdeps/s390/fpu/fclrexcpt.c b/sysdeps/s390/fpu/fclrexcpt.c
index dd138086ab..7f4208483d 100644
--- a/sysdeps/s390/fpu/fclrexcpt.c
+++ b/sysdeps/s390/fpu/fclrexcpt.c
@@ -29,7 +29,12 @@ feclearexcept (int excepts)
 
   _FPU_GETCW (temp);
   /* Clear the relevant bits.  */
-  temp &= ~((excepts << FPC_DXC_SHIFT)|(excepts << FPC_FLAGS_SHIFT));
+  temp &= ~(excepts << FPC_FLAGS_SHIFT);
+  if ((temp & FPC_NOT_FPU_EXCEPTION) == 0)
+    /* Bits 6, 7 of dxc-byte are zero,
+       thus bits 0-5 of dxc-byte correspond to the flag-bits.
+       Clear the relevant bits in flags and dxc-field.  */
+    temp &= ~(excepts << FPC_DXC_SHIFT);
 
   /* Put the new data in effect.  */
   _FPU_SETCW (temp);