about summary refs log tree commit diff
path: root/sysdeps/ieee754/dbl-64
diff options
context:
space:
mode:
authorVineet Gupta <vgupta@synopsys.com>2020-05-29 15:21:39 -0700
committerVineet Gupta <vgupta@synopsys.com>2020-06-03 10:23:22 -0700
commit3374868668e708581ca06e256f6122518c89a8ad (patch)
tree597e6a659674c190f2f388fa9f5e58b5c7cc0dfb /sysdeps/ieee754/dbl-64
parentba9f6ee9bb8a894c9e2fb715edf693dd157b420a (diff)
downloadglibc-3374868668e708581ca06e256f6122518c89a8ad.tar.gz
glibc-3374868668e708581ca06e256f6122518c89a8ad.tar.xz
glibc-3374868668e708581ca06e256f6122518c89a8ad.zip
ieee754: provide gcc builtins based generic sqrt functions
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Diffstat (limited to 'sysdeps/ieee754/dbl-64')
-rw-r--r--sysdeps/ieee754/dbl-64/e_sqrt.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sysdeps/ieee754/dbl-64/e_sqrt.c b/sysdeps/ieee754/dbl-64/e_sqrt.c
index d42a1a4eb6..518a8ae5cd 100644
--- a/sysdeps/ieee754/dbl-64/e_sqrt.c
+++ b/sysdeps/ieee754/dbl-64/e_sqrt.c
@@ -41,6 +41,7 @@
 #include <math_private.h>
 #include <fenv_private.h>
 #include <libm-alias-finite.h>
+#include <math-use-builtins.h>
 
 /*********************************************************************/
 /* An ultimate sqrt routine. Given an IEEE double machine number x   */
@@ -50,6 +51,10 @@
 double
 __ieee754_sqrt (double x)
 {
+#if USE_SQRT_BUILTIN
+  return __builtin_sqrt (x);
+#else
+  /* Use generic implementation.  */
   static const double
     rt0 = 9.99999999859990725855365213134618E-01,
     rt1 = 4.99999999495955425917856814202739E-01,
@@ -138,6 +143,7 @@ __ieee754_sqrt (double x)
 	return (x - x) / (x - x); /* sqrt(-ve)=sNaN */
       return 0x1p-256 * __ieee754_sqrt (x * 0x1p512);
     }
+#endif /* ! USE_SQRT_BUILTIN  */
 }
 #ifndef __ieee754_sqrt
 libm_alias_finite (__ieee754_sqrt, __sqrt)