glibc/sysdeps/generic
Joseph Myers bc3753638a Work around powerpc32 integer 0 converting to -0 (bug 887, bug 19049, bug 19050).
On powerpc32 hard-float, older processors (ones where fcfid is not
available for 32-bit code), GCC generates conversions from integers to
floating point that wrongly convert integer 0 to -0 instead of +0 in
FE_DOWNWARD mode.  This in turn results in logb and a few other
functions wrongly returning -0 when they should return +0.

This patch works around this issue in glibc as I proposed in
<https://sourceware.org/ml/libc-alpha/2015-09/msg00728.html>, so that
the affected functions can be correct and the affected tests pass in
the absence of a GCC fix for this longstanding issue (GCC bug 67771 -
if fixed, of course we can put in GCC version conditionals, and
eventually phase out the workarounds).  A new macro
FIX_INT_FP_CONVERT_ZERO is added in a new sysdeps header
fix-int-fp-convert-zero.h, and the powerpc32/fpu version of that
header defines the macro based on the results of a configure test for
whether such conversions use the fcfid instruction.

Tested for x86_64 (that installed stripped shared libraries are
unchanged by the patch) and powerpc (that HAVE_PPC_FCFID comes out to
0 as expected and that the relevant tests are fixed).  Also tested a
build with GCC configured for -mcpu=power4 and verified that
HAVE_PPC_FCFID comes out to 1 in that case.

