glibc/sysdeps/ieee754/ldbl-128ibm
Joseph Myers e44acb2063 Use floor functions not __floor functions in glibc libm.
Similar to the changes that were made to call sqrt functions directly
in glibc, instead of __ieee754_sqrt variants, so that the compiler
could inline them automatically without needing special inline
definitions in lots of math_private.h headers, this patch makes libm
code call floor functions directly instead of __floor variants,
removing the inlines / macros for x86_64 (SSE4.1) and powerpc
(POWER5).

The redirection used to ensure that __ieee754_sqrt does still get
called when the compiler doesn't inline a built-in function expansion
is refactored so it can be applied to other functions; the refactoring
is arranged so it's not limited to unary functions either (it would be
reasonable to use this mechanism for copysign - removing the inline in
math_private_calls.h but also eliminating unnecessary local PLT entry
use in the cases (powerpc soft-float and e500v1, for IBM long double)
where copysign calls don't get inlined).

The point of this change is that more architectures can get floor
calls inlined where they weren't previously (AArch64, for example),
without needing special inline definitions in their math_private.h,
and existing such definitions in math_private.h headers can be
removed.

Note that it's possible that in some cases an inline may be used where
an IFUNC call was previously used - this is the case on x86_64, for
example.  I think the direct calls to floor are still appropriate; if
there's any significant performance cost from inline SSE2 floor
instead of an IFUNC call ending up with SSE4.1 floor, that indicates
that either the function should be doing something else that's faster
than using floor at all, or it should itself have IFUNC variants, or
that the compiler choice of inlining for generic tuning should change
to allow for the possibility that, by not inlining, an SSE4.1 IFUNC
might be called at runtime - but not that glibc should avoid calling
floor internally.  (After all, all the same considerations would apply
to any user program calling floor, where it might either be inlined or
left as an out-of-line call allowing for a possible IFUNC.)

