aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/x86_64/fpu/math_private.h
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2011-10-12 11:27:51 -0400
committerUlrich Drepper <drepper@gmail.com>2011-10-12 11:27:51 -0400
commit0ac5ae2335292908f39031b1ea9fe8edce433c0f (patch)
treef9d26c8abc0de39d18d4c13e70f6022cdc6b461f /sysdeps/x86_64/fpu/math_private.h
parenta843a204a3e8a0dd53584dad3668771abaec84ac (diff)
downloadglibc-0ac5ae2335292908f39031b1ea9fe8edce433c0f.zip
glibc-0ac5ae2335292908f39031b1ea9fe8edce433c0f.tar.gz
glibc-0ac5ae2335292908f39031b1ea9fe8edce433c0f.tar.bz2
Optimize libm
libm is now somewhat integrated with gcc's -ffinite-math-only option and lots of the wrapper functions have been optimized.
Diffstat (limited to 'sysdeps/x86_64/fpu/math_private.h')
-rw-r--r--sysdeps/x86_64/fpu/math_private.h25
1 files changed, 19 insertions, 6 deletions
diff --git a/sysdeps/x86_64/fpu/math_private.h b/sysdeps/x86_64/fpu/math_private.h
index 37357d3..523ec54 100644
--- a/sysdeps/x86_64/fpu/math_private.h
+++ b/sysdeps/x86_64/fpu/math_private.h
@@ -58,22 +58,35 @@ do { \
#endif
#define __isnan(d) \
- ({ long int __di; EXTRACT_WORDS64 (__di, d); \
+ ({ long int __di; EXTRACT_WORDS64 (__di, (double) d); \
(__di & 0x7fffffffffffffffl) > 0x7ff0000000000000l; })
#define __isnanf(d) \
- ({ int __di; GET_FLOAT_WORD (__di, d); \
+ ({ int __di; GET_FLOAT_WORD (__di, (float) d); \
(__di & 0x7fffffff) > 0x7f800000; })
#define __isinf_ns(d) \
- ({ long int __di; EXTRACT_WORDS64 (__di, d); \
+ ({ long int __di; EXTRACT_WORDS64 (__di, (double) d); \
(__di & 0x7fffffffffffffffl) == 0x7ff0000000000000l; })
#define __isinf_nsf(d) \
- ({ int __di; GET_FLOAT_WORD (__di, d); \
+ ({ int __di; GET_FLOAT_WORD (__di, (float) d); \
(__di & 0x7fffffff) == 0x7f800000; })
#define __finite(d) \
- ({ long int __di; EXTRACT_WORDS64 (__di, d); \
+ ({ long int __di; EXTRACT_WORDS64 (__di, (double) d); \
(__di & 0x7fffffffffffffffl) < 0x7ff0000000000000l; })
#define __finitef(d) \
- ({ int __di; GET_FLOAT_WORD (__di, d); \
+ ({ int __di; GET_FLOAT_WORD (__di, (float) d); \
(__di & 0x7fffffff) < 0x7f800000; })
+
+#define __ieee754_sqrt(d) \
+ ({ double __res; \
+ asm ("sqrtsd %1, %0" : "=x" (__res) : "xm" ((double) d)); \
+ __res; })
+#define __ieee754_sqrtf(d) \
+ ({ float __res; \
+ asm ("sqrtss %1, %0" : "=x" (__res) : "xm" ((float) d)); \
+ __res; })
+#define __ieee754_sqrtl(d) \
+ ({ long double __res; \
+ asm ("fsqrt" : "=t" (__res) : "0" ((long double) d)); \
+ __res; })