This patch series cleans up the many uses of __ieee754_sqrt(f/l) in GLIBC. The goal is to enable GCC to do the inlining, and if this fails call the __ieee754_sqrt function. This is done by internally declaring sqrt with asm redirects. The compat symbols and sqrt wrappers need to disable the redirect. The redirect is also disabled if there are already redirects defined when using -ffinite-math-only.

All math functions (but not math tests, non-library code and libnldbl) are built with -fno-math-errno which means GCC will typically inline sqrt as a single instruction. This means targets are no longer forced to add a special inline for sqrt.

- include/math.h (sqrt): Declare with asm redirect. (sqrtf): Likewise. (sqrtl): Likewise. (sqrtf128): Likewise.

- Makeconfig: Add -fno-math-errno for libc/libm, but build testsuite, nonlib and libnldbl with -fmath-errno.

- math/w_sqrt_compat.c: Define NO_MATH_REDIRECT.

- math/w_sqrt_template.c: Likewise.

- math/w_sqrtf_compat.c: Likewise.

- math/w_sqrtl_compat.c: Likewise.

- sysdeps/i386/fpu/w_sqrt.c: Likewise.

- sysdeps/i386/fpu/w_sqrt_compat.c: Likewise.

- sysdeps/generic/math-type-macros-float128.h: Remove math.h and complex.h.

1294b1892e Add support for sqrt asm redirects

ChangeLog | 17 +++++++++++++++++

Makeconfig | 4 ++++

include/math.h | 15 +++++++++++++++

math/w_sqrt_compat.c | 1 +

math/w_sqrt_template.c | 1 +

math/w_sqrtf_compat.c | 1 +

math/w_sqrtl_compat.c | 1 +

sysdeps/generic/math-type-macros-float128.h | 3 ---

sysdeps/i386/fpu/w_sqrt.c | 1 +

sysdeps/i386/fpu/w_sqrt_compat.c | 1 +

10 files changed, 42 insertions(+), 3 deletions(-)

**Upstream:** sourceware.org

# Share

- Tweet

# Recent glibc Activity

- Add AArch64 HWCAPs from Linux 5.0.
*Joseph Myers* - localedata: Add Minguo calendar support to Taiwanese locales [BZ #24293]
*Felix Yan* - Remove obsolete, never-implemented XSI STREAMS declarations
*Florian Weimer* - resolv: Enable full ICMP errors for UDP DNS sockets [BZ #24047]
*Florian Weimer* - Add more spaces before '('.
*Joseph Myers*