Move float128 inlines from sysdeps/generic/math_private.h to include/math.h.
Continuing the cleanup of math_private.h, with a view to it becoming the header for the APIs defined therein and not also a header with inline variants of math.h APIs, this patch moves inline definitions of __isinff128 and fabsf128 to include/math.h, so that any users of math.h in glibc automatically get the optimized functions rather than quietly missing them if they do not also include math_private.h. Tested for x86_64 and x86, and with build-many-glibcs.py with GCC 6. There are changes to installed stripped libc.so on configurations with distinct _Float128, because of __printf_fp_l code that now gets the __isinff128 inline where previously it called the out-of-line function because of the lack of a math_private.h call. It seems appropriate that this code does get the inline (as it would automatically with GCC 7 and later when the built-in function is used) rather than being the only place in glibc that does not. * sysdeps/generic/math_private.h [__HAVE_DISTINCT_FLOAT128 && !__GNUC_PREREQ (7, 0)] (__isinff128): Move this inline function .... [__HAVE_DISTINCT_FLOAT128] (fabsf128): And this one .... * include/math.h [!_ISOMAC]: To here....
This commit is contained in:
parent
418d99e622
commit
b9d8c47472
|
@ -1,3 +1,11 @@
|
|||
2018-09-05 Joseph Myers <joseph@codesourcery.com>
|
||||
|
||||
* sysdeps/generic/math_private.h
|
||||
[__HAVE_DISTINCT_FLOAT128 && !__GNUC_PREREQ (7, 0)] (__isinff128):
|
||||
Move this inline function ....
|
||||
[__HAVE_DISTINCT_FLOAT128] (fabsf128): And this one ....
|
||||
* include/math.h [!_ISOMAC]: To here....
|
||||
|
||||
2018-09-04 Joseph Myers <joseph@codesourcery.com>
|
||||
|
||||
* sysdeps/generic/fenv_private.h [FE_ALL_EXCEPT == 0]: Move this
|
||||
|
|
|
@ -54,6 +54,29 @@ libm_hidden_proto (__expf128)
|
|||
libm_hidden_proto (__expm1f128)
|
||||
# endif
|
||||
|
||||
# if __HAVE_DISTINCT_FLOAT128
|
||||
|
||||
/* __builtin_isinf_sign is broken in GCC < 7 for float128. */
|
||||
# if ! __GNUC_PREREQ (7, 0)
|
||||
# include <ieee754_float128.h>
|
||||
extern inline int
|
||||
__isinff128 (_Float128 x)
|
||||
{
|
||||
int64_t hx, lx;
|
||||
GET_FLOAT128_WORDS64 (hx, lx, x);
|
||||
lx |= (hx & 0x7fffffffffffffffLL) ^ 0x7fff000000000000LL;
|
||||
lx |= -lx;
|
||||
return ~(lx >> 63) & (hx >> 62);
|
||||
}
|
||||
# endif
|
||||
|
||||
extern inline _Float128
|
||||
fabsf128 (_Float128 x)
|
||||
{
|
||||
return __builtin_fabsf128 (x);
|
||||
}
|
||||
# endif
|
||||
|
||||
# if !(defined __FINITE_MATH_ONLY__ && __FINITE_MATH_ONLY__ > 0)
|
||||
# ifndef NO_MATH_REDIRECT
|
||||
/* Declare sqrt for use within GLIBC. Compilers typically inline sqrt as a
|
||||
|
|
|
@ -222,29 +222,6 @@ do { \
|
|||
# undef _Mdouble_
|
||||
#endif
|
||||
|
||||
#if __HAVE_DISTINCT_FLOAT128
|
||||
|
||||
/* __builtin_isinf_sign is broken in GCC < 7 for float128. */
|
||||
# if ! __GNUC_PREREQ (7, 0)
|
||||
# include <ieee754_float128.h>
|
||||
extern inline int
|
||||
__isinff128 (_Float128 x)
|
||||
{
|
||||
int64_t hx, lx;
|
||||
GET_FLOAT128_WORDS64 (hx, lx, x);
|
||||
lx |= (hx & 0x7fffffffffffffffLL) ^ 0x7fff000000000000LL;
|
||||
lx |= -lx;
|
||||
return ~(lx >> 63) & (hx >> 62);
|
||||
}
|
||||
# endif
|
||||
|
||||
extern inline _Float128
|
||||
fabsf128 (_Float128 x)
|
||||
{
|
||||
return __builtin_fabsf128 (x);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* Prototypes for functions of the IBM Accurate Mathematical Library. */
|
||||
|
|
Loading…
Reference in New Issue