glibc/sysdeps/ieee754/float128
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
..
e_acosf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
e_acoshf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
e_asinf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
e_atan2f128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
e_atanhf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
e_coshf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
e_exp10f128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
e_expf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
e_fmodf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
e_gammaf128_r.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
e_hypotf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
e_ilogbf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
e_j0f128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
e_j1f128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
e_jnf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
e_lgammaf128_r.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
e_log2f128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
e_log10f128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
e_logf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
e_powf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
e_rem_pio2f128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
e_remainderf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
e_scalbf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
e_sinhf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
float128_private.h Fix float128_private.h redefinition of SET_RESTORE_ROUNDL. 2017-06-22 22:57:28 +00:00
float1282mpn.c float128: Add conversion from float128 to mpn 2017-06-07 17:03:43 -03:00
gamma_productf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
ieee754_float128.h float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
k_cosf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
k_sincosf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
k_sinf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
k_tanf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
lgamma_negf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
lgamma_productf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
Makeconfig
Makefile Add libio-mtsafe flags to the build of strfromf128 2017-06-23 10:31:49 -03:00
mpn2float128.c float128: Add strtof128, wcstof128, and related functions. 2017-06-12 14:48:53 -03:00
s_asinhf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
s_atanf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
s_cbrtf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
s_ceilf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
s_copysignf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
s_cosf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
s_erff128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
s_expm1f128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
s_fabsf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
s_finitef128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
s_floorf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
s_fmaf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
s_fpclassifyf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
s_frexpf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
s_fromfpf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
s_fromfpxf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
s_getpayloadf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
s_isinff128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
s_isnanf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
s_issignalingf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
s_llrintf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
s_llroundf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
s_log1pf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
s_logbf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
s_lrintf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
s_lroundf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
s_modff128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
s_nearbyintf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
s_nextafterf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
s_nexttowardf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
s_nextupf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
s_remquof128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
s_rintf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
s_roundevenf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
s_roundf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
s_scalblnf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
s_scalbnf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
s_setpayloadf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
s_setpayloadsigf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
s_signbitf128.c float128: Add signbit alternative for old compilers 2017-06-30 18:34:29 -03:00
s_significandf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
s_sincosf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
s_sinf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
s_tanf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
s_tanhf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
s_totalorderf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
s_totalordermagf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
s_truncf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
s_ufromfpf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
s_ufromfpxf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
strfromf128.c float128: Add strfromf128 2017-06-07 17:08:21 -03:00
strtod_nan_float128.h float128: Add strtof128, wcstof128, and related functions. 2017-06-12 14:48:53 -03:00
strtof128_l.c Fix float128 uses of xlocale.h. 2017-06-22 22:34:49 +00:00
strtof128_nan.c float128: Add strtof128, wcstof128, and related functions. 2017-06-12 14:48:53 -03:00
strtof128.c float128: Add strtof128, wcstof128, and related functions. 2017-06-12 14:48:53 -03:00
t_sincosf128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00
Versions float128: Add strtof128, wcstof128, and related functions. 2017-06-12 14:48:53 -03:00
wcstof128_l.c Fix float128 uses of xlocale.h. 2017-06-22 22:34:49 +00:00
wcstof128_nan.c float128: Add strtof128, wcstof128, and related functions. 2017-06-12 14:48:53 -03:00
wcstof128.c Fix float128 uses of xlocale.h. 2017-06-22 22:34:49 +00:00
x2y2m1f128.c float128: Add wrappers to override ldbl-128 as float128. 2017-05-25 09:01:37 -03:00