summaryrefslogtreecommitdiff
path: root/sysdeps/s390/fpu/fsetexcptflg.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/s390/fpu/fsetexcptflg.c')
-rw-r--r--sysdeps/s390/fpu/fsetexcptflg.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/sysdeps/s390/fpu/fsetexcptflg.c b/sysdeps/s390/fpu/fsetexcptflg.c
index cbe9f34155..25ade854bd 100644
--- a/sysdeps/s390/fpu/fsetexcptflg.c
+++ b/sysdeps/s390/fpu/fsetexcptflg.c
@@ -1,5 +1,5 @@
/* Set floating-point environment exception handling.
- Copyright (C) 2000-2015 Free Software Foundation, Inc.
+ Copyright (C) 2000-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com).
@@ -24,16 +24,25 @@
int
fesetexceptflag (const fexcept_t *flagp, int excepts)
{
- fexcept_t temp,newexcepts;
+ fexcept_t temp, newexcepts;
/* Get the current environment. We have to do this since we cannot
separately set the status word. */
_FPU_GETCW (temp);
/* Install the new exception bits in the Accrued Exception Byte. */
excepts = excepts & FE_ALL_EXCEPT;
- newexcepts = (excepts << FPC_DXC_SHIFT) | (excepts << FPC_FLAGS_SHIFT);
+ newexcepts = excepts << FPC_FLAGS_SHIFT;
temp &= ~newexcepts;
- temp |= *flagp & newexcepts;
+ 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 given exceptions in dxc-field. */
+ temp &= ~(excepts << FPC_DXC_SHIFT);
+
+ /* Integrate dxc-byte of flagp into flags. The dxc-byte of flagp contains
+ either an ieee-exception or 0 (see fegetexceptflag). */
+ temp |= (*flagp | ((*flagp >> FPC_DXC_SHIFT) << FPC_FLAGS_SHIFT))
+ & newexcepts;
/* Store the new status word (along with the rest of the environment.
Possibly new exceptions are set but they won't get executed unless