diff options
Diffstat (limited to 'sysdeps/s390/fpu/ftestexcept.c')
-rw-r--r-- | sysdeps/s390/fpu/ftestexcept.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/sysdeps/s390/fpu/ftestexcept.c b/sysdeps/s390/fpu/ftestexcept.c index 6889632a5b..55b7c4a332 100644 --- a/sysdeps/s390/fpu/ftestexcept.c +++ b/sysdeps/s390/fpu/ftestexcept.c @@ -23,11 +23,17 @@ int fetestexcept (int excepts) { - fexcept_t temp; + fexcept_t temp, res; /* Get current exceptions. */ _FPU_GETCW (temp); - temp = (temp >> FPC_DXC_SHIFT) | (temp >> FPC_FLAGS_SHIFT); - return temp & excepts & FE_ALL_EXCEPT; + res = temp >> 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. + Evaluate flags and last dxc-exception-code. */ + res |= temp >> FPC_DXC_SHIFT; + + return res & excepts & FE_ALL_EXCEPT; } libm_hidden_def (fetestexcept) |