glibc/sysdeps/ieee754/dbl-64
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
..
wordsize-64 Use floor functions not __floor functions in glibc libm. 2018-09-14 13:09:01 +00:00
asincos.tbl Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
atnat2.h Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
atnat.h Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
branred.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
branred.h Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
dbl2mpn.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
dla.h Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
doasin.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
doasin.h Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
dosincos.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
dosincos.h Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
e_acos.c Update. 2001-03-12 00:04:52 +00:00
e_acosh.c Rename all __ieee754_sqrt(f/l) calls to sqrt(f/l) 2018-03-15 19:21:36 +00:00
e_asin.c Move math_check_force_underflow macros to separate math-underflow.h. 2018-05-10 00:53:04 +00:00
e_atan2.c Do not include fenv_private.h in math_private.h. 2018-09-03 21:09:04 +00:00
e_atanh.c Do not include math-barriers.h in math_private.h. 2018-05-11 15:11:38 +00:00
e_cosh.c Move math_narrow_eval to separate math-narrow-eval.h. 2018-05-09 00:15:10 +00:00
e_exp2.c Add new exp and exp2 implementations 2018-09-05 16:22:00 +01:00
e_exp10.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
e_exp_data.c Add new exp and exp2 implementations 2018-09-05 16:22:00 +01:00
e_exp.c Add new exp and exp2 implementations 2018-09-05 16:22:00 +01:00
e_fmod.c Consistently use uintN_t not u_intN_t in libm. 2017-08-03 19:55:04 +00:00
e_gamma_r.c Do not include fenv_private.h in math_private.h. 2018-09-03 21:09:04 +00:00
e_hypot.c Move math_check_force_underflow macros to separate math-underflow.h. 2018-05-10 00:53:04 +00:00
e_ilogb.c Format floating routines. 2013-10-17 16:03:24 +02:00
e_j0.c Do not include math-barriers.h in math_private.h. 2018-05-11 15:11:38 +00:00
e_j1.c Move math_check_force_underflow macros to separate math-underflow.h. 2018-05-10 00:53:04 +00:00
e_jn.c Do not include fenv_private.h in math_private.h. 2018-09-03 21:09:04 +00:00
e_lgamma_r.c Use floor functions not __floor functions in glibc libm. 2018-09-14 13:09:01 +00:00
e_log2_data.c Add new log2 implementation 2018-09-12 17:36:33 +01:00
e_log2.c Add new log2 implementation 2018-09-12 17:36:33 +01:00
e_log10.c Use fabs(f/l) rather than __fabs 2017-09-29 18:54:24 +01:00
e_log_data.c Add new log implementation 2018-09-12 17:33:30 +01:00
e_log.c Add new log implementation 2018-09-12 17:33:30 +01:00
e_pow.c Add new exp and exp2 implementations 2018-09-05 16:22:00 +01:00
e_remainder.c Do not include fenv_private.h in math_private.h. 2018-09-03 21:09:04 +00:00
e_sinh.c Move math_check_force_underflow macros to separate math-underflow.h. 2018-05-10 00:53:04 +00:00
e_sqrt.c Do not include fenv_private.h in math_private.h. 2018-09-03 21:09:04 +00:00
gamma_product.c Do not include fenv_private.h in math_private.h. 2018-09-03 21:09:04 +00:00
gamma_productf.c Move math_narrow_eval to separate math-narrow-eval.h. 2018-05-09 00:15:10 +00:00
k_rem_pio2.c Use floor functions not __floor functions in glibc libm. 2018-09-14 13:09:01 +00:00
k_tan.c Replace sysdeps/ieee754/dbl-64/k_tan.c with empty file 2012-02-26 16:10:46 +01:00
lgamma_neg.c Use floor functions not __floor functions in glibc libm. 2018-09-14 13:09:01 +00:00
lgamma_product.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
Makefile Fix CFLAGS override in sysdeps/ieee754/dbl-64 2017-08-24 15:56:11 +01:00
math_config.h Add new log2 implementation 2018-09-12 17:36:33 +01:00
math_err.c Add new exp and exp2 implementations 2018-09-05 16:22:00 +01:00
MathLib.h Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
mpa-arch.h Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
mpa.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
mpa.h Remove mplog and mpexp 2018-02-15 12:41:05 +00:00
mpatan2.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
mpatan.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
mpatan.h Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
mpn2dbl.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
mpsqrt.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
mpsqrt.h Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
mptan.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
mydefs.h Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
powtwo.tbl Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
root.tbl Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
s_asinh.c Move math_check_force_underflow macros to separate math-underflow.h. 2018-05-10 00:53:04 +00:00
s_atan.c Do not include fenv_private.h in math_private.h. 2018-09-03 21:09:04 +00:00
s_cbrt.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
s_ceil.c Use libm_alias_double for more dbl-64 functions. 2017-10-03 17:47:35 +00:00
s_copysign.c Use libm_alias_double for some dbl-64 functions. 2017-09-29 23:54:33 +00:00
s_cos.c Update. 2001-03-12 00:04:52 +00:00
s_erf.c Move math_check_force_underflow macros to separate math-underflow.h. 2018-05-10 00:53:04 +00:00
s_expm1.c Do not include math-barriers.h in math_private.h. 2018-05-11 15:11:38 +00:00
s_f32xaddf64.c Add narrowing add functions. 2018-02-10 02:08:43 +00:00
s_f32xdivf64.c Add narrowing divide functions. 2018-05-17 00:40:52 +00:00
s_f32xmulf64.c Add narrowing multiply functions. 2018-05-16 00:05:28 +00:00
s_f32xsubf64.c Add narrowing subtract functions. 2018-03-20 00:34:52 +00:00
s_fabs.c Use libm_alias_double for some dbl-64 functions. 2017-09-29 23:54:33 +00:00
s_fadd.c Add narrowing add functions. 2018-02-10 02:08:43 +00:00
s_fdiv.c Add narrowing divide functions. 2018-05-17 00:40:52 +00:00
s_finite.c Move LDBL_CLASSIFY_COMPAT to its own header. 2018-02-01 21:01:00 +00:00
s_floor.c Use floor functions not __floor functions in glibc libm. 2018-09-14 13:09:01 +00:00
s_fma.c Do not include fenv_private.h in math_private.h. 2018-09-03 21:09:04 +00:00
s_fmaf.c Do not include fenv_private.h in math_private.h. 2018-09-03 21:09:04 +00:00
s_fmul.c Add narrowing multiply functions. 2018-05-16 00:05:28 +00:00
s_fpclassify.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
s_frexp.c Use libm_alias_double for dbl-64 frexp. 2017-10-03 20:56:46 +00:00
s_fromfp_main.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
s_fromfp.c Use libm_alias_double for some dbl-64 functions. 2017-09-29 23:54:33 +00:00
s_fromfpx.c Use libm_alias_double for some dbl-64 functions. 2017-09-29 23:54:33 +00:00
s_fsub.c Add narrowing subtract functions. 2018-03-20 00:34:52 +00:00
s_getpayload.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
s_isinf.c Move LDBL_CLASSIFY_COMPAT to its own header. 2018-02-01 21:01:00 +00:00
s_isnan.c Move LDBL_CLASSIFY_COMPAT to its own header. 2018-02-01 21:01:00 +00:00
s_issignaling.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
s_llrint.c Move fenv.h soft-float inlines from fenv_private.h to include/fenv.h. 2018-09-04 19:52:06 +00:00
s_llround.c Move fenv.h soft-float inlines from fenv_private.h to include/fenv.h. 2018-09-04 19:52:06 +00:00
s_log1p.c Do not include math-barriers.h in math_private.h. 2018-05-11 15:11:38 +00:00
s_logb.c Use libm_alias_double for dbl-64 logb. 2017-10-03 23:44:41 +00:00
s_lrint.c Move fenv.h soft-float inlines from fenv_private.h to include/fenv.h. 2018-09-04 19:52:06 +00:00
s_lround.c Move fenv.h soft-float inlines from fenv_private.h to include/fenv.h. 2018-09-04 19:52:06 +00:00
s_modf.c Use libm_alias_double for dbl-64 modf. 2017-10-03 23:46:23 +00:00
s_nearbyint.c Do not include fenv_private.h in math_private.h. 2018-09-03 21:09:04 +00:00
s_nexttoward.c Update. 1999-07-14 00:54:57 +00:00
s_nextup.c Move math_check_force_underflow macros to separate math-underflow.h. 2018-05-10 00:53:04 +00:00
s_remquo.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
s_rint.c Use libm_alias_double for more dbl-64 functions. 2017-10-03 17:47:35 +00:00
s_round.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
s_roundeven.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
s_scalbln.c [BZ #6803] Set errno for scalbln, scalbn 2014-06-20 07:48:20 +05:30
s_scalbn.c Make scalbn set errno (bug 6803). 2015-09-16 21:11:00 +00:00
s_setpayload_main.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
s_setpayload.c Use libm_alias_double for some dbl-64 functions. 2017-09-29 23:54:33 +00:00
s_setpayloadsig.c Use libm_alias_double for some dbl-64 functions. 2017-09-29 23:54:33 +00:00
s_signbit.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
s_sin.c Do not include fenv_private.h in math_private.h. 2018-09-03 21:09:04 +00:00
s_sincos.c Do not include fenv_private.h in math_private.h. 2018-09-03 21:09:04 +00:00
s_tan.c Do not include fenv_private.h in math_private.h. 2018-09-03 21:09:04 +00:00
s_tanh.c Move math_check_force_underflow macros to separate math-underflow.h. 2018-05-10 00:53:04 +00:00
s_totalorder.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
s_totalordermag.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
s_trunc.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
s_ufromfp.c Use libm_alias_double for some dbl-64 functions. 2017-09-29 23:54:33 +00:00
s_ufromfpx.c Use libm_alias_double for some dbl-64 functions. 2017-09-29 23:54:33 +00:00
sincos32.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
sincos32.h Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
sincostab.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
uasncs.h Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
uatan.tbl Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
upow.h Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
upow.tbl Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
urem.h Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
usncs.h Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
utan.h Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
utan.tbl Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
x2y2m1.c Do not include fenv_private.h in math_private.h. 2018-09-03 21:09:04 +00:00
x2y2m1f.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00