From 2cbec365663cd0e2fe21f77b1f5e20ae3ab5f538 Mon Sep 17 00:00:00 2001 From: Aurelien Jarno Date: Thu, 30 Jun 2016 21:18:34 +0200 Subject: SPARC: fix nearbyint on sNaN input nearbyint and nearbyintf should not trigger inexact exceptions, but should still trigger an invalid exception for a sNaN input. The SPARC specific implementations of these functions save the FSR at the beginning of the function and restore it at the end to not trigger an inexact exception. This however doesn't work for an sNaN input which need to trigger an invalid exception. Fix that by adding a fcmp instruction using the input value before saving FSR, so that an invalid exception is triggered for a sNaN input. This fixes the math/test-nearbyint-except test on SPARC. Changelog: * sparc/sparc32/sparcv9/fpu/s_nearbyint.S (__nearbyint): Trigger an invalid exception for a sNaN input. * sparc/sparc32/sparcv9/fpu/s_nearbyintf.S (__nearbyintf): Likewise. * sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyint-vis3.S (__nearbyint_vis3): Likewise * sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyintf-vis3.S (__nearbyintf_vis3): Likewise * sparc/sparc64/fpu/s_nearbyint.S (__nearbyint): Likewise. * sparc/sparc64/fpu/s_nearbyintf.S (__nearbyintf): Likewise. * sparc/sparc64/fpu/multiarch/s_nearbyint-vis3.S (__nearbyint_vis3): Likewise. * sparc/sparc64/fpu/multiarch/s_nearbyintf-vis3.S (__nearbyintf_vis3): Likewise. --- ChangeLog | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index 5844894b26..a7ca1ff16e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2016-07-01 Aurelien Jarno + + * sparc/sparc32/sparcv9/fpu/s_nearbyint.S (__nearbyint): Trigger an + invalid exception for a sNaN input. + * sparc/sparc32/sparcv9/fpu/s_nearbyintf.S (__nearbyintf): Likewise. + * sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyint-vis3.S + (__nearbyint_vis3): Likewise + * sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyintf-vis3.S + (__nearbyintf_vis3): Likewise + * sparc/sparc64/fpu/s_nearbyint.S (__nearbyint): Likewise. + * sparc/sparc64/fpu/s_nearbyintf.S (__nearbyintf): Likewise. + * sparc/sparc64/fpu/multiarch/s_nearbyint-vis3.S (__nearbyint_vis3): + Likewise. + * sparc/sparc64/fpu/multiarch/s_nearbyintf-vis3.S (__nearbyintf_vis3): + Likewise. + 2016-07-01 H.J. Lu [BZ #20139] -- cgit v1.2.1