glibc/sysdeps/ieee754
Gabriel F. T. Gomes 8466ee1cb7 float128: Add signbit alternative for old compilers
In math/math.h, __MATH_TG will expand signbit to __builtin_signbit*,
e.g.: __builtin_signbitf128, before GCC 6.  However, there has never
been a __builtin_signbitf128 in GCC and the type-generic builtin is
only available since GCC 6.  For older GCC, this patch defines
__builtin_signbitf128 to __signbitf128, so that the internal function
is used instead of the non-existent builtin.

This patch also changes the implementation of __signbitf128, because
it was reusing the implementation of __signbitl from ldbl-128, which
calls __builtin_signbitl.  Using the long double version of the
builtin is not correct on machines where _Float128 is ABI-distinct
from long double (i.e.: ia64, powerpc64le, x86, x86_84).  The new
implementation does not rely on builtins when being built with GCC
versions older than 6.0.

The new code does not currently affect powerpc64le builds, because
only GCC 6.2 fulfills the requirements from configure.  It might
affect powerpc64le builds if those requirements are backported to
older versions of the compiler.  The new code affects x86_64 builds,
since glibc is supposed to build correctly with older versions of GCC.

Tested for powerpc64le and x86_64.

	* include/math.h (__signbitf128): Define as hidden.
	* sysdeps/ieee754/float128/s_signbitf128.c (__signbitf128):
	Reimplement without builtins.
	* sysdeps/ia64/bits/floatn.h [!__GNUC_PREREQ (6, 0)]
	(__builtin_signbitf128): Define to __signbitf128.
	* sysdeps/powerpc/bits/floatn.h: Likewise.
	* sysdeps/x86/bits/floatn.h: Likewise.
2017-06-30 18:34:29 -03:00
..
bits Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
dbl-64 Narrowing the visibility of libc-internal.h even further. 2017-03-01 20:33:46 -05:00
float128 float128: Add signbit alternative for old compilers 2017-06-30 18:34:29 -03:00
flt-32 Optimized version of powf() 2017-06-23 09:19:17 -03:00
ldbl-64-128 Use locale_t, not __locale_t, throughout glibc 2017-06-20 20:30:06 -04:00
ldbl-96 Support _Float128 in ldbl-96 bits/iscanonical.h. 2017-06-22 23:06:41 +00:00
ldbl-128 Refactor PRINT_FPHEX_LONG_DOUBLE into a reusable macro 2017-06-07 17:06:31 -03:00
ldbl-128ibm Use locale_t, not __locale_t, throughout glibc 2017-06-20 20:30:06 -04:00
ldbl-opt Use locale_t, not __locale_t, throughout glibc 2017-06-20 20:30:06 -04:00
ieee754.h Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
k_standard.c Fix pow (qNaN, 0) result with -lieee (bug 20919), remove dead parts of wrappers. 2016-12-02 22:50:46 +00:00
k_standardf.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
k_standardl.c Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
Makefile Avoid -Wno-write-strings for k_standard.c. 2015-02-26 22:50:54 +00:00
s_lib_version.c Remove trailing whitespace. 2013-06-05 20:44:03 +00:00
s_matherr.c Use <> for math.h and math_private.h everywhere. 2012-03-09 16:09:10 -08:00
s_signgam.c Fix lgamma setting signgam for ISO C (bug 15421). 2015-11-20 22:49:59 +00:00