glibc/sysdeps/powerpc/powerpc64/fpu
Joseph Myers 21378ae0d3 Fix powerpc round, roundf spurious "inexact" (bug 19238).
The powerpc hard-float round and roundf functions, both 32-bit and
64-bit, raise spurious "inexact" exceptions for integer arguments from
adding 0.5 and rounding to integer toward zero.

Since these functions already save and restore the rounding mode, it's
natural to make them restore the full floating-point state instead to
fix this bug, which this patch does.  The save of the state is moved
after the first floating-point operation on the input so that any
"invalid" exceptions from signaling NaN inputs are properly
preserved.  As a consequence of this approach to the fix, "inexact"
for noninteger arguments (disallowed by TS 18661-1 but not by C99/C11,
see bug 15479) is also avoided for these implementations; this is
*not* a general fix for bug 15479 since plenty of other
implementations of various functions still raise spurious "inexact"
for noninteger arguments.

This issue and fix do not apply to builds using power5+ versions of
round and roundf, which use the frin instruction and avoid "inexact"
exceptions that way.

This patch should get hard-float powerpc32 and powerpc64 (default
function implementations) back to a state where test-float and
test-double will pass after ulps regeneration.

Tested for powerpc32 and powerpc64.

	[BZ #15479]
	[BZ #19238]
	* sysdeps/powerpc/powerpc32/fpu/s_round.S (__round): Save
	floating-point state after first operation on input.  Restore full
	state rather than just rounding mode.
	* sysdeps/powerpc/powerpc32/fpu/s_roundf.S (__roundf): Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_round.S (__round): Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_roundf.S (__roundf): Likewise.
2015-11-12 19:00:06 +00:00
..
multiarch
s_ceil.S
s_ceilf.S
s_copysign.S
s_copysignf.S
s_copysignl.S
s_fabs.S
s_fabsl.S
s_fdim.c
s_floor.S
s_floorf.S
s_fma.S
s_fmax.S
s_fmin.S
s_isnan.S
s_llrint.S
s_llrintf.S
s_llround.S Fix powerpc64 lround, lroundf, llround, llroundf spurious "inexact" exceptions (bug 19235). 2015-11-12 16:24:00 +00:00
s_llroundf.S Fix powerpc64 lround, lroundf, llround, llroundf spurious "inexact" exceptions (bug 19235). 2015-11-12 16:24:00 +00:00
s_lrint.S
s_lround.S
s_lroundf.S
s_nearbyint.S Fix powerpc nearbyint wrongly clearing "inexact" and leaving traps disabled (bug 19228). 2015-11-11 00:06:09 +00:00
s_nearbyintf.S Fix powerpc nearbyint wrongly clearing "inexact" and leaving traps disabled (bug 19228). 2015-11-11 00:06:09 +00:00
s_rint.S
s_rintf.S
s_round.S Fix powerpc round, roundf spurious "inexact" (bug 19238). 2015-11-12 19:00:06 +00:00
s_roundf.S Fix powerpc round, roundf spurious "inexact" (bug 19238). 2015-11-12 19:00:06 +00:00
s_trunc.S
s_truncf.S