Commit Graph

100 Commits

Author SHA1 Message Date
Joseph Myers 9755bc4686 Use round functions not __round functions in glibc libm.
Continuing the move to use, within libm, public names for libm
functions that can be inlined as built-in functions on many
architectures, this patch moves calls to __round functions to call the
corresponding round names instead, with asm redirection to __round
when the calls are not inlined.

An additional complication arises in
sysdeps/ieee754/ldbl-128ibm/e_expl.c, where a call to roundl, with the
result converted to int, gets converted by the compiler to call
lroundl in the case of 32-bit long, so resulting in localplt test
failures.  It's logically correct to let the compiler make such an
optimization; an appropriate asm redirection of lroundl to __lroundl
is thus added to that file (it's not needed anywhere else).

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

	* include/math.h [!_ISOMAC && !(__FINITE_MATH_ONLY__ &&
	__FINITE_MATH_ONLY__ > 0) && !NO_MATH_REDIRECT] (round): Redirect
	using MATH_REDIRECT.
	* sysdeps/aarch64/fpu/s_round.c: Define NO_MATH_REDIRECT before
	header inclusion.
	* sysdeps/aarch64/fpu/s_roundf.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_round.c: Likewise.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_round.c: Likewise.
	* sysdeps/ieee754/float128/s_roundf128.c: Likewise.
	* sysdeps/ieee754/flt-32/s_roundf.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_roundl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_roundl.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf.c: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_round.c: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_roundf.c: Likewise.
	* sysdeps/riscv/rv64/rvd/s_round.c: Likewise.
	* sysdeps/riscv/rvf/s_roundf.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_roundl.c: Likewise.
	(round): Redirect to __round.
	(__roundl): Call round instead of __round.
	* sysdeps/powerpc/fpu/math_private.h [_ARCH_PWR5X] (__round):
	Remove macro.
	[_ARCH_PWR5X] (__roundf): Likewise.
	* sysdeps/ieee754/dbl-64/e_gamma_r.c (gamma_positive): Use round
	functions instead of __round variants.
	* sysdeps/ieee754/flt-32/e_gammaf_r.c (gammaf_positive): Likewise.
	* sysdeps/ieee754/ldbl-128/e_gammal_r.c (gammal_positive):
	Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c (gammal_positive):
	Likewise.
	* sysdeps/ieee754/ldbl-96/e_gammal_r.c (gammal_positive):
	Likewise.
	* sysdeps/x86/fpu/powl_helper.c (__powl_helper): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_expl.c (lroundl): Redirect to
	__lroundl.
	(__ieee754_expl): Call roundl instead of __roundl.
2018-09-27 12:35:23 +00:00
Joseph Myers 7abf97bed9 Use trunc functions not __trunc functions in glibc libm.
Continuing the move to use, within libm, public names for libm
functions that can be inlined as built-in functions on many
architectures, this patch moves calls to __trunc functions to call the
corresponding trunc names instead, with asm redirection to __trunc
when the calls are not inlined.

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

	* include/math.h [!_ISOMAC && !(__FINITE_MATH_ONLY__ &&
	__FINITE_MATH_ONLY__ > 0) && !NO_MATH_REDIRECT] (trunc): Redirect
	using MATH_REDIRECT.
	* sysdeps/aarch64/fpu/s_trunc.c: Define NO_MATH_REDIRECT before
	header inclusion.
	* sysdeps/aarch64/fpu/s_truncf.c: Likewise.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_trunc.c: Likewise.
	* sysdeps/ieee754/float128/s_truncf128.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_trunc.c: Likewise.
	* sysdeps/ieee754/flt-32/s_truncf.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_truncl.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf.c: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_trunc.c: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_truncf.c: Likewise.
	* sysdeps/riscv/rv64/rvd/s_trunc.c: Likewise.
	* sysdeps/riscv/rvf/s_truncf.c: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_trunc.c: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_truncf.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/s_trunc.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/s_truncf.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_trunc_template.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_truncl.c: Likewise.
	(ceil): Redirect to __ceil.
	(floor): Redirect to __floor.
	(trunc): Redirect to __trunc.
	(__truncl): Call trunc instead of __trunc.
	* sysdeps/powerpc/fpu/math_private.h [_ARCH_PWR5X] (__trunc):
	Remove macro.
	[_ARCH_PWR5X] (__truncf): Likewise.
	* sysdeps/ieee754/dbl-64/e_gamma_r.c (__ieee754_gamma_r): Use
	trunc functions instead of __trunc variants.
	* sysdeps/ieee754/flt-32/e_gammaf_r.c (__ieee754_gammaf_r):
	Likewise.
	* sysdeps/ieee754/ldbl-128/e_gammal_r.c (__ieee754_gammal_r):
	Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c (__ieee754_gammal_r):
	Likewise.
	* sysdeps/ieee754/ldbl-96/e_gammal_r.c (__ieee754_gammal_r):
	Likewise.
2018-09-20 21:11:10 +00:00
Joseph Myers 71223ef909 Use ceil functions not __ceil functions in glibc libm.
Continuing the move to use, within libm, public names for libm
functions that can be inlined as built-in functions on many
architectures, this patch moves calls to __ceil functions to call the
corresponding ceil names instead, with asm redirection to __ceil when
the calls are not inlined.

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

	* include/math.h [!_ISOMAC && !(__FINITE_MATH_ONLY__ &&
	__FINITE_MATH_ONLY__ > 0) && !NO_MATH_REDIRECT] (ceil): Redirect
	using MATH_REDIRECT.
	* sysdeps/aarch64/fpu/s_ceil.c: Define NO_MATH_REDIRECT before
	header inclusion.
	* sysdeps/aarch64/fpu/s_ceilf.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_ceil.c: Likewise.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_ceil.c: Likewise.
	* sysdeps/ieee754/float128/s_ceilf128.c: Likewise.
	* sysdeps/ieee754/flt-32/s_ceilf.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_ceill.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_ceill.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_ceil_template.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf.c: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil.c: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf.c: Likewise.
	* sysdeps/riscv/rv64/rvd/s_ceil.c: Likewise.
	* sysdeps/riscv/rvf/s_ceilf.c: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_ceil.c: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_ceilf.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/s_ceil.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/s_ceilf.c: Likewise.
	* sysdeps/powerpc/fpu/math_private.h [_ARCH_PWR5X] (__ceil):
	Remove macro.
	* sysdeps/ieee754/dbl-64/e_gamma_r.c (gamma_positive): Use ceil
	functions instead of __ceil variants.
	* sysdeps/ieee754/flt-32/e_gammaf_r.c (gammaf_positive): Likewise.
	* sysdeps/ieee754/ldbl-128/e_gammal_r.c (gammal_positive):
	Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c (gammal_positive):
	Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_truncl.c (__truncl): Likewise.
	* sysdeps/ieee754/ldbl-96/e_gammal_r.c (gammal_positive):
	Likewise.
	* sysdeps/powerpc/power5+/fpu/s_modf.c (__modf): Likewise.
	* sysdeps/powerpc/power5+/fpu/s_modff.c (__modff): Likewise.
2018-09-17 20:42:06 +00:00
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
Rajalakshmi Srinivasaraghavan fa78896b1f powerpc: Remove powerpc specific sinf and cosf optimization
New generic optimization of sinf and cosf introduced by commit
599cf39766 shows improvement
compared to powerpc specific assembly version.  Hence removing
the powerpc assembly versions to make use of generic code.
2018-08-20 08:47:43 +05:30
Zack Weinberg 0d13dfa17b Don't include math.h/math_private.h in math_ldbl_opt.h.
The sysdeps/ieee754/ldbl-opt version of math_ldbl_opt.h includes
math.h and math_private.h, despite not having any need for those
headers itself; the sysdeps/generic version doesn't.  About 20 files
are relying on math_ldbl_opt.h to include math.h and/or math_private.h
for them, even though none of them necessarily used on a platform that
needs ldbl-opt support.

	* sysdeps/ieee754/ldbl-opt/math_ldbl_opt.h: Don't include
	math.h or math_private.h.

	* sysdeps/alpha/fpu/s_isnan.c
	* sysdeps/ieee754/ldbl-128ibm/s_ceill.c
	* sysdeps/ieee754/ldbl-128ibm/s_floorl.c
	* sysdeps/ieee754/ldbl-128ibm/s_llrintl.c
	* sysdeps/ieee754/ldbl-128ibm/s_llroundl.c
	* sysdeps/ieee754/ldbl-128ibm/s_lrintl.c
	* sysdeps/ieee754/ldbl-128ibm/s_lroundl.c
	* sysdeps/ieee754/ldbl-128ibm/s_rintl.c
	* sysdeps/ieee754/ldbl-128ibm/s_roundl.c
	* sysdeps/ieee754/ldbl-128ibm/s_truncl.c
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/e_hypot.c
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/e_hypotf.c:
	* sysdeps/powerpc/powerpc64/fpu/multiarch/e_expf.c
	* sysdeps/powerpc/powerpc64/fpu/multiarch/e_hypot.c
	* sysdeps/powerpc/powerpc64/fpu/multiarch/e_hypotf.c:
	Include math_private.h.

	* sysdeps/ieee754/ldbl-64-128/s_finitel.c
	* sysdeps/ieee754/ldbl-64-128/s_fpclassifyl.c
	* sysdeps/ieee754/ldbl-64-128/s_isinfl.c
	* sysdeps/ieee754/ldbl-64-128/s_isnanl.c
	* sysdeps/ieee754/ldbl-64-128/s_signbitl.c
	* sysdeps/powerpc/power7/fpu/s_logb.c:
	Include math.h and math_private.h.
2018-03-10 15:18:08 -05:00
Joseph Myers 688903eb3e Update copyright dates with scripts/update-copyrights.
* All files with FSF copyright notices: Update copyright dates
	using scripts/update-copyrights.
	* locale/programs/charmap-kw.h: Regenerated.
	* locale/programs/locfile-kw.h: Likewise.
2018-01-01 00:32:25 +00:00
Joseph Myers 216933b242 Use libm_alias_float for powerpc.
Continuing the preparation for additional _FloatN / _FloatNx function
aliases, this patch makes powerpc libm function implementations use
libm_alias_float to define function aliases.

Tested with build-many-glibcs.py that installed stripped shared
libraries are unchanged for all its hard-float powerpc configurations.

	* sysdeps/powerpc/fpu/s_cosf.c: Include <libm-alias-float.h>.
	(cosf): Define using libm_alias_float.
	* sysdeps/powerpc/fpu/s_fabs.S: Include <libm-alias-float.h>.
	(fabsf): Define using libm_alias_float.
	* sysdeps/powerpc/fpu/s_fmaf.S: Include <libm-alias-float.h>.
	(fmaf): Define using libm_alias_float.
	* sysdeps/powerpc/fpu/s_rintf.c: Include <libm-alias-float.h>.
	(rintf): Define using libm_alias_float.
	* sysdeps/powerpc/fpu/s_sinf.c: Include <libm-alias-float.h>.
	(sinf): Define using libm_alias_float.
	* sysdeps/powerpc/power5+/fpu/s_modff.c: Include
	<libm-alias-float.h>.
	(modff): Define using libm_alias_float.
	* sysdeps/powerpc/power7/fpu/s_logbf.c: Include
	<libm-alias-float.h>.
	(logbf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/fpu/s_ceilf.S: Include
	<libm-alias-float.h>.
	(ceilf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/fpu/s_copysign.S: Include
	<libm-alias-float.h>.
	(copysignf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/fpu/s_floorf.S: Include
	<libm-alias-float.h>.
	(floorf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/fpu/s_llrintf.c: Include
	<libm-alias-float.h>.
	(llrintf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/fpu/s_llroundf.c: Include
	<libm-alias-float.h>.
	(llroundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/fpu/s_lrint.S: Include
	<libm-alias-float.h>.
	(lrintf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/fpu/s_lround.S: Include
	<libm-alias-float.h>.
	(lroundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/fpu/s_nearbyintf.S: Include
	<libm-alias-float.h>.
	(nearbyintf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/fpu/s_rintf.S: Include
	<libm-alias-float.h>.
	(rintf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/fpu/s_roundf.S: Include
	<libm-alias-float.h>.
	(roundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/fpu/s_truncf.S: Include
	<libm-alias-float.h>.
	(truncf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf.c:
	Include <libm-alias-float.h>.
	(ceilf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysignf.c:
	Include <libm-alias-float.h>.
	(copysignf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floorf.c:
	Include <libm-alias-float.h>.
	(floorf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf.c:
	Include <libm-alias-float.h>.
	(llrintf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llroundf.c:
	Include <libm-alias-float.h>.
	(llroundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logbf.c:
	Include <libm-alias-float.h>.
	(logbf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lrintf.c:
	Include <libm-alias-float.h>.
	(lrintf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lroundf.c:
	Include <libm-alias-float.h>.
	(lroundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_modff.c:
	Include <libm-alias-float.h>.
	(modff): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf.c:
	Include <libm-alias-float.h>.
	(roundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf.c:
	Include <libm-alias-float.h>.
	(truncf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power4/fpu/s_llrintf.S: Include
	<libm-alias-float.h>.
	(llrintf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S: Include
	<libm-alias-float.h>.
	(llroundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power5+/fpu/s_ceilf.S: Include
	<libm-alias-float.h>.
	(ceilf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power5+/fpu/s_floorf.S: Include
	<libm-alias-float.h>.
	(floorf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power5+/fpu/s_llround.S: Include
	<libm-alias-float.h>.
	(llroundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power5+/fpu/s_lround.S: Include
	<libm-alias-float.h>.
	(lroundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power5+/fpu/s_roundf.S: Include
	<libm-alias-float.h>.
	(roundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power5+/fpu/s_truncf.S: Include
	<libm-alias-float.h>.
	(truncf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power6/fpu/s_copysign.S: Include
	<libm-alias-float.h>.
	(copysignf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power6/fpu/s_llrintf.S: Include
	<libm-alias-float.h>.
	(llrintf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power6/fpu/s_llround.S: Include
	<libm-alias-float.h>.
	(llroundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power6x/fpu/s_lrint.S: Include
	<libm-alias-float.h>.
	(lrintf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power6x/fpu/s_lround.S: Include
	<libm-alias-float.h>.
	(lroundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf.c: Include
	<libm-alias-float.h>.
	(ceilf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysignf.c: Include
	<libm-alias-float.h>.
	(copysignf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_cosf.c: Include
	<libm-alias-float.h>.
	(cosf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_floorf.c: Include
	<libm-alias-float.h>.
	(floorf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrintf.c: Include
	<libm-alias-float.h>.
	(llrintf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_llroundf.c: Include
	<libm-alias-float.h>.
	(llroundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbf.c: Include
	<libm-alias-float.h>.
	(logbf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_modff.c: Include
	<libm-alias-float.h>.
	(modff): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_roundf.c: Include
	<libm-alias-float.h>.
	(roundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_sinf.c: Include
	<libm-alias-float.h>.
	(sinf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_truncf.c: Include
	<libm-alias-float.h>.
	(truncf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/s_ceilf.S: Include
	<libm-alias-float.h>.
	(ceilf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/s_copysign.S: Include
	<libm-alias-float.h>.
	(copysignf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/s_floorf.S: Include
	<libm-alias-float.h>.
	(floorf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/s_llrint.S: Include
	<libm-alias-float.h>.
	(llrintf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/s_llroundf.S: Include
	<libm-alias-float.h>.
	(llroundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S: Include
	<libm-alias-float.h>.
	(nearbyintf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/s_rintf.S: Include
	<libm-alias-float.h>.
	(rintf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/s_roundf.S: Include
	<libm-alias-float.h>.
	(roundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/s_truncf.S: Include
	<libm-alias-float.h>.
	(truncf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_ceilf.S: Include
	<libm-alias-float.h>.
	(ceilf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_floorf.S: Include
	<libm-alias-float.h>.
	(floorf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_llround.S: Include
	<libm-alias-float.h>.
	(llroundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_roundf.S: Include
	<libm-alias-float.h>.
	(roundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_truncf.S: Include
	<libm-alias-float.h>.
	(truncf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/power6/fpu/s_copysign.S: Include
	<libm-alias-float.h>.
	(copysignf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/power6x/fpu/s_llrint.S: Include
	<libm-alias-float.h>.
	(llrintf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/power6x/fpu/s_llround.S: Include
	<libm-alias-float.h>.
	(llroundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/power8/fpu/s_cosf.S: Include
	<libm-alias-float.h>.
	(cosf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/power8/fpu/s_llrint.S: Include
	<libm-alias-float.h>.
	(llrintf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/power8/fpu/s_llround.S: Include
	<libm-alias-float.h>.
	(llroundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/power8/fpu/s_sinf.S: Include
	<libm-alias-float.h>.
	(sinf): Define using libm_alias_float.
2017-12-05 00:26:26 +00:00
Joseph Myers d17542d235 Use libm_alias_double for remaining powerpc functions.
Continuing the preparation for additional _FloatN / _FloatNx function
aliases, this patch makes the remaining double powerpc functions use
libm_alias_double to define function aliases (with consequent removal
of the need for local compat symbol handling).  Previous cleanups
avoid this patch changing installed stripped shared libraries for any
build-many-glibcs.py configuration (there are still some functions in
this patch for which the order of double and float aliases changes
within an individual source file, but in this case this doesn't result
in changes to the final library).

Tested with build-many-glibcs.py that installed stripped shared
libraries are unchanged for all its hard-float powerpc configurations.

	* sysdeps/powerpc/power7/fpu/s_logb.c: Include
	<libm-alias-double.h>.
	(logb): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/fpu/s_copysign.S: Include
	<libm-alias-double.h>.
	(copysign): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/fpu/s_llrint.c: Include
	<libm-alias-double.h>.
	(llrint): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/fpu/s_llround.c: Include
	<libm-alias-double.h>.
	(llround): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/fpu/s_lrint.S: Include
	<libm-alias-double.h>.
	(lrint): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/fpu/s_lround.S: Include
	<libm-alias-double.h>.
	(lround): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysign.c:
	Include <libm-alias-double.h>.
	(copysign): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint.c:
	Include <libm-alias-double.h>.
	(llrint): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llround.c:
	Include <libm-alias-double.h>.
	(llround): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logb.c: Include
	<libm-alias-double.h>.
	(logb): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lrint.c:
	Include <libm-alias-double.h>.
	(lrint): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lround.c:
	Include <libm-alias-double.h>.
	(lround): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power4/fpu/s_llrint.S: Include
	<libm-alias-double.h>.
	(llrint): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S: Include
	<libm-alias-double.h>.
	(llround): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power5+/fpu/s_llround.S: Include
	<libm-alias-double.h>.
	(llround): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power5+/fpu/s_lround.S: Include
	<libm-alias-double.h>.
	(lround): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power6/fpu/s_copysign.S: Include
	<libm-alias-double.h>.
	(copysign): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power6/fpu/s_llrint.S: Include
	<libm-alias-double.h>.
	(llrint): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power6/fpu/s_llround.S: Include
	<libm-alias-double.h>.
	(llround): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power6x/fpu/s_lrint.S: Include
	<libm-alias-double.h>.
	(lrint): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power6x/fpu/s_lround.S: Include
	<libm-alias-double.h>.
	(lround): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysign.c: Include
	<libm-alias-double.h>.
	(copysign): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint.c: Include
	<libm-alias-double.h>.
	(llrint): Define using libm_alias_double.
	(lrint): Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround.c: Include
	<libm-alias-double.h>.
	(llround): Define using libm_alias_double.
	(lround): Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_logb.c: Include
	<libm-alias-double.h>.
	(logb): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/fpu/s_copysign.S: Include
	<libm-alias-double.h>.
	(copysign): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/fpu/s_llrint.S: Include
	<libm-alias-double.h>.
	(llrint): Define using libm_alias_double.
	(lrint): Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_llround.S: Include
	<libm-alias-double.h>.
	(llround): Define using libm_alias_double.
	(lround): Likewise.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_llround.S: Include
	<libm-alias-double.h>.
	(llround): Define using libm_alias_double.
	(lround): Likewise.
	* sysdeps/powerpc/powerpc64/power6/fpu/s_copysign.S: Include
	<libm-alias-double.h>.
	(copysign): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/power6x/fpu/s_llrint.S: Include
	<libm-alias-double.h>.
	(llrint): Define using libm_alias_double.
	(lrint): Likewise.
	* sysdeps/powerpc/powerpc64/power6x/fpu/s_llround.S: Include
	<libm-alias-double.h>.
	(llround): Define using libm_alias_double.
	(lround): Likewise.
	* sysdeps/powerpc/powerpc64/power8/fpu/s_llrint.S: Include
	<libm-alias-double.h>.
	(llrint): Define using libm_alias_double.
	(lrint): Likewise.
	* sysdeps/powerpc/powerpc64/power8/fpu/s_llround.S: Include
	<libm-alias-double.h>.
	(llround): Define using libm_alias_double.
	(lround): Likewise.
2017-12-02 00:11:37 +00:00
Joseph Myers 0ddde474db Define powerpc64 lroundl compat symbol only once.
sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround.c defines the
lroundl compat symbol, version GLIBC_2_1, twice, once based on llround
and once based on __lround.  Those are aliases for each other (llround
weak, __lround strong), but defining it twice does not make sense.
This patch changes it to define the compat symbol once only, matching
how libm_alias_double defines it.

Tested with build-many-glibcs.py for its powerpc64 configurations.

	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround.c
	[LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)] (lroundl): Do not define
	compat symbol based on llround.
2017-12-01 23:58:05 +00:00
Joseph Myers 0d5ba561c1 Base powerpc logbl compat symbols on __logb not logb.
Some powerpc logb implementations define a compat symbol for logbl
based on logb, whereas libm_alias_double defines such a compat symbol
based on __logb instead.  This difference (logb is weak, __logb isn't)
is enough to result in different installed stripped shared libraries.
The difference in the installed libraries isn't significant, but first
changing the compat_symbol calls helps make it possible to validate a
subsequent change to use libm_alias_double by comparison of libraries,
so this patch does such a preliminary change.

Tested with build-many-glibcs.py for all its hard-float powerpc
configurations.

	* sysdeps/powerpc/power7/fpu/s_logb.c
	[LONG_DOUBLE_COMPAT (libm, GLIBC_2_0)] (logbl): Define as compat
	symbol based on __logb, not on logb.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logb.c
	[LONG_DOUBLE_COMPAT (libm, GLIBC_2_0)] (logbl): Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_logb.c
	[LONG_DOUBLE_COMPAT (libm, GLIBC_2_0)] (logbl): Likewise.
2017-12-01 23:37:46 +00:00
Joseph Myers 51ea3b2042 Ues libm_alias_double for various powerpc functions.
Continuing the preparation for additional _FloatN / _FloatNx function
aliases, this patch various powerpc functions use libm_alias_double to
define function aliases (with consequent removal of the need for local
compat symbol handling).  (The present patch excludes the changes to
some functions where such changes could result in differences in
installed stripped shared libraries because of changes to the exact
ordering or properties of symbols in individual .os files.)

Tested with build-many-glibcs.py that installed stripped shared
libraries are unchanged for all its hard-float powerpc configurations.

	* sysdeps/powerpc/fpu/s_rint.c: Include <libm-alias-double.h>.
	(rint): Define using libm_alias_double.
	* sysdeps/powerpc/power5+/fpu/s_modf.c: Include
	<libm-alias-double.h>.
	(modf): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/fpu/s_ceil.S: Include
	<libm-alias-double.h>.
	(ceil): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/fpu/s_floor.S: Include
	<libm-alias-double.h>.
	(floor): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S: Include
	<libm-alias-double.h>.
	(nearbyint): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/fpu/s_rint.S: Include
	<libm-alias-double.h>.
	(rint): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/fpu/s_round.S: Include
	<libm-alias-double.h>.
	(round): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/fpu/s_trunc.S: Include
	<libm-alias-double.h>.
	(trunc): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil.c: Include
	<libm-alias-double.h>.
	(ceil): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floor.c:
	Include <libm-alias-double.h>.
	(floor): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_modf.c: Include
	<libm-alias-double.h>.
	(modf): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round.c:
	Include <libm-alias-double.h>.
	(round): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc.c:
	Include <libm-alias-double.h>.
	(trunc): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power5+/fpu/s_ceil.S: Include
	<libm-alias-double.h>.
	(ceil): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power5+/fpu/s_floor.S: Include
	<libm-alias-double.h>.
	(floor): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power5+/fpu/s_round.S: Include
	<libm-alias-double.h>.
	(round): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power5+/fpu/s_trunc.S: Include
	<libm-alias-double.h>.
	(trunc): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil.c: Include
	<libm-alias-double.h>.
	(ceil): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_floor.c: Include
	<libm-alias-double.h>.
	(floor): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_modf.c: Include
	<libm-alias-double.h>.
	(modf): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_round.c: Include
	<libm-alias-double.h>.
	(round): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_trunc.c: Include
	<libm-alias-double.h>.
	(trunc): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/fpu/s_ceil.S: Include
	<libm-alias-double.h>.
	(ceil): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/fpu/s_floor.S: Include
	<libm-alias-double.h>.
	(floor): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S: Include
	<libm-alias-double.h>.
	(nearbyint): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/fpu/s_rint.S: Include
	<libm-alias-double.h>.
	(rint): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/fpu/s_round.S: Include
	<libm-alias-double.h>.
	(round): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/fpu/s_trunc.S: Include
	<libm-alias-double.h>.
	(trunc): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_ceil.S: Include
	<libm-alias-double.h>.
	(ceil): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_floor.S: Include
	<libm-alias-double.h>.
	(floor): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_round.S: Include
	<libm-alias-double.h>.
	(round): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_trunc.S: Include
	<libm-alias-double.h>.
	(trunc): Define using libm_alias_double.
2017-12-01 23:09:47 +00:00
Joseph Myers ec2cf3f444 Use libm_alias_double for powerpc fabs, fma.
Continuing the preparation for additional _FloatN / _FloatNx function
aliases, this patch makes powerpc fabs and fma use libm_alias_double
to define function aliases.  This brings in automatic symbol
versioning compat handling, so the powerpc32 and powerpc64 wrappers
that added such handling to the generic sysdeps/powerpc/fpu versions
are removed as no longer required (there are no sysdeps directory
ordering issues that would necessitate keeping trivial wrappers
there).

Tested with build-many-glibcs.py that installed stripped shared
libraries are unchanged for all its hard-float powerpc configurations.

	* sysdeps/powerpc/fpu/s_fabs.S: Include <libm-alias-double.h>.
	(fabs): Define using libm_alias_double.
	* sysdeps/powerpc/fpu/s_fma.S: Include <libm-alias-double.h>.
	(fma): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/fpu/s_fabs.S: Remove file.
	* sysdeps/powerpc/powerpc32/fpu/s_fma.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_fabs.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_fma.S: Likewise.
2017-12-01 22:23:28 +00:00
Alan Modra 58af72b4e2 [PowerPC64] sysdep.h doesn't need to be included in multiarch files
When the .c/.S file neither uses nor modifies macros defined in
sysdep.h there is no point to #include it.  The same goes for
math_ldbl_opt.h except that it includes shlib-compat.h, and if
compat_symbol is redefined we need to include shlib-compat.h first.

	* sysdeps/powerpc/powerpc64/fpu/multiarch/e_expf-power8.S: Don't
	include sysdep.h.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf-power5+.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf-ppc64.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_cosf-power8.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_cosf-ppc64.c: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-power7.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-power8.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_floor-power5+.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_floor-ppc64.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_roundf-power5+.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_roundf-ppc64.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_sinf-power8.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_sinf-ppc64.c: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_truncf-power5+.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_truncf-ppc64.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/memchr-power7.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/memchr-power8.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/memcmp-power4.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/memcmp-power7.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/memcmp-power8.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/memcpy-a2.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/memcpy-cell.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/memcpy-power4.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/memcpy-power6.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/memcpy-power7.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/memcpy-ppc64.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/memmove-power7.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/mempcpy-power7.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/memrchr-power7.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/memrchr-power8.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/memset-power4.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/memset-power6.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/memset-power7.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/memset-power8.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/rawmemchr-power7.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/stpcpy-power8.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/stpncpy-power7.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/stpncpy-power8.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strcasecmp-power7.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strcasecmp-power8.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strcasecmp_l-power7.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strcasestr-power8.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strchr-power7.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strchr-power8.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strchr-ppc64.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strchrnul-power7.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strchrnul-power8.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strcmp-power7.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strcmp-power8.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strcmp-power9.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strcmp-ppc64.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strcpy-power8.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strcspn-power8.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strlen-power7.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strlen-power8.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strlen-ppc64.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strncase-power8.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strncmp-power4.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strncmp-power7.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strncmp-power8.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strncmp-power9.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strncmp-ppc64.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strncpy-power7.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strncpy-power8.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strnlen-power7.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strnlen-power8.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strrchr-power7.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strrchr-power8.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strspn-power8.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strstr-power7.S: Likewise.

	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_floorf-ppc64.S: Don't
	include sysdep.h and math_ldbl_opt.h.

	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil-power5+.S: Don't
	include sysdep.h and math_ldbl_opt.h.  Include shlib-compat.h.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil-ppc64.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysign-power6.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysign-ppc64.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_floorf-power5+.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf-power7.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf-power8.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power5.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power6.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power6x.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power7.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power8.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-ppc64.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-power6x.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-power8.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-ppc64.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-power5+.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-power6x.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-power8.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-ppc64.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_llroundf-ppc64.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_round-power5+.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_round-ppc64.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_trunc-power5+.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_trunc-ppc64.S: Likewise.
2017-10-31 12:27:19 +10:30
Alan Modra e9b8e19419 [PowerPC64] Don't define __GI_ variant of isnan for static lib
It seems to me that libc.a should not contain any of the __GI_
symbols, and certainly --enable-multi-arch ought to not add to the
list.  At the end of this patch series we have the following in both
--enable-multi-arch and --disable-multi-arch libc.a:
0000000000000000 T __GI___readdir64
0000000000000000 T __GI___fxstatat64
0000000000000000 T __GI_getrlimit
0000000000000000 T __GI___getrlimit

	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-ppc64.S (hidden_def):
	Redefine only when SHARED.
2017-10-31 12:27:19 +10:30
Joseph Myers d8f619b393 Use libm_alias_double for dbl-64 modf.
This patch makes dbl-64 modf use libm_alias_double.  Both the dbl-64
and dbl-64/wordsize-64 versions are changed, and the ldbl-opt version
is changed to define the libc compat symbol only.  Because of
multiarch wrappers, the changed implementations are made not to define
aliases at all if __modf is defined as a macro, as with other
functions, so avoiding duplicate compat symbols while allowing those
wrappers to be simplified.

Tested for x86_64, and verified with build-many-glibcs.py that
installed stripped shared libraries are unchanged by the patch.

	* sysdeps/ieee754/dbl-64/s_modf.c: Include <libm-alias-double.h>.
	(modf): Define using libm_alias_double, only if [!__modf].
	* sysdeps/ieee754/dbl-64/wordsize-64/s_modf.c: Include
	<libm-alias-double.h>.
	(modf): Define using libm_alias_double, only if [!__modf].
	* sysdeps/ieee754/ldbl-opt/s_modf.c (modfl): Only define libc
	compat symbol here.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_modf-ppc32.c
	(weak_alias): Do not undefine and redefine.
	(strong_alias): Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_modf-ppc64.c
	(weak_alias): Likewise.
	(strong_alias): Likewise.
2017-10-03 23:46:23 +00:00
Joseph Myers 4699cb8b5f Use libm_alias_double for dbl-64 logb.
This patch makes dbl-64 logb use libm_alias_double.  Both the dbl-64
and dbl-64/wordsize-64 versions are changed, and the ldbl-opt version
is removed.  Because of multiarch wrappers, the changed
implementations are made not to define aliases at all if __logb is
defined as a macro, as with other functions, so avoiding duplicate
compat symbols while allowing those wrappers to be simplified.

Tested for x86_64, and verified with build-many-glibcs.py that
installed stripped shared libraries are unchanged (except on alpha
where changes from using the wordsize-64 version are expected).

	* sysdeps/ieee754/dbl-64/s_logb.c: Include <libm-alias-double.h>.
	(logb): Define using libm_alias_double, only if [!__logb].
	* sysdeps/ieee754/dbl-64/wordsize-64/s_logb.c: Include
	<libm-alias-double.h>.
	(logb): Define using libm_alias_double, only if [!__logb].
	* sysdeps/ieee754/ldbl-opt/s_logb.c: Remove file.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logb-ppc32.c
	(weak_alias): Do not undefine and redefine.
	(strong_alias): Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_logb-ppc64.c
	(weak_alias): Likewise.
	(strong_alias): Likewise.
2017-10-03 23:44:41 +00:00
Szabolcs Nagy f7a0b063e7 Do not wrap expf and exp2f
The new generic expf and exp2f code don't need wrappers any more, they
set errno inline, so only use the wrappers on targets that need it.
(If the wrapper is needed, then the top level wrapper code is included,
otherwise empty w_exp*f.c is used to suppress the wrapper.)

A powerpc64 expf implementation includes the expf c code directly which
needed some changes.

	* sysdeps/ieee754/flt-32/e_exp2f.c (__exp2f): Define without wrapper.
	* sysdeps/ieee754/flt-32/e_expf.c (__expf): Likewise
	* sysdeps/ieee754/flt-32/w_exp2f.c: New file.
	* sysdeps/ieee754/flt-32/w_expf.c: New file.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/e_expf-ppc64.c: Update for
	the new expf code.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/w_expf.c: New file.
	* sysdeps/powerpc/powerpc64/power8/fpu/w_expf.c: New file.
	* sysdeps/m68k/m680x0/fpu/w_exp2f.c: New file.
	* sysdeps/m68k/m680x0/fpu/w_expf.c: New file.
	* sysdeps/i386/fpu/w_exp2f.c: New file.
	* sysdeps/i386/fpu/w_expf.c: New file.
	* sysdeps/i386/i686/fpu/multiarch/w_expf.c: New file.
	* sysdeps/x86_64/fpu/w_expf.c: New file.
2017-10-02 14:38:54 +01:00
Gabriel F. T. Gomes e010deb231 powerpc: Add redirection for finitef128, isinf128, and isnanf128
On powerpc64le, compiler support for float128 is not enabled by default
on gcc.  To enable it, the flag -mfloat128 must be passed as a command
line option to the compiler.  This means that only the few files that
actively have -mfloat128 passed as an argument get compiler support for
float128, whereas all other files don't.

When -mfloat128 becomes enabled by default on powerpc [1], all the files
that do not currently have compiler support for float128 enabled during
their compilation, will start to have it.  This will lead to build
errors in s_finite.c, s_isinf.c, and s_isnan.c.

The errors are due to the unintended macro expansion of __finitef128 to
__redirect_finitef128 in math/bits/mathcalls-helper-functions.h.  In
that header, __MATHDECL_1 takes '__finite' and 'f128' as arguments and
concatenates them.  However, since '__finite' has been redefined in
s_finite.c, the function declaration becomes __redirect_finitef128:

    extern int __redirect___finitef128 (_Float128 __value) __attribute__ ((__nothrow__ )) __attribute__ ((__const__));

This declaration itself is OK.  The problem arises when include/math.h
creates the hidden prototype ('hidden_proto (__finitef128)'), which
expands to:

    extern __typeof (__finitef128) __finitef128 __attribute__ ((visibility ("hidden")));

Since __finitef128 is not declared, __typeof fails.  This effect was
already true for the 'float' and 'long double' versions and is now true
for float128.  Likewise for isinsff128 and isnanf128.

This patch defines __finitef128 as __redirect___finitef128 in
sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite.c, similarly to what's
done for the float and long double versions of these functions, to get
rid of the build error.  Likewise for isinff128 and isnanf128.

[1] https://gcc.gnu.org/ml/gcc-patches/2017-08/msg01028.html

Tested for powerpc64 and powerpc64le.

	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite.c
	(__finitef128): Define to __redirect___finitef128.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf.c
	(__isinff128): Define to __redirect___isinff128.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan.c
	(__isnanf128): Define to __redirect___isnanf128.
2017-09-21 17:37:39 -03:00
Tulio Magno Quites Machado Filho 61c45f2505 [BZ #21745] powerpc: build some IFUNC math functions for libc and libm
Some math functions have to be distributed in libc because they're
required by printf.
libc and libm require their own builds of these functions, e.g. libc
functions have to call __stack_chk_fail_local in order to bypass the
PLT, while libm functions have to call __stack_chk_fail.

While math/Makefile treat the generic cases, i.e. s_isinff, the
multiarch Makefile has to treat its own files, i.e. s_isinff-ppc64.

	[BZ #21745]
	* sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile:
	[$(subdir) = math] (sysdep_calls): New variable.  Has the
	previous contents of sysdep_routines, but re-sorted..
	[$(subdir) = math] (sysdep_routines): Re-use the contents from
	sysdep_calls.
	[$(subdir) = math] (libm-sysdep_routines): Remove the functions
	defined in sysdep_calls and replace by the respective m_* names.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-ppc64.S:
	(compat_symbol): Undefine to avoid duplicated compat symbols in
	libc.
2017-09-15 15:09:19 -03:00
Rogerio A. Cardoso 76c4c838e7 powerpc: Fix sinf() IFUNC fallback.
sysdeps/powerpc/powerpc64/fpu/multiarch/s_sinf-ppc64.c should fall back to
sysdeps/powerpc/fpu/s_sinf.c not to sysdeps/ieee754/flt-32/s_sinf.c.

	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_sinf-ppc64.c: Change
	s_sinf.c from sysdeps/ieee754/flt-32/ to sysdeps/powerpc/fpu/.
2017-06-23 09:19:00 -03:00
Rajalakshmi Srinivasaraghavan 001b09a6a2 powerpc: Add optimized version of [l]lroundf
This patch makes use of optimized double version of llround for single
precision as both the versions return [long] long type.
2017-06-23 10:43:31 +05:30
Rajalakshmi Srinivasaraghavan 99c3eb0f73 powerpc: Add optimized version of [l]lrintf
This patch makes use of optimized double version of llrint for single
precision as both the versions return [long] long type.
2017-06-21 10:44:18 +05:30
Alan Modra d5b411854f PowerPC64 ENTRY_TOCLESS
A number of functions in the sysdeps/powerpc/powerpc64/ tree don't use
or change r2, yet declare a global entry that sets up r2.  This patch
fixes that problem, and consolidates the ENTRY and EALIGN macros.

	* sysdeps/powerpc/powerpc64/sysdep.h: Formatting.
	(NOPS, ENTRY_3): New macros.
	(ENTRY): Rewrite.
	(ENTRY_TOCLESS): Define.
	(EALIGN, EALIGN_W_0, EALIGN_W_1, EALIGN_W_2, EALIGN_W_4, EALIGN_W_5,
	EALIGN_W_6, EALIGN_W_7, EALIGN_W_8): Delete.
	* sysdeps/powerpc/powerpc64/a2/memcpy.S: Replace EALIGN with ENTRY.
	* sysdeps/powerpc/powerpc64/dl-trampoline.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_ceil.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_ceilf.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_floor.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_floorf.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_rint.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_rintf.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_round.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_roundf.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_trunc.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_truncf.S: Likewise.
	* sysdeps/powerpc/powerpc64/memset.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/fpu/s_finite.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/fpu/s_isinf.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/fpu/s_isnan.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/strstr.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/fpu/e_expf.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/fpu/s_cosf.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/fpu/s_sinf.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/strcasestr.S: Likewise.
	* sysdeps/powerpc/powerpc64/addmul_1.S: Use ENTRY_TOCLESS.
	* sysdeps/powerpc/powerpc64/cell/memcpy.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_copysign.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_copysignl.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_fabsl.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_isnan.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_llrint.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_llrintf.S: Likewise.
	* sysdeps/powerpc/powerpc64/lshift.S: Likewise.
	* sysdeps/powerpc/powerpc64/memcpy.S: Likewise.
	* sysdeps/powerpc/powerpc64/mul_1.S: Likewise.
	* sysdeps/powerpc/powerpc64/power4/memcmp.S: Likewise.
	* sysdeps/powerpc/powerpc64/power4/memcpy.S: Likewise.
	* sysdeps/powerpc/powerpc64/power4/memset.S: Likewise.
	* sysdeps/powerpc/powerpc64/power4/strncmp.S: Likewise.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_ceil.S: Likewise.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_ceilf.S: Likewise.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_floor.S: Likewise.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_floorf.S: Likewise.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_llround.S: Likewise.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_round.S: Likewise.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_roundf.S: Likewise.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_trunc.S: Likewise.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_truncf.S: Likewise.
	* sysdeps/powerpc/powerpc64/power5/fpu/s_isnan.S: Likewise.
	* sysdeps/powerpc/powerpc64/power6/fpu/s_copysign.S: Likewise.
	* sysdeps/powerpc/powerpc64/power6/fpu/s_isnan.S: Likewise.
	* sysdeps/powerpc/powerpc64/power6/memcpy.S: Likewise.
	* sysdeps/powerpc/powerpc64/power6/memset.S: Likewise.
	* sysdeps/powerpc/powerpc64/power6x/fpu/s_isnan.S: Likewise.
	* sysdeps/powerpc/powerpc64/power6x/fpu/s_llrint.S: Likewise.
	* sysdeps/powerpc/powerpc64/power6x/fpu/s_llround.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/add_n.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/memchr.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/memcmp.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/memcpy.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/memmove.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/mempcpy.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/memrchr.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/memset.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/rawmemchr.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/strcasecmp.S (strcasecmp_l):
	Likewise.
	* sysdeps/powerpc/powerpc64/power7/strchr.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/strchrnul.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/strcmp.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/strlen.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/strncmp.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/strncpy.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/strnlen.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/strrchr.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/fpu/s_finite.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/fpu/s_isinf.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/fpu/s_isnan.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/fpu/s_llrint.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/fpu/s_llround.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/memcmp.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/memset.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/strchr.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/strcmp.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/strcpy.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/strlen.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/strncmp.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/strncpy.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/strnlen.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/strrchr.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/strspn.S: Likewise.
	* sysdeps/powerpc/powerpc64/power9/strcmp.S: Likewise.
	* sysdeps/powerpc/powerpc64/power9/strncmp.S: Likewise.
	* sysdeps/powerpc/powerpc64/strchr.S: Likewise.
	* sysdeps/powerpc/powerpc64/strcmp.S: Likewise.
	* sysdeps/powerpc/powerpc64/strlen.S: Likewise.
	* sysdeps/powerpc/powerpc64/strncmp.S: Likewise.
	* sysdeps/powerpc/powerpc64/ppc-mcount.S: Store LR earlier.  Don't
	add nop when SHARED.
	* sysdeps/powerpc/powerpc64/start.S: Fix comment.
	* sysdeps/powerpc/powerpc64/multiarch/strrchr-power8.S (ENTRY): Don't
	define.
	(ENTRY_TOCLESS): Define.
	* sysdeps/powerpc/powerpc32/sysdep.h (ENTRY_TOCLESS): Define.
	* sysdeps/powerpc/fpu/s_fma.S: Use ENTRY_TOCLESS.
	* sysdeps/powerpc/fpu/s_fmaf.S: Likewise.
2017-06-14 10:45:50 +09:30
Paul Clarke b2980e3c54 powerpc: Add a POWER8-optimized version of cosf()
This implementation is based on the one already used at
sysdeps/powerpc/powerpc64/fpu/multiarch/s_sinf-power8.S.

	* sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
	[$(subdir) = math] (libm-sysdep_routines): Add s_cosf-power8 and
	s_cosf-ppc64.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_cosf-power8.S: New file.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_cosf-ppc64.c: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_cosf.c: Likewise.
	* sysdeps/powerpc/powerpc64/power8/fpu/s_cosf.S: Likewise.
2017-05-17 18:37:48 -03:00
Joseph Myers bfff8b1bec Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
Adhemerval Zanella cfee7d9cf4 powerpc: Remove f{max,min}{f} assembly implementations
This patch removes the powerpc assembly implementation of fmax/fmin.
Based on benchtests, the assembly ones shows:

$ ./testrun.sh benchtests/bench-fmax
  "fmax": {
   "": {
    "duration": 5.07586e+09,
    "iterations": 2.01676e+09,
    "max": 1350.39,
    "min": 2.073,
    "mean": 2.51684
   },
   "qNaN": {
    "duration": 5.09315e+09,
    "iterations": 8.4568e+08,
    "max": 2788,
    "min": 5.806,
    "mean": 6.02255
   },
   "sNaN": {
    "duration": 5.09073e+09,
    "iterations": 8.42316e+08,
    "max": 4215.84,
    "min": 5.737,
    "mean": 6.04373
   }

And

$ ./testrun.sh benchtests/bench-fmin
  "fmin": {
   "": {
    "duration": 5.07711e+09,
    "iterations": 2.02982e+09,
    "max": 497.094,
    "min": 2.073,
    "mean": 2.50126
   },
   "qNaN": {
    "duration": 5.09134e+09,
    "iterations": 8.46968e+08,
    "max": 2255.14,
    "min": 5.807,
    "mean": 6.01125
   },
   "sNaN": {
    "duration": 5.09122e+09,
    "iterations": 8.4746e+08,
    "max": 1969.38,
    "min": 5.729,
    "mean": 6.00763
   }
  }

The default implementation (math/s_f{max.min}_template.c) shows slight better
latency for all cases:

$ ./testrun.sh benchtests/bench-fmax
  "fmax": {
   "": {
    "duration": 5.07044e+09,
    "iterations": 2.38695e+09,
    "max": 2048.58,
    "min": 2.073,
    "mean": 2.12423
   },
   "qNaN": {
    "duration": 5.09004e+09,
    "iterations": 9.45428e+08,
    "max": 3306.93,
    "min": 5.138,
    "mean": 5.38385
   },
   "sNaN": {
    "duration": 5.08458e+09,
    "iterations": 1.15959e+09,
    "max": 972.008,
    "min": 3.321,
    "mean": 4.3848
   }
  }

And:

$ ./testrun.sh benchtests/bench-fmin
  "fmin": {
   "": {
    "duration": 5.06817e+09,
    "iterations": 2.3913e+09,
    "max": 1177.9,
    "min": 2.073,
    "mean": 2.11942
   },
   "qNaN": {
    "duration": 5.08857e+09,
    "iterations": 9.45656e+08,
    "max": 2658.83,
    "min": 5.09,
    "mean": 5.38099
   },
   "sNaN": {
    "duration": 5.08093e+09,
    "iterations": 1.16725e+09,
    "max": 1030.74,
    "min": 3.323,
    "mean": 4.3529
   }
  }

Both were run with GCC 5.4 (ubuntu 16 default installation) using default
compiler flags on POWER8E 3.4GHz (powerpc64le-linux-gnu).
2016-12-27 17:42:09 -02:00
Joseph Myers 05f3ed0a79 Stop powerpc copysignl raising "invalid" for sNaN argument (bug 20718).
The powerpc (hard-float) implementations of copysignl, both 32-bit and
64-bit, raise spurious "invalid" exceptions when the first argument is
a signaling NaN.  copysign functions should never raise exceptions
even for signaling NaNs.

The problem is the use of an fcmpu instruction to test the sign of the
high part of the long double argument.  This patch fixes the functions
to use fsel instead (as used for fabsl following my fixes for a
similar bug there), or to examine the integer representation for older
32-bit processors without fsel.

Tested for powerpc64 and powerpc32 (configurations with and without
fsel used).

	[BZ #20718]
	* sysdeps/powerpc/powerpc32/fpu/s_copysignl.S (__copysignl): Do
	not use floating-point comparisons to test sign.
	* sysdeps/powerpc/powerpc64/fpu/s_copysignl.S (__copysignl):
	Likewise.
2016-10-19 22:58:34 +00:00
Stefan Liebler 00980d845f Use gcc attribute ifunc in libc_ifunc macro instead of inline assembly due to false debuginfo.
The current s390 ifunc resolver for vector optimized functions and the common
libc_ifunc macro in include/libc-symbols.h uses something like that to generate ifunc'ed functions:
extern void *__resolve___strlen(unsigned long int dl_hwcap) asm (strlen);
asm (".type strlen, %gnu_indirect_function");

This leads to false debug information:
objdump --dwarf=info libc.so:
...
<1><1e6424>: Abbrev Number: 43 (DW_TAG_subprogram)
    <1e6425>   DW_AT_external    : 1
    <1e6425>   DW_AT_name        : (indirect string, offset: 0x1146e): __resolve___strlen
    <1e6429>   DW_AT_decl_file   : 1
    <1e642a>   DW_AT_decl_line   : 23
    <1e642b>   DW_AT_linkage_name: (indirect string, offset: 0x1147a): strlen
    <1e642f>   DW_AT_prototyped  : 1
    <1e642f>   DW_AT_type        : <0x1e4ccd>
    <1e6433>   DW_AT_low_pc      : 0x998e0
    <1e643b>   DW_AT_high_pc     : 0x16
    <1e6443>   DW_AT_frame_base  : 1 byte block: 9c     (DW_OP_call_frame_cfa)
    <1e6445>   DW_AT_GNU_all_call_sites: 1
    <1e6445>   DW_AT_sibling     : <0x1e6459>
 <2><1e6449>: Abbrev Number: 44 (DW_TAG_formal_parameter)
    <1e644a>   DW_AT_name        : (indirect string, offset: 0x1845): dl_hwcap
    <1e644e>   DW_AT_decl_file   : 1
    <1e644f>   DW_AT_decl_line   : 23
    <1e6450>   DW_AT_type        : <0x1e4c8d>
    <1e6454>   DW_AT_location    : 0x122115 (location list)
...

The debuginfo for the ifunc-resolver function contains the DW_AT_linkage_name
field, which names the real function name "strlen". If you perform an inferior
function call to strlen in lldb, then it fails due to something like that:
"error: no matching function for call to 'strlen'
candidate function not viable: no known conversion from 'const char [6]'
to 'unsigned long' for 1st argument"

The unsigned long is the dl_hwcap argument of the resolver function.
The strlen function itself has no debufinfo.

The s390 ifunc resolver for memset & co uses something like that:
asm (".globl FUNC"
     ".type FUNC, @gnu_indirect_function"
     ".set FUNC, __resolve_FUNC");

This way the debuginfo for the ifunc-resolver function does not conain the
DW_AT_linkage_name field and the real function has no debuginfo, too.

Using this strategy for the vector optimized functions leads to some troubles
for functions like strnlen. Here we have __strnlen and a weak alias strnlen.
The __strnlen function is the ifunc function, which is realized with the asm-
statement above. The weak_alias-macro can't be used here due to undefined symbol:
gcc ../sysdeps/s390/multiarch/strnlen.c -c ...
In file included from <command-line>:0:0:
../sysdeps/s390/multiarch/strnlen.c:28:24: error: ‘strnlen’ aliased to undefined symbol ‘__strnlen’
 weak_alias (__strnlen, strnlen)
                        ^
./../include/libc-symbols.h:111:26: note: in definition of macro ‘_weak_alias’
   extern __typeof (name) aliasname __attribute__ ((weak, alias (#name)));
                          ^
../sysdeps/s390/multiarch/strnlen.c:28:1: note: in expansion of macro ‘weak_alias’
 weak_alias (__strnlen, strnlen)
 ^
make[2]: *** [build/string/strnlen.o] Error 1

As the __strnlen function is defined with asm-statements the function name
__strnlen isn't known by gcc. But the weak alias can also be done with an
asm statement to resolve this issue:
__asm__ (".weak  strnlen\n\t"
         ".set   strnlen,__strnlen\n");

In order to use the weak_alias macro, gcc needs to know the ifunc function. The
minimum gcc to build glibc is currently 4.7, which supports attribute((ifunc)).
See https://gcc.gnu.org/onlinedocs/gcc-4.7.0/gcc/Function-Attributes.html.
It is only supported if gcc is configured with --enable-gnu-indirect-function
or gcc supports it by default for at least intel and s390x architecture.
This patch uses the old behaviour if gcc support is not available.
Usage of attribute ifunc is something like that:
__typeof (FUNC) FUNC __attribute__ ((ifunc ("__resolve_FUNC")));

Then gcc produces the same .globl, .type, .set assembler instructions like above.
And the debuginfo does not contain the DW_AT_linkage_name field and there is no
debuginfo for the real function, too.

But in order to get it work, there is also some extra work to do.
Currently, the glibc internal symbol on s390x e.g. __GI___strnlen is not the
ifunc symbol, but the fallback __strnlen_c symbol. Thus I have to omit the
libc_hidden_def macro in strnlen.c (here is the ifunc function __strnlen)
because it is already handled in strnlen-c.c (here is __strnlen_c).

Due to libc_hidden_proto (__strnlen) in string.h, compiling fails:
gcc ../sysdeps/s390/multiarch/strnlen.c -c ...
In file included from <command-line>:0:0:
../sysdeps/s390/multiarch/strnlen.c:53:24: error: ‘strnlen’ aliased to undefined symbol ‘__strnlen’
 weak_alias (__strnlen, strnlen)
                        ^
./../include/libc-symbols.h:111:26: note: in definition of macro ‘_weak_alias’
   extern __typeof (name) aliasname __attribute__ ((weak, alias (#name)));
                          ^
../sysdeps/s390/multiarch/strnlen.c:53:1: note: in expansion of macro ‘weak_alias’
 weak_alias (__strnlen, strnlen)
 ^
make[2]: *** [build/string/strnlen.os] Error 1

I have to redirect the prototypes for __strnlen in string.h and create a copy
of the prototype for using as ifunc function:
__typeof (__redirect___strnlen) __strnlen __attribute__ ((ifunc ("__resolve_strnlen")));
weak_alias (__strnlen, strnlen)

This way there is no trouble with the internal __GI_* symbols.
Glibc builds fine with this construct and the debuginfo is "correct".
For functions without a __GI_* symbol like memccpy this redirection is not needed.

This patch adjusts the common libc_ifunc and libm_ifunc macro to use gcc
attribute ifunc. Due to this change, the macro users where the __GI_* symbol
does not target the ifunc symbol have to be prepared with the redirection
construct.
Furthermore a configure check to test gcc support is added. If it is not supported,
the old behaviour is used.

This patch also prepares the libc_ifunc macro to be useable in s390-ifunc-macro.
The s390 ifunc-resolver-functions do have an hwcaps parameter and not all
resolvers need the same initialization code. The next patch in this series
changes the s390 ifunc macros to use this common one.

ChangeLog:

	* include/libc-symbols.h (__ifunc_resolver):
	New macro is used by __ifunc* macros.
	(__ifunc): New macro uses gcc attribute ifunc or inline assembly
	depending on HAVE_GCC_IFUNC.
	(libc_ifunc, libm_ifunc): Use __ifunc as base macro.
	(libc_ifunc_redirected, libc_ifunc_hidden, libm_ifunc_init): New macro.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite.c:
	Redirect ifunced function in header for using as type for ifunc function.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finitef.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinf.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinff.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/memcmp.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/memcpy.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/memmove.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/mempcpy.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/memset.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/rawmemchr.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/strchr.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/strlen.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/strncmp.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/strnlen.c: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite.c: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_finitef.c: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf.c: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinff.c: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/memcmp.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/mempcpy.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/rawmemchr.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/stpncpy.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strcat.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strchr.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strcmp.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strcpy.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strncmp.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strncpy.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strnlen.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strrchr.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strstr.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/wcschr.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnanf.c:
	Add libc_hidden_def() and use libc_ifunc_hidden() macro
	instead of libc_ifunc() macro.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnanf.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/stpcpy.c: Likewise.
2016-10-07 10:03:20 +02:00
Aurelien Jarno 6bcc7ced4f ppc: Fix modf (sNaN) for pre-POWER5+ CPU (bug 20240).
Commit a6a4395d fixed modf implementation by compiling s_modf.c and
s_modff.c with -fsignaling-nans. However these files are also included
from the pre-POWER5+ implementation, and thus these files should also
be compiled with -fsignaling-nans.

Changelog:
	[BZ #20240]
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile
	(CFLAGS-s_modf-ppc32.c): New variable.
	(CFLAGS-s_modff-ppc32.c): Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
	(CFLAGS-s_modf-ppc64.c): Likewise.
	(CFLAGS-s_modff-ppc64.c): Likewise.
2016-07-08 11:24:34 +02:00
Anton Blanchard aa95fc13f5 powerpc: Add a POWER8-optimized version of sinf()
This uses the implementation of sinf() in sysdeps/x86_64/fpu/s_sinf.S
as inspiration.
2016-06-30 16:08:49 -03:00
Tulio Magno Quites Machado Filho 35da2541c3 powerpc: Add a POWER8-optimized version of expf()
This implementation is based on the one already used at
sysdeps/x86_64/fpu/e_expf.S.

This implementation improves the performance by ~14% on average in synthetic
benchmarks at the cost of decreasing accuracy to 1 ULP.
2016-06-30 14:56:14 -03:00
Joseph Myers f4015c8a86 Use generic fdim on more architectures (bug 6796, bug 20255, bug 20256).
Some architectures have their own versions of fdim functions, which
are missing errno setting (bug 6796) and may also return sNaN instead
of qNaN for sNaN input, in the case of the x86 / x86_64 long double
versions (bug 20256).

These versions are not actually doing anything that a compiler
couldn't generate, just straightforward comparisons / arithmetic (and,
in the x86 / x86_64 case, testing for NaNs with fxam, which isn't
actually needed once you use an unordered comparison and let the NaNs
pass through the same subtraction as non-NaN inputs).  This patch
removes the x86 / x86_64 / powerpc versions, so that those
architectures use the generic C versions, which correctly handle
setting errno and deal properly with sNaN inputs.  This seems better
than dealing with setting errno in lots of .S versions.

The i386 versions also return results with excess range and precision,
which is not appropriate for a function exactly defined by reference
to IEEE operations.  For errno setting to work correctly on overflow,
it's necessary to remove excess range with math_narrow_eval, which
this patch duly does in the float and double versions so that the
tests can reliably pass on x86.  For float, this avoids any double
rounding issues as the long double precision is more than twice that
of float.  For double, double rounding issues will need to be
addressed separately, so this patch does not fully fix bug 20255.

Tested for x86_64, x86 and powerpc.

	[BZ #6796]
	[BZ #20255]
	[BZ #20256]
	* math/s_fdim.c: Include <math_private.h>.
	(__fdim): Use math_narrow_eval on result.
	* math/s_fdimf.c: Include <math_private.h>.
	(__fdimf): Use math_narrow_eval on result.
	* sysdeps/i386/fpu/s_fdim.S: Remove file.
	* sysdeps/i386/fpu/s_fdimf.S: Likewise.
	* sysdeps/i386/fpu/s_fdiml.S: Likewise.
	* sysdeps/i386/i686/fpu/s_fdim.S: Likewise.
	* sysdeps/i386/i686/fpu/s_fdimf.S: Likewise.
	* sysdeps/i386/i686/fpu/s_fdiml.S: Likewise.
	* sysdeps/powerpc/fpu/s_fdim.c: Likewise.
	* sysdeps/powerpc/fpu/s_fdimf.c: Likewise.
	* sysdeps/powerpc/powerpc32/fpu/s_fdim.c: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_fdim.c: Likewise.
	* sysdeps/x86_64/fpu/s_fdiml.S: Likewise.
	* math/libm-test.inc (fdim_test_data): Expect errno setting on
	overflow.  Add sNaN tests.
2016-06-14 16:04:19 +00:00
Joseph Myers f6ef0657e4 Fix powerpc64 ceil, rint etc. on sNaN input (bug 20160).
The powerpc64 versions of ceil, floor, round, trunc, rint, nearbyint
and their float versions return sNaN for sNaN input when they should
return qNaN.  This patch fixes them to add a NaN argument to itself to
quiet sNaNs before returning.

Tested for powerpc64.

	[BZ #20160]
	* sysdeps/powerpc/powerpc64/fpu/s_ceil.S (__ceil): Add NaN
	argument to itself before returning the result.
	* sysdeps/powerpc/powerpc64/fpu/s_ceilf.S (__ceilf): Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_floor.S (__floor): Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_floorf.S (__floorf): Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S (__nearbyint):
	Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S (__nearbyintf):
	Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_rint.S (__rint): Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_rintf.S (__rintf): Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_round.S (__round): Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_roundf.S (__roundf): Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_trunc.S (__trunc): Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_truncf.S (__truncf): Likewise.
2016-05-27 17:47:54 +00:00
Joseph Myers 24e9ae1bc2 Avoid "invalid" exceptions from powerpc fabsl (sNaN) (bug 20157).
The powerpc implementations of fabsl for ldbl-128ibm (both powerpc32
and powerpc64) wrongly raise the "invalid" exception for sNaN
arguments.  fabs functions should be quiet for all inputs including
signaling NaNs.  The problem is the use of a comparison instruction
fcmpu to determine if the high part of the argument is negative and so
the low part needs to be negated; such instructions raise "invalid"
for sNaNs.

There is a pure integer implementation of fabsl in
sysdeps/ieee754/ldbl-128ibm/s_fabsl.c.  However, it's not necessary to
use it to avoid such exceptions.  The fsel instruction does not raise
exceptions for sNaNs, and can be used in place of the original
comparison.  (Note that if the high part is zero or a NaN, it does not
matter whether the low part is negated; the choice of whether the low
part of a zero is +0 or -0 does not affect the value, and the low part
of a NaN does not affect the value / payload either.)

The condition in GCC for fsel to be available is TARGET_PPC_GFXOPT,
corresponding to the _ARCH_PPCGR predefined macro.  fsel is available
on all 64-bit processors supported by GCC.  A few 32-bit processors
supported by GCC do not have TARGET_PPC_GFXOPT despite having hard
float support.  To support those processors, integer code (similar to
that in copysignl) is included for the !_ARCH_PPCGR case for
powerpc32.

Tested for powerpc32 (configurations with and without _ARCH_PPCGR) and
powerpc64.

	[BZ #20157]
	* sysdeps/powerpc/powerpc32/fpu/s_fabsl.S (__fabsl): Use fsel to
	determine whether to negate low half if [_ARCH_PPCGR], and integer
	comparison otherwise.
	* sysdeps/powerpc/powerpc64/fpu/s_fabsl.S (__fabsl): Use fsel to
	determine whether to negate low half.
2016-05-27 15:29:31 +00:00
Joseph Myers b4d80349bb Do not raise "inexact" from powerpc64 ceil, floor, trunc (bug 15479).
Continuing fixes for ceil, floor and trunc functions not to raise the
"inexact" exception, this patch fixes the versions used on older
powerpc64 processors.  As was done with the round implementations some
time ago, the save of floating-point state is moved after the first
floating-point operation on the input to ensure that any "invalid"
exception from signaling NaN input is included in the saved state, and
then the whole state gets restored rather than just the rounding mode.

This has no effect on configurations using the power5+ code, since
such processors can do these operations with a single instruction (and
those instructions do not set "inexact", so are correct for TS 18661-1
semantics).

Tested for powerpc64.

	[BZ #15479]
	* sysdeps/powerpc/powerpc64/fpu/s_ceil.S (__ceil): Move save of
	floating-point state after first floating-point operation on
	input.  Restore full floating-point state instead of just rounding
	mode.
	* sysdeps/powerpc/powerpc64/fpu/s_ceilf.S (__ceilf): Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_floor.S (__floor): Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_floorf.S (__floorf): Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_trunc.S (__trunc): Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_truncf.S (__truncf): Likewise.
2016-05-25 17:42:22 +00:00
Joseph Myers f7a9f785e5 Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
Joseph Myers 21378ae0d3 Fix powerpc round, roundf spurious "inexact" (bug 19238).
The powerpc hard-float round and roundf functions, both 32-bit and
64-bit, raise spurious "inexact" exceptions for integer arguments from
adding 0.5 and rounding to integer toward zero.

Since these functions already save and restore the rounding mode, it's
natural to make them restore the full floating-point state instead to
fix this bug, which this patch does.  The save of the state is moved
after the first floating-point operation on the input so that any
"invalid" exceptions from signaling NaN inputs are properly
preserved.  As a consequence of this approach to the fix, "inexact"
for noninteger arguments (disallowed by TS 18661-1 but not by C99/C11,
see bug 15479) is also avoided for these implementations; this is
*not* a general fix for bug 15479 since plenty of other
implementations of various functions still raise spurious "inexact"
for noninteger arguments.

This issue and fix do not apply to builds using power5+ versions of
round and roundf, which use the frin instruction and avoid "inexact"
exceptions that way.

This patch should get hard-float powerpc32 and powerpc64 (default
function implementations) back to a state where test-float and
test-double will pass after ulps regeneration.

Tested for powerpc32 and powerpc64.

	[BZ #15479]
	[BZ #19238]
	* sysdeps/powerpc/powerpc32/fpu/s_round.S (__round): Save
	floating-point state after first operation on input.  Restore full
	state rather than just rounding mode.
	* sysdeps/powerpc/powerpc32/fpu/s_roundf.S (__roundf): Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_round.S (__round): Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_roundf.S (__roundf): Likewise.
2015-11-12 19:00:06 +00:00
Joseph Myers 32b71ad358 Fix powerpc64 lround, lroundf, llround, llroundf spurious "inexact" exceptions (bug 19235).
Similar to bug 19134 for powerpc32, the powerpc64 implementations of
lround, lroundf, llround, llroundf can raise spurious "inexact"
exceptions for integer arguments from adding 0.5 then converting to
integer (this does not apply to the power5+ version for double, which
uses the frin instruction which is defined never to raise "inexact"; I
don't know why power5+ doesn't use that version for float as well).

This patch fixes the bug in a similar way to the powerpc32 bug, by
testing for integers (adding and subtracting 2^52 and comparing with
the value before that addition and subtraction) and not adding 0.5 in
that case.

The powerpc maintainers may wish to look at making power5+ / power6x /
power8 use frin for float lround / llround as well as for double,
unless there's some reason I've missed that this isn't beneficial.

Tested for powerpc64.

	[BZ #19235]
	* sysdeps/powerpc/powerpc64/fpu/s_llround.S (__llround): Do not
	add 0.5 to integer arguments.
	* sysdeps/powerpc/powerpc64/fpu/s_llroundf.S (__llroundf):
	Likewise.
	(.LC2): New object.
2015-11-12 16:24:00 +00:00
Joseph Myers 71d1b0166b Fix powerpc nearbyint wrongly clearing "inexact" and leaving traps disabled (bug 19228).
Similar to bug 15491 recently fixed for x86_64 / x86, the powerpc
(both powerpc32 and powerpc64) hard-float implementations of
nearbyintf and nearbyint wrongly clear an "inexact" exception that was
raised before the function was called; this shows up as failure of the
test math/test-nearbyint-except added when that bug was fixed.  They
also wrongly leave traps on "inexact" disabled if they were enabled
before the function was called.

This patch fixes the bugs similar to how the x86 bug was fixed: saving
and restoring the whole floating-point state, both to restore the
original "inexact" flag state and to restore the original state of
whether traps on "inexact" were enabled.  Because there's a convenient
point in the powerpc implementations to save state after any sNaN
arguments will have raised "invalid" but before "inexact" traps need
to be disabled, no special handling for "invalid" is needed as in the
x86 version.

Tested for powerpc64 and powerpc32, where it fixes the
math/test-nearbyint-except failure as well as fixing the new test
math/test-nearbyint-except-2 added by this patch.  Also tested for
x86_64 and x86 that the new test passes.

If powerpc experts see a more efficient way of doing this
(e.g. instruction positioning that's better for pipelines on typical
processors) then of course followups optimizing the fix are welcome.

	[BZ #19228]
	* sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S (__nearbyint): Save
	and restore full floating-point state.
	* sysdeps/powerpc/powerpc32/fpu/s_nearbyintf.S (__nearbyintf):
	Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S (__nearbyint):
	Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S (__nearbyintf):
	Likewise.
	* math/test-nearbyint-except-2.c: New file.
	* math/Makefile (tests): Add test-nearbyint-except-2.
2015-11-11 00:06:09 +00:00
Adhemerval Zanella 08cee2a464 powerpc: Fix fsqrt build in libm [BZ#16576]
Some powerpc64 processors (e5500 core for instance) does not provide the
fsqrt instruction, however current check to use in math_private.h is
__WORDSIZE and _ARCH_PWR4 (ISA 2.02).  This is patch change it to use
the compiler flag _ARCH_PPCSQ (which is the same condition GCC uses to
decide whether to generate fsqrt instruction).

It fixes BZ#16576.
2015-01-28 05:59:16 -05:00
Joseph Myers b168057aaa Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
Siddhesh Poyarekar a109996ef9 Remove IS_IN_libm
Replace with IS_IN (libm). Generated code unchanged on x86_64.

        * include/math.h: Use IS_IN instead of IS_IN_libm.
        * sysdeps/alpha/fpu/s_copysign.c: Likewise.
        * sysdeps/ieee754/ldbl-128ibm/s_copysignl.c: Likewise.
        * sysdeps/ieee754/ldbl-128ibm/s_finitel.c: Likewise.
        * sysdeps/ieee754/ldbl-128ibm/s_fmal.c: Likewise.
        * sysdeps/ieee754/ldbl-128ibm/s_frexpl.c: Likewise.
        * sysdeps/ieee754/ldbl-128ibm/s_isinfl.c: Likewise.
        * sysdeps/ieee754/ldbl-128ibm/s_isnanl.c: Likewise.
        * sysdeps/ieee754/ldbl-128ibm/s_modfl.c: Likewise.
        * sysdeps/ieee754/ldbl-128ibm/s_scalbnl.c: Likewise.
        * sysdeps/ieee754/ldbl-128ibm/s_signbitl.c: Likewise.
        * sysdeps/ieee754/ldbl-64-128/s_copysignl.c: Likewise.
        * sysdeps/ieee754/ldbl-64-128/s_finitel.c: Likewise.
        * sysdeps/ieee754/ldbl-64-128/s_frexpl.c: Likewise.
        * sysdeps/ieee754/ldbl-64-128/s_isinfl.c: Likewise.
        * sysdeps/ieee754/ldbl-64-128/s_isnanl.c: Likewise.
        * sysdeps/ieee754/ldbl-64-128/s_modfl.c: Likewise.
        * sysdeps/ieee754/ldbl-64-128/s_scalbnl.c: Likewise.
        * sysdeps/ieee754/ldbl-64-128/s_signbitl.c: Likewise.
        * sysdeps/ieee754/ldbl-64-128/w_scalblnl.c: Likewise.
        * sysdeps/ieee754/ldbl-opt/s_copysign.c: Likewise.
        * sysdeps/ieee754/ldbl-opt/s_finite.c: Likewise.
        * sysdeps/ieee754/ldbl-opt/s_frexp.c: Likewise.
        * sysdeps/ieee754/ldbl-opt/s_isinf.c: Likewise.
        * sysdeps/ieee754/ldbl-opt/s_isnan.c: Likewise.
        * sysdeps/ieee754/ldbl-opt/s_ldexp.c: Likewise.
        * sysdeps/ieee754/ldbl-opt/s_ldexpl.c: Likewise.
        * sysdeps/ieee754/ldbl-opt/s_modf.c: Likewise.
        * sysdeps/ieee754/ldbl-opt/s_scalbln.c: Likewise.
        * sysdeps/ieee754/ldbl-opt/s_scalbn.c: Likewise.
        * sysdeps/powerpc/power5+/fpu/s_modf.c: Likewise.
        * sysdeps/powerpc/powerpc32/fpu/s_copysign.S: Likewise.
        * sysdeps/powerpc/powerpc32/fpu/s_copysignl.S: Likewise.
        * sysdeps/powerpc/powerpc32/fpu/s_isnan.S: Likewise.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysign.c: Likewise.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite.c: Likewise.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinf.c: Likewise.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan.c: Likewise.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_modf.c: Likewise.
        * sysdeps/powerpc/powerpc32/power5/fpu/s_isnan.S: Likewise.
        * sysdeps/powerpc/powerpc32/power6/fpu/s_copysign.S: Likewise.
        * sysdeps/powerpc/powerpc32/power6/fpu/s_isnan.S: Likewise.
        * sysdeps/powerpc/powerpc32/power7/fpu/s_finite.S: Likewise.
        * sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S: Likewise.
        * sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysign.c: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite.c: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf.c: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan.c: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/s_modf.c: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/s_copysign.S: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/s_copysignl.S: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/s_isnan.S: Likewise.
        * sysdeps/powerpc/powerpc64/power5/fpu/s_isnan.S: Likewise.
        * sysdeps/powerpc/powerpc64/power6/fpu/s_copysign.S: Likewise.
        * sysdeps/powerpc/powerpc64/power6/fpu/s_isnan.S: Likewise.
        * sysdeps/powerpc/powerpc64/power6x/fpu/s_isnan.S: Likewise.
        * sysdeps/powerpc/powerpc64/power7/fpu/s_finite.S: Likewise.
        * sysdeps/powerpc/powerpc64/power7/fpu/s_isinf.S: Likewise.
        * sysdeps/powerpc/powerpc64/power7/fpu/s_isnan.S: Likewise.
        * sysdeps/powerpc/powerpc64/power8/fpu/s_finite.S: Likewise.
        * sysdeps/powerpc/powerpc64/power8/fpu/s_isinf.S: Likewise.
        * sysdeps/powerpc/powerpc64/power8/fpu/s_isnan.S: Likewise.
        * sysdeps/sparc/sparc32/fpu/s_signbitl.S: Likewise.
        * sysdeps/sparc/sparc32/sparcv9/fpu/s_isnan.S: Likewise.
        * sysdeps/unix/sysv/linux/alpha/fraiseexcpt.S: Likewise.
2014-11-24 11:41:47 +05:30
Adhemerval Zanella af121e371d PowerPC: Fix multiarch hypotf PPC64 path
This patch moves the hypotf multiarch implementation to correct path.
2014-05-19 18:06:40 -05:00
Alan Modra c859b32e9d Fix s_copysign stack temp for PowerPC64 ELFv2
[BZ #16786]
	* sysdeps/powerpc/powerpc64/fpu/s_copysign.S: Don't trash stack.
2014-04-01 14:10:22 +10:30
Adhemerval Zanella c7de502503 PowerPC: remove wrong roundl implementation for PowerPC64
The roundl assembly implementation
(sysdeps/powerpc/powerpc64/fpu/s_roundl.S)
returns wrong results for some inputs where first double is a exact
integer and the precision is determined by second long double.

Checking on implementation comments and history, I am very confident the
assembly implementation was based on a version before commit
5c68d40169 that fixes BZ#2423 (Errors in
long double (ldbl-128ibm) rounding functions in glibc-2.4).

By just removing the implementation and make the build select
sysdeps/ieee754/ldbl-128ibm/s_roundl.c instead fixes the failing math.

This fixes 16707.
2014-03-14 12:54:47 -05:00
Adhemerval Zanella 98fb27a373 PowerPC: remove wrong nearbyintl implementation for PPC64
The nearbyintl assembly implementation
(sysdeps/powerpc/powerpc64/fpu/s_nearbyintl.S)
returns wrong results for some inputs where first double is a exact
integer and the precision is determined by second long double.

Checking on implementation comments and history, I am very confident the
assembly implementation was based on a version before commit
5c68d40169 that fixes BZ#2423 (Errors in
long double (ldbl-128ibm) rounding functions in glibc-2.4).

By just removing the implementation and make the build select
sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c instead fixes the failing
math.

Fixes BZ#16706.
2014-03-14 12:54:47 -05:00
Adhemerval Zanella 374f7f6121 PowerPC: remove wrong ceill implementation for PowerPC64
The ceill assembly implementation (sysdeps/powerpc/powerpc64/fpu/s_ceill.S)
returns wrong results for some inputs where first double is a exact
integer and the precision is determined by second long double.

Checking on implementation comments and history, I am very confident the
assembly implementation was based on a version before commit
5c68d40169 that fixes BZ#2423 (Errors in
long double (ldbl-128ibm) rounding functions in glibc-2.4).

By just removing the implementation and make the build select
sysdeps/ieee754/ldbl-128ibm/s_ceill.c instead fixes the failing math.

Fixes BZ#16701.
2014-03-14 12:54:47 -05:00
Adhemerval Zanella fe13a20c37 PowerPC: llround/llroundf POWER8 optimization
This patch add a optimized llround/llroundf implementation for POWER8
using the new Move From VSR Doubleword instruction to gains some
cycles from FP to GRP register move.
2014-02-27 12:58:33 -06:00
Adhemerval Zanella 1ad8950a3e PowerPC: llrint/llrintf POWER8 optimization
This patch add a optimized llrint/llrintf implementation for POWER8
using the new Move From VSR Doubleword instruction to gains some
cycles from FP to GRP register move.
2014-02-27 12:58:33 -06:00