Tested for x86_64, and with build-many-glibcs.py.

	* include/math.h [!_ISOMAC && !(__FINITE_MATH_ONLY__ &&
	__FINITE_MATH_ONLY__ > 0) && !NO_MATH_REDIRECT] (MATH_REDIRECT):
	New macro.
	[!_ISOMAC && !(__FINITE_MATH_ONLY__ && __FINITE_MATH_ONLY__ > 0)
	&& !NO_MATH_REDIRECT] (MATH_REDIRECT_LDBL): Likewise.
	[!_ISOMAC && !(__FINITE_MATH_ONLY__ && __FINITE_MATH_ONLY__ > 0)
	&& !NO_MATH_REDIRECT] (MATH_REDIRECT_F128): Likewise.
	[!_ISOMAC && !(__FINITE_MATH_ONLY__ && __FINITE_MATH_ONLY__ > 0)
	&& !NO_MATH_REDIRECT] (MATH_REDIRECT_UNARY_ARGS): Likewise.
	[!_ISOMAC && !(__FINITE_MATH_ONLY__ && __FINITE_MATH_ONLY__ > 0)
	&& !NO_MATH_REDIRECT] (sqrt): Redirect using MATH_REDIRECT.
	[!_ISOMAC && !(__FINITE_MATH_ONLY__ && __FINITE_MATH_ONLY__ > 0)
	&& !NO_MATH_REDIRECT] (floor): Likewise.
	* sysdeps/aarch64/fpu/s_floor.c: Define NO_MATH_REDIRECT before
	header inclusion.
	* sysdeps/aarch64/fpu/s_floorf.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_floor.c: Likewise.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_floor.c: Likewise.
	* sysdeps/ieee754/float128/s_floorf128.c: Likewise.
	* sysdeps/ieee754/flt-32/s_floorf.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_floorl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_floorl.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_floor_template.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floor.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floorf.c: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_floor.c: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_floorf.c: Likewise.
	* sysdeps/riscv/rv64/rvd/s_floor.c: Likewise.
	* sysdeps/riscv/rvf/s_floorf.c: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_floor.c: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_floorf.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/s_floor.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/s_floorf.c: Likewise.
	* sysdeps/powerpc/fpu/math_private.h [_ARCH_PWR5X] (__floor):
	Remove macro.
	[_ARCH_PWR5X] (__floorf): Likewise.
	* sysdeps/x86_64/fpu/math_private.h [__SSE4_1__] (__floor): Remove
	inline function.
	[__SSE4_1__] (__floorf): Likewise.
	* math/w_lgamma_main.c (LGFUNC (__lgamma)): Use floor functions
	instead of __floor variants.
	* math/w_lgamma_r_compat.c (__lgamma_r): Likewise.
	* math/w_lgammaf_main.c (LGFUNC (__lgammaf)): Likewise.
	* math/w_lgammaf_r_compat.c (__lgammaf_r): Likewise.
	* math/w_lgammal_main.c (LGFUNC (__lgammal)): Likewise.
	* math/w_lgammal_r_compat.c (__lgammal_r): Likewise.
	* math/w_tgamma_compat.c (__tgamma): Likewise.
	* math/w_tgamma_template.c (M_DECL_FUNC (__tgamma)): Likewise.
	* math/w_tgammaf_compat.c (__tgammaf): Likewise.
	* math/w_tgammal_compat.c (__tgammal): Likewise.
	* sysdeps/ieee754/dbl-64/e_lgamma_r.c (sin_pi): Likewise.
	* sysdeps/ieee754/dbl-64/k_rem_pio2.c (__kernel_rem_pio2):
	Likewise.
	* sysdeps/ieee754/dbl-64/lgamma_neg.c (__lgamma_neg): Likewise.
	* sysdeps/ieee754/flt-32/e_lgammaf_r.c (sin_pif): Likewise.
	* sysdeps/ieee754/flt-32/lgamma_negf.c (__lgamma_negf): Likewise.
	* sysdeps/ieee754/ldbl-128/e_lgammal_r.c (__ieee754_lgammal_r):
	Likewise.
	* sysdeps/ieee754/ldbl-128/e_powl.c (__ieee754_powl): Likewise.
	* sysdeps/ieee754/ldbl-128/lgamma_negl.c (__lgamma_negl):
	Likewise.
	* sysdeps/ieee754/ldbl-128/s_expm1l.c (__expm1l): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_lgammal_r.c (__ieee754_lgammal_r):
	Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_powl.c (__ieee754_powl): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/lgamma_negl.c (__lgamma_negl):
	Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_expm1l.c (__expm1l): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_truncl.c (__truncl): Likewise.
	* sysdeps/ieee754/ldbl-96/e_lgammal_r.c (sin_pi): Likewise.
	* sysdeps/ieee754/ldbl-96/lgamma_negl.c (__lgamma_negl): Likewise.
	* sysdeps/powerpc/power5+/fpu/s_modf.c (__modf): Likewise.
	* sysdeps/powerpc/power5+/fpu/s_modff.c (__modff): Likewise.
