glibc/sysdeps/powerpc/powerpc64/fpu
Joseph Myers 24e9ae1bc2 Avoid "invalid" exceptions from powerpc fabsl (sNaN) (bug 20157).
The powerpc implementations of fabsl for ldbl-128ibm (both powerpc32
and powerpc64) wrongly raise the "invalid" exception for sNaN
arguments.  fabs functions should be quiet for all inputs including
signaling NaNs.  The problem is the use of a comparison instruction
fcmpu to determine if the high part of the argument is negative and so
the low part needs to be negated; such instructions raise "invalid"
for sNaNs.

There is a pure integer implementation of fabsl in
sysdeps/ieee754/ldbl-128ibm/s_fabsl.c.  However, it's not necessary to
use it to avoid such exceptions.  The fsel instruction does not raise
exceptions for sNaNs, and can be used in place of the original
comparison.  (Note that if the high part is zero or a NaN, it does not
matter whether the low part is negated; the choice of whether the low
part of a zero is +0 or -0 does not affect the value, and the low part
of a NaN does not affect the value / payload either.)

The condition in GCC for fsel to be available is TARGET_PPC_GFXOPT,
corresponding to the _ARCH_PPCGR predefined macro.  fsel is available
on all 64-bit processors supported by GCC.  A few 32-bit processors
supported by GCC do not have TARGET_PPC_GFXOPT despite having hard
float support.  To support those processors, integer code (similar to
that in copysignl) is included for the !_ARCH_PPCGR case for
powerpc32.

Tested for powerpc32 (configurations with and without _ARCH_PPCGR) and
powerpc64.

	[BZ #20157]
	* sysdeps/powerpc/powerpc32/fpu/s_fabsl.S (__fabsl): Use fsel to
	determine whether to negate low half if [_ARCH_PPCGR], and integer
	comparison otherwise.
	* sysdeps/powerpc/powerpc64/fpu/s_fabsl.S (__fabsl): Use fsel to
	determine whether to negate low half.
2016-05-27 15:29:31 +00:00
..
multiarch Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_ceil.S Do not raise "inexact" from powerpc64 ceil, floor, trunc (bug 15479). 2016-05-25 17:42:22 +00:00
s_ceilf.S Do not raise "inexact" from powerpc64 ceil, floor, trunc (bug 15479). 2016-05-25 17:42:22 +00:00
s_copysign.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_copysignf.S
s_copysignl.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_fabs.S 2006-01-27 Dwayne Grant McConnell <decimal@us.ibm.com> 2006-01-28 00:15:15 +00:00
s_fabsl.S Avoid "invalid" exceptions from powerpc fabsl (sNaN) (bug 20157). 2016-05-27 15:29:31 +00:00
s_fdim.c 2006-01-27 Dwayne Grant McConnell <decimal@us.ibm.com> 2006-01-28 00:15:15 +00:00
s_floor.S Do not raise "inexact" from powerpc64 ceil, floor, trunc (bug 15479). 2016-05-25 17:42:22 +00:00
s_floorf.S Do not raise "inexact" from powerpc64 ceil, floor, trunc (bug 15479). 2016-05-25 17:42:22 +00:00
s_fma.S Implement accurate fma. 2010-10-13 22:27:03 -04:00
s_fmax.S 2006-01-27 Dwayne Grant McConnell <decimal@us.ibm.com> 2006-01-28 00:15:15 +00:00
s_fmin.S 2006-01-27 Dwayne Grant McConnell <decimal@us.ibm.com> 2006-01-28 00:15:15 +00:00
s_isnan.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_llrint.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_llrintf.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_llround.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_llroundf.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_lrint.S * include/features.h (__GLIBC_MINOR__): Bump to 8. 2008-04-11 17:33:24 +00:00
s_lround.S * include/features.h (__GLIBC_MINOR__): Bump to 8. 2008-04-11 17:33:24 +00:00
s_lroundf.S * include/features.h (__GLIBC_MINOR__): Bump to 8. 2008-04-11 17:33:24 +00:00
s_nearbyint.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_nearbyintf.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_rint.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_rintf.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_round.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_roundf.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
s_trunc.S Do not raise "inexact" from powerpc64 ceil, floor, trunc (bug 15479). 2016-05-25 17:42:22 +00:00
s_truncf.S Do not raise "inexact" from powerpc64 ceil, floor, trunc (bug 15479). 2016-05-25 17:42:22 +00:00