diff options
author | Wilco Dijkstra <wdijkstr@arm.com> | 2018-03-15 17:57:03 +0000 |
---|---|---|
committer | Wilco Dijkstra <wdijkstr@arm.com> | 2018-03-15 19:21:35 +0000 |
commit | 1294b1892e19d70e9e4dca0a2f3e39497f262a42 (patch) | |
tree | cb9e404c7e1bb559c1a47ace05df8327695ef884 /math | |
parent | c429a8d8d63a12cac9754834f3a2667f7dbdb0fb (diff) | |
download | glibc-1294b1892e19d70e9e4dca0a2f3e39497f262a42.tar.gz glibc-1294b1892e19d70e9e4dca0a2f3e39497f262a42.tar.xz glibc-1294b1892e19d70e9e4dca0a2f3e39497f262a42.zip |
Add support for sqrt asm redirects
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.
Diffstat (limited to 'math')
-rw-r--r-- | math/w_sqrt_compat.c | 1 | ||||
-rw-r--r-- | math/w_sqrt_template.c | 1 | ||||
-rw-r--r-- | math/w_sqrtf_compat.c | 1 | ||||
-rw-r--r-- | math/w_sqrtl_compat.c | 1 |
4 files changed, 4 insertions, 0 deletions
diff --git a/math/w_sqrt_compat.c b/math/w_sqrt_compat.c index 7884d14633..e76a8079aa 100644 --- a/math/w_sqrt_compat.c +++ b/math/w_sqrt_compat.c @@ -16,6 +16,7 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ +#define NO_MATH_REDIRECT #include <math.h> #include <math_private.h> #include <math-svid-compat.h> diff --git a/math/w_sqrt_template.c b/math/w_sqrt_template.c index 52a21c0bf1..9c6ac75956 100644 --- a/math/w_sqrt_template.c +++ b/math/w_sqrt_template.c @@ -21,6 +21,7 @@ for each floating-point type. */ #if __USE_WRAPPER_TEMPLATE +# define NO_MATH_REDIRECT # include <errno.h> # include <fenv.h> # include <math.h> diff --git a/math/w_sqrtf_compat.c b/math/w_sqrtf_compat.c index 824ce0ed46..cad9b4ad77 100644 --- a/math/w_sqrtf_compat.c +++ b/math/w_sqrtf_compat.c @@ -16,6 +16,7 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ +#define NO_MATH_REDIRECT #include <math.h> #include <math_private.h> #include <math-svid-compat.h> diff --git a/math/w_sqrtl_compat.c b/math/w_sqrtl_compat.c index 56627a615d..16dda403b7 100644 --- a/math/w_sqrtl_compat.c +++ b/math/w_sqrtl_compat.c @@ -16,6 +16,7 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ +#define NO_MATH_REDIRECT #include <math.h> #include <math_private.h> #include <math-svid-compat.h> |