2018-09-14 13:09:01 +00:00
..
bits Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
include/bits Add canonicalize, canonicalizef, canonicalizel. 2016-10-26 23:14:31 +00:00
e_acoshl.c Rename all __ieee754_sqrt(f/l) calls to sqrt(f/l) 2018-03-15 19:21:36 +00:00
e_acosl.c Rename all __ieee754_sqrt(f/l) calls to sqrt(f/l) 2018-03-15 19:21:36 +00:00
e_asinl.c Do not include math-barriers.h in math_private.h. 2018-05-11 15:11:38 +00:00
e_atan2l.c PowerPC floating point little-endian [3 of 15] 2013-10-04 10:32:36 +09:30
e_atanhl.c Move math_check_force_underflow macros to separate math-underflow.h. 2018-05-10 00:53:04 +00:00
e_coshl.c Fix cosh spurious underflows from expm1 (bug 16354), inaccurate results near 0 (bug 17061). 2014-06-23 20:20:10 +00:00
e_exp10l.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
e_expl.c Do not include fenv_private.h in math_private.h. 2018-09-03 21:09:04 +00:00
e_fmodl.c Consistently use uintN_t not u_intN_t in libm. 2017-08-03 19:55:04 +00:00
e_gammal_r.c Do not include fenv_private.h in math_private.h. 2018-09-03 21:09:04 +00:00
e_hypotl.c Move math_check_force_underflow macros to separate math-underflow.h. 2018-05-10 00:53:04 +00:00
e_ilogbl.c Fix ldbl-128ibm ilogbl near powers of 2 (bug 18029). 2015-02-26 12:57:21 +00:00
e_j0l.c Rename all __ieee754_sqrt(f/l) calls to sqrt(f/l) 2018-03-15 19:21:36 +00:00
e_j1l.c Do not include fenv_private.h in math_private.h. 2018-09-03 21:09:04 +00:00
e_jnl.c Do not include fenv_private.h in math_private.h. 2018-09-03 21:09:04 +00:00
e_lgammal_r.c Use floor functions not __floor functions in glibc libm. 2018-09-14 13:09:01 +00:00
e_log2l.c Use fabs(f/l) rather than __fabs 2017-09-29 18:54:24 +01:00
e_log10l.c Use fabs(f/l) rather than __fabs 2017-09-29 18:54:24 +01:00
e_logl.c Remove unneeded declarations from math_private.h 2017-04-10 12:20:47 -03:00
e_powl.c Use floor functions not __floor functions in glibc libm. 2018-09-14 13:09:01 +00:00
e_rem_pio2l.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
e_remainderl.c Consistently use uintN_t not u_intN_t in libm. 2017-08-03 19:55:04 +00:00
e_sinhl.c Move math_check_force_underflow macros to separate math-underflow.h. 2018-05-10 00:53:04 +00:00
e_sqrtl.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
gamma_productl.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
ieee754.h Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
k_cosl.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
k_sincosl.c Move math_check_force_underflow macros to separate math-underflow.h. 2018-05-10 00:53:04 +00:00
k_sinl.c Move math_check_force_underflow macros to separate math-underflow.h. 2018-05-10 00:53:04 +00:00
k_tanl.c Move math_check_force_underflow macros to separate math-underflow.h. 2018-05-10 00:53:04 +00:00
ldbl2mpn.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
lgamma_negl.c Use floor functions not __floor functions in glibc libm. 2018-09-14 13:09:01 +00:00
lgamma_productl.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
Makefile Add canonicalize, canonicalizef, canonicalizel. 2016-10-26 23:14:31 +00:00
math-nan-payload-ldouble.h math: Merge strtod_nan_*.h into math-type-macros-*.h 2018-05-16 06:03:08 +02:00
math_ldbl.h Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
mpn2ldbl.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
printf_fphex.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
s_asinhl.c Move math_check_force_underflow macros to separate math-underflow.h. 2018-05-10 00:53:04 +00:00
s_atanl.c Move math_check_force_underflow macros to separate math-underflow.h. 2018-05-10 00:53:04 +00:00
s_cbrtl.c ldbl-128ibm: Automatic replacing of _Float128 and L() 2017-09-21 17:37:39 -03:00
s_ceill.c Don't include math.h/math_private.h in math_ldbl_opt.h. 2018-03-10 15:18:08 -05:00
s_copysignl.c Remove IS_IN_libm 2014-11-24 11:41:47 +05:30
s_cosl.c PowerPC floating point little-endian [2 of 15] 2013-10-04 10:32:19 +09:30
s_daddl.c Add narrowing add functions. 2018-02-10 02:08:43 +00:00
s_ddivl.c Add narrowing divide functions. 2018-05-17 00:40:52 +00:00
s_dmull.c Add narrowing multiply functions. 2018-05-16 00:05:28 +00:00
s_dsubl.c Add narrowing subtract functions. 2018-03-20 00:34:52 +00:00
s_erfl.c Move math_check_force_underflow macros to separate math-underflow.h. 2018-05-10 00:53:04 +00:00
s_expm1l.c Use floor functions not __floor functions in glibc libm. 2018-09-14 13:09:01 +00:00
s_fabsl.c Consistently use uintN_t not u_intN_t in libm. 2017-08-03 19:55:04 +00:00
s_faddl.c Add narrowing add functions. 2018-02-10 02:08:43 +00:00
s_fdivl.c Add narrowing divide functions. 2018-05-17 00:40:52 +00:00
s_finitel.c Reduce number of constants in __finite* (bug 15384). 2015-09-17 16:47:14 +00:00
s_floorl.c Use floor functions not __floor functions in glibc libm. 2018-09-14 13:09:01 +00:00
s_fmal.c Do not include fenv_private.h in math_private.h. 2018-09-03 21:09:04 +00:00
s_fmull.c Add narrowing multiply functions. 2018-05-16 00:05:28 +00:00
s_fpclassifyl.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
s_frexpl.c Fix frexp (NaN) (bug 20250). 2016-06-13 17:27:19 +00:00
s_fromfpl.c Make more libm functions into weak aliases. 2017-09-14 22:28:53 +00:00
s_fromfpl_main.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
s_fromfpxl.c Make more libm functions into weak aliases. 2017-09-14 22:28:53 +00:00
s_fsubl.c Add narrowing subtract functions. 2018-03-20 00:34:52 +00:00
s_getpayloadl.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
s_iscanonicall.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
s_isinfl.c Remove IS_IN_libm 2014-11-24 11:41:47 +05:30
s_isnanl.c Remove IS_IN_libm 2014-11-24 11:41:47 +05:30
s_issignalingl.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
s_llrintl.c Move fenv.h soft-float inlines from fenv_private.h to include/fenv.h. 2018-09-04 19:52:06 +00:00
s_llroundl.c Move fenv.h soft-float inlines from fenv_private.h to include/fenv.h. 2018-09-04 19:52:06 +00:00
s_log1pl.c Fix ldbl-128ibm log1pl (-qNaN) spurious "invalid" exception (bug 22693). 2018-01-10 17:59:01 +00:00
s_logbl.c Work around powerpc32 integer 0 converting to -0 (bug 887, bug 19049, bug 19050). 2015-10-05 17:46:50 +00:00
s_lrintl.c Move fenv.h soft-float inlines from fenv_private.h to include/fenv.h. 2018-09-04 19:52:06 +00:00
s_lroundl.c Move fenv.h soft-float inlines from fenv_private.h to include/fenv.h. 2018-09-04 19:52:06 +00:00
s_modfl.c Consistently use uintN_t not u_intN_t in libm. 2017-08-03 19:55:04 +00:00
s_nearbyintl.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
s_nextafterl.c Do not include math-barriers.h in math_private.h. 2018-05-11 15:11:38 +00:00
s_nexttoward.c Do not include math-barriers.h in math_private.h. 2018-05-11 15:11:38 +00:00
s_nexttowardf.c Do not include math-barriers.h in math_private.h. 2018-05-11 15:11:38 +00:00
s_nextupl.c Move math_check_force_underflow macros to separate math-underflow.h. 2018-05-10 00:53:04 +00:00
s_remquol.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
s_rintl.c Do not include fenv_private.h in math_private.h. 2018-09-03 21:09:04 +00:00
s_roundevenl.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
s_roundl.c Don't include math.h/math_private.h in math_ldbl_opt.h. 2018-03-10 15:18:08 -05:00
s_scalblnl.c [BZ #6803] Set errno for scalbln, scalbn 2014-06-20 07:48:20 +05:30
s_scalbnl.c Make scalbn set errno (bug 6803). 2015-09-16 21:11:00 +00:00
s_setpayloadl.c Make more libm functions into weak aliases. 2017-09-14 22:28:53 +00:00
s_setpayloadl_main.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
s_setpayloadsigl.c Make more libm functions into weak aliases. 2017-09-14 22:28:53 +00:00
s_signbitl.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
s_sincosl.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
s_sinl.c PowerPC floating point little-endian [2 of 15] 2013-10-04 10:32:19 +09:30
s_tanhl.c Move math_check_force_underflow macros to separate math-underflow.h. 2018-05-10 00:53:04 +00:00
s_tanl.c PowerPC floating point little-endian [2 of 15] 2013-10-04 10:32:19 +09:30
s_totalorderl.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
s_totalordermagl.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
s_truncl.c Use floor functions not __floor functions in glibc libm. 2018-09-14 13:09:01 +00:00
s_ufromfpl.c Make more libm functions into weak aliases. 2017-09-14 22:28:53 +00:00
s_ufromfpxl.c Make more libm functions into weak aliases. 2017-09-14 22:28:53 +00:00
strtold_l.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
t_expl.h Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
t_sincosl.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
test-canonical-ldbl-128ibm.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
test-fmodl-ldbl-128ibm.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
test-fmodrem-ldbl-128ibm.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
test-remainderl-ldbl-128ibm.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
test-remquol-ldbl-128ibm.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
test-totalorderl-ldbl-128ibm.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
tst-strtold-ldbl-128ibm.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
x2y2m1l.c Do not include fenv_private.h in math_private.h. 2018-09-03 21:09:04 +00:00