There are still some other issues to fix to get test-float and
test-double passing cleanly for older powerpc32 processors (apart from
the need for an ulps regeneration for powerpc).  (test-ldouble will be
harder to get passing cleanly, but with a combination of selected
fixes to ldbl-128ibm code that don't involve significant performance
issues, allowing spurious underflow and inexact exceptions for that
format, and lots of XFAILing for the default case of unpatched libgcc,
it should be doable.)

	[BZ #887]
	[BZ #19049]
	[BZ #19050]
	* sysdeps/generic/fix-int-fp-convert-zero.h: New file.
	* sysdeps/ieee754/dbl-64/e_log10.c: Include
	<fix-int-fp-convert-zero.h>.
	(__ieee754_log10): Adjust signs as needed if FIX_INT_FP_CONVERT_ZERO.
	* sysdeps/ieee754/dbl-64/e_log2.c: Include
	<fix-int-fp-convert-zero.h>.
	(__ieee754_log2): Adjust signs as needed if FIX_INT_FP_CONVERT_ZERO.
	* sysdeps/ieee754/dbl-64/s_erf.c: Include
	<fix-int-fp-convert-zero.h>.
	(__erfc): Adjust signs as needed if FIX_INT_FP_CONVERT_ZERO.
	* sysdeps/ieee754/dbl-64/s_logb.c: Include
	<fix-int-fp-convert-zero.h>.
	(__logb): Adjust signs as needed if FIX_INT_FP_CONVERT_ZERO.
	* sysdeps/ieee754/flt-32/e_log10f.c: Include
	<fix-int-fp-convert-zero.h>.
	(__ieee754_log10f): Adjust signs as needed if FIX_INT_FP_CONVERT_ZERO.
	* sysdeps/ieee754/flt-32/e_log2f.c: Include
	<fix-int-fp-convert-zero.h>.
	(__ieee754_log2f): Adjust signs as needed if FIX_INT_FP_CONVERT_ZERO.
	* sysdeps/ieee754/flt-32/s_erff.c: Include
	<fix-int-fp-convert-zero.h>.
	(__erfcf): Adjust signs as needed if FIX_INT_FP_CONVERT_ZERO.
	* sysdeps/ieee754/flt-32/s_logbf.c: Include
	<fix-int-fp-convert-zero.h>.
	(__logbf): Adjust signs as needed if FIX_INT_FP_CONVERT_ZERO.
	* sysdeps/ieee754/ldbl-128ibm/s_erfl.c: Include
	<fix-int-fp-convert-zero.h>.
	(__erfcl): Adjust signs as needed if FIX_INT_FP_CONVERT_ZERO.
	* sysdeps/ieee754/ldbl-128ibm/s_logbl.c: Include
	<fix-int-fp-convert-zero.h>.
	(__logbl): Adjust signs as needed if FIX_INT_FP_CONVERT_ZERO.
	* sysdeps/powerpc/powerpc32/fpu/configure.ac: New file.
	* sysdeps/powerpc/powerpc32/fpu/configure: New generated file.
	* sysdeps/powerpc/powerpc32/fpu/fix-int-fp-convert-zero.h: New
	file.
	* config.h.in [_LIBC] (HAVE_PPC_FCFID): New macro.
2015-10-05 17:46:50 +00:00
..
bits Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
net Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
netinet Define ETH_ALEN in generic <netinet/if_ether.h>. 2015-03-04 16:11:31 -08:00
nfs Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
sys Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
_G_config.h Remove _G_OPEN64, _G_LSEEK64, _G_MMAP64, _G_FSTAT64 from _G_config.h. 2012-10-18 18:50:43 +00:00
_itoa.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
a.out.h
abort-instr.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
aio_misc.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
allocalim.h Update. 2002-10-09 09:42:48 +00:00
asm-syntax.h
atomic-machine.h Move bits/atomic.h to atomic-machine.h (bug 14912). 2015-09-11 20:00:19 +00:00
c++-types.data Add placeholder c++-types.data and *.abilist files. 2015-02-13 15:41:34 -08:00
confstr.h
device-nrs.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
dirstream.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
dl-cache.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
dl-dtprocnum.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
dl-fileid.h Factor file identity rules out of generic rtld code. 2015-07-14 13:15:26 -07:00
dl-fptr.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
dl-hash.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
dl-irel.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
dl-librecon.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
dl-lookupcfg.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
dl-machine.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
dl-osinfo.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
dl-procinfo.c Dummy dl-procinfo.c file for platforms which don't have one. 2002-02-01 18:25:44 +00:00
dl-procinfo.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
dl-sysdep.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
dl-tls.h Update. 2002-02-07 04:08:19 +00:00
dwarf2.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
elide.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
eloop-threshold.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
entry.h Update. 2002-03-15 03:16:52 +00:00
errqueue.h Update. 2001-01-10 23:47:39 +00:00
exit-thread.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
fd_to_filename.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
fips-private.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
fix-int-fp-convert-zero.h Work around powerpc32 integer 0 converting to -0 (bug 887, bug 19049, bug 19050). 2015-10-05 17:46:50 +00:00
fork.h Update. 2002-10-01 00:05:23 +00:00
fpu_control.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
frame.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
framestate.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
gcc-compat.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
gccframe.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
get-rounding-mode.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
gmp-mparam.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
hp-timing-common.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
hp-timing.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
ifreq.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
ifunc-sel.h Move sysdeps/generic/elf/* to sysdeps/generic 2012-03-19 21:04:21 +01:00
intr-msg.h
inttypes.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
ld.abilist Add placeholder c++-types.data and *.abilist files. 2015-02-13 15:41:34 -08:00
ldconfig.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
ldsodefs.h Move bits/libc-lock.h and bits/libc-lockP.h out of bits/ (bug 14912). 2015-09-08 21:11:03 +00:00
libanl.abilist Add placeholder c++-types.data and *.abilist files. 2015-02-13 15:41:34 -08:00
libBrokenLocale.abilist Add placeholder c++-types.data and *.abilist files. 2015-02-13 15:41:34 -08:00
libc-lock.h Move bits/libc-lock.h and bits/libc-lockP.h out of bits/ (bug 14912). 2015-09-08 21:11:03 +00:00
libc-mmap.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
libc-tsd.h Rename bits/libc-tsd.h to libc-tsd.h (bug 14912). 2015-09-03 20:33:46 +00:00
libc.abilist Add placeholder c++-types.data and *.abilist files. 2015-02-13 15:41:34 -08:00
libcidn.abilist Add missed zero length files in previous abilist commit. 2012-04-28 15:38:24 -04:00
libcrypt.abilist Add placeholder c++-types.data and *.abilist files. 2015-02-13 15:41:34 -08:00
libdl.abilist Add placeholder c++-types.data and *.abilist files. 2015-02-13 15:41:34 -08:00
libm-test-ulps Update. 1999-10-19 06:29:27 +00:00
libm.abilist Add placeholder c++-types.data and *.abilist files. 2015-02-13 15:41:34 -08:00
libnss_compat.abilist Add missed zero length files in previous abilist commit. 2012-04-28 15:38:24 -04:00
libnss_db.abilist Add missed zero length files in previous abilist commit. 2012-04-28 15:38:24 -04:00
libnss_dns.abilist Add missed zero length files in previous abilist commit. 2012-04-28 15:38:24 -04:00
libnss_files.abilist Add missed zero length files in previous abilist commit. 2012-04-28 15:38:24 -04:00
libnss_hesiod.abilist Add missed zero length files in previous abilist commit. 2012-04-28 15:38:24 -04:00
libnss_nis.abilist Add missed zero length files in previous abilist commit. 2012-04-28 15:38:24 -04:00
libnss_nisplus.abilist Add missed zero length files in previous abilist commit. 2012-04-28 15:38:24 -04:00
libpthread.abilist Add placeholder c++-types.data and *.abilist files. 2015-02-13 15:41:34 -08:00
libresolv.abilist Add placeholder c++-types.data and *.abilist files. 2015-02-13 15:41:34 -08:00
librt.abilist Add placeholder c++-types.data and *.abilist files. 2015-02-13 15:41:34 -08:00
linkmap.h Rename bits/linkmap.h to linkmap.h (bug 14912). 2015-09-04 19:44:27 +00:00
local-setxid.h * sysdeps/posix/spawni.c (__spawni): Use local_seteuid and 2006-06-04 22:17:06 +00:00
localplt.data Add hidden __tls_get_addr/___tls_get_addr alias 2014-12-21 09:27:11 -08:00
machine-gmon.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
machine-lock.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
machine-sp.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
Makefile Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
malloc-machine.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
malloc-sysdep.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
math_ldbl_opt.h * math/math.h [__NO_LONG_DOUBLE_MATH] (__nldbl_nexttowardf): New 2006-01-14 12:10:44 +00:00
math_ldbl.h Update. 1999-08-02 19:56:07 +00:00
math_private.h Fix clog, clog10 inaccuracy (bug 19016). 2015-09-28 22:11:22 +00:00
math-tests-arch.h Refactoring of START for conditions in individual tests 2015-05-14 18:07:06 +03:00
math-tests.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
memcopy.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
memusage.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
not-cancel.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
nscd-types.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
pagecopy.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
paths.h generic paths.h: remove old paths from _PATH_STDPATH 2012-11-04 10:11:39 +01:00
profil-counter.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
pty-private.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
register-dump.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
rtld-lowlevel.h Jakub Jelinek <jakub@redhat.com> 2006-10-10 00:51:29 +00:00
safe-fatal.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
sigcontextinfo.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
siglist.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
sigset-cvt-mask.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
stackguard-macros.h BZ #15754: Fix test case for ARM. 2013-09-23 01:44:38 -04:00
stackinfo.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
stdint.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
stdio-lock.h Move bits/libc-lock.h and bits/libc-lockP.h out of bits/ (bug 14912). 2015-09-08 21:11:03 +00:00
symbol-hacks.h Remove NOT_IN_libc 2014-11-24 15:03:45 +05:30
sysdep-cancel.h * elf/dl-sym.c (do_sym): Use RTLD_SINGLE_THREAD_P. 2006-10-29 21:46:32 +00:00
sysdep.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
thread_state.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
tininess.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
tls-macros.h * elf/tls-macros.h: #include_next <tls-macros.h> to get a sysdeps 2005-03-13 09:09:05 +00:00
tls.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
tst-audit.h Move testsuite audit definitions to sysdeps tst-audit.h files. 2012-07-26 11:29:07 +00:00
tst-stack-align.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
unsecvars.h * malloc/malloc.c (_int_malloc): Remove unused any_larger variable. 2006-10-11 16:29:13 +00:00
unwind-dw2-fde-glibc.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
unwind-dw2-fde.c Move bits/libc-lock.h and bits/libc-lockP.h out of bits/ (bug 14912). 2015-09-08 21:11:03 +00:00
unwind-dw2-fde.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
unwind-dw2.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
unwind-pe.c Update. 2004-03-10 10:04:19 +00:00
unwind-pe.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
unwind-resume.h ARM: Consolidate with generic unwinder wrapper code 2015-01-05 15:42:16 -08:00
unwind.h Adjust _Unwind_Word in unwind.h to version in libgcc. 2015-08-26 10:26:26 +02:00
utmp-equal.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00