aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilco Dijkstra <Wilco.Dijkstra@arm.com>2021-12-01 11:08:14 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2021-12-13 10:08:46 -0300
commit2f44eef584a4c9650ce772258dedde902c00dae2 (patch)
tree807a3d4b53911625b224344a6ab032a6e684047e
parentecb94e958707d907327f164b95ae92320e0aab48 (diff)
downloadglibc-2f44eef584a4c9650ce772258dedde902c00dae2.zip
glibc-2f44eef584a4c9650ce772258dedde902c00dae2.tar.gz
glibc-2f44eef584a4c9650ce772258dedde902c00dae2.tar.bz2
math: Use fmin/fmax on hypot
It optimizes for architectures that provides fast builtins. Checked on aarch64-linux-gnu.
-rw-r--r--sysdeps/ieee754/dbl-64/e_hypot.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sysdeps/ieee754/dbl-64/e_hypot.c b/sysdeps/ieee754/dbl-64/e_hypot.c
index 6fedf0d..0bdab98 100644
--- a/sysdeps/ieee754/dbl-64/e_hypot.c
+++ b/sysdeps/ieee754/dbl-64/e_hypot.c
@@ -38,6 +38,7 @@
#include <math_private.h>
#include <math-underflow.h>
#include <math-narrow-eval.h>
+#include <math-use-builtins.h>
#include <libm-alias-finite.h>
#include "math_config.h"
@@ -95,8 +96,8 @@ __ieee754_hypot (double x, double y)
x = fabs (x);
y = fabs (y);
- double ax = x < y ? y : x;
- double ay = x < y ? x : y;
+ double ax = USE_FMAX_BUILTIN ? fmax (x, y) : (x < y ? y : x);
+ double ay = USE_FMIN_BUILTIN ? fmin (x, y) : (x < y ? x : y);
/* If ax is huge, scale both inputs down. */
if (__glibc_unlikely (ax > LARGE_VAL))