summaryrefslogtreecommitdiff
path: root/math/Makefile
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2015-11-11 00:06:09 +0000
committerJoseph Myers <joseph@codesourcery.com>2015-11-11 00:06:09 +0000
commit71d1b0166b4ace0d804af2993b3815758b852efc (patch)
tree1cfe69ef93cf1fa482ecbd57dc324cd2494895a1 /math/Makefile
parentfe534fe8980fa214c410e3661a4216e781073353 (diff)
Fix powerpc nearbyint wrongly clearing "inexact" and leaving traps disabled (bug 19228).
Similar to bug 15491 recently fixed for x86_64 / x86, the powerpc (both powerpc32 and powerpc64) hard-float implementations of nearbyintf and nearbyint wrongly clear an "inexact" exception that was raised before the function was called; this shows up as failure of the test math/test-nearbyint-except added when that bug was fixed. They also wrongly leave traps on "inexact" disabled if they were enabled before the function was called. This patch fixes the bugs similar to how the x86 bug was fixed: saving and restoring the whole floating-point state, both to restore the original "inexact" flag state and to restore the original state of whether traps on "inexact" were enabled. Because there's a convenient point in the powerpc implementations to save state after any sNaN arguments will have raised "invalid" but before "inexact" traps need to be disabled, no special handling for "invalid" is needed as in the x86 version. Tested for powerpc64 and powerpc32, where it fixes the math/test-nearbyint-except failure as well as fixing the new test math/test-nearbyint-except-2 added by this patch. Also tested for x86_64 and x86 that the new test passes. If powerpc experts see a more efficient way of doing this (e.g. instruction positioning that's better for pipelines on typical processors) then of course followups optimizing the fix are welcome. [BZ #19228] * sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S (__nearbyint): Save and restore full floating-point state. * sysdeps/powerpc/powerpc32/fpu/s_nearbyintf.S (__nearbyintf): Likewise. * sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S (__nearbyint): Likewise. * sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S (__nearbyintf): Likewise. * math/test-nearbyint-except-2.c: New file. * math/Makefile (tests): Add test-nearbyint-except-2.
Diffstat (limited to 'math/Makefile')
-rw-r--r--math/Makefile3
1 files changed, 2 insertions, 1 deletions
diff --git a/math/Makefile b/math/Makefile
index ec9e6b29d1..06412f3980 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -109,7 +109,8 @@ tests = test-matherr test-fenv atest-exp atest-sincos atest-exp2 basic-test \
test-tgmath-int test-tgmath2 test-powl tst-CMPLX tst-CMPLX2 test-snan \
test-fenv-tls test-fenv-preserve test-fenv-return test-fenvinline \
test-nearbyint-except test-fenv-clear test-signgam-finite \
- test-signgam-finite-c99 test-signgam-finite-c11 $(tests-static)
+ test-signgam-finite-c99 test-signgam-finite-c11 \
+ test-nearbyint-except-2 $(tests-static)
tests-static = test-fpucw-static test-fpucw-ieee-static
# We do the `long double' tests only if this data type is available and
# distinct from `double'.