summary refs log tree commit diff
path: root/sysdeps/x86_64/fpu
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2011-10-08 10:18:26 -0400
committerUlrich Drepper <drepper@gmail.com>2011-10-08 10:18:26 -0400
commit7edb55ce06ab1fa716a062cd1cb6682585bb449d (patch)
tree3fed82e7c3f86ac57f3e9d6f314044b7dbdb8d03 /sysdeps/x86_64/fpu
parent187da0aedcd9d0a2fb34477bef41549681ba1273 (diff)
downloadglibc-7edb55ce06ab1fa716a062cd1cb6682585bb449d.tar.gz
glibc-7edb55ce06ab1fa716a062cd1cb6682585bb449d.tar.xz
glibc-7edb55ce06ab1fa716a062cd1cb6682585bb449d.zip
Optimize use of isnan, isinf, finite
Diffstat (limited to 'sysdeps/x86_64/fpu')
-rw-r--r--sysdeps/x86_64/fpu/math_private.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/sysdeps/x86_64/fpu/math_private.h b/sysdeps/x86_64/fpu/math_private.h
index 4be753654a..37357d317a 100644
--- a/sysdeps/x86_64/fpu/math_private.h
+++ b/sysdeps/x86_64/fpu/math_private.h
@@ -56,3 +56,24 @@ do {								\
 } while (0)
 
 #endif
+
+#define __isnan(d) \
+  ({ long int __di; EXTRACT_WORDS64 (__di, d);				      \
+     (__di & 0x7fffffffffffffffl) > 0x7ff0000000000000l; })
+#define __isnanf(d) \
+  ({ int __di; GET_FLOAT_WORD (__di, d);				      \
+     (__di & 0x7fffffff) > 0x7f800000; })
+
+#define __isinf_ns(d) \
+  ({ long int __di; EXTRACT_WORDS64 (__di, d);				      \
+     (__di & 0x7fffffffffffffffl) == 0x7ff0000000000000l; })
+#define __isinf_nsf(d) \
+  ({ int __di; GET_FLOAT_WORD (__di, d);				      \
+     (__di & 0x7fffffff) == 0x7f800000; })
+
+#define __finite(d) \
+  ({ long int __di; EXTRACT_WORDS64 (__di, d);				      \
+     (__di & 0x7fffffffffffffffl) < 0x7ff0000000000000l; })
+#define __finitef(d) \
+  ({ int __di; GET_FLOAT_WORD (__di, d);				      \
+     (__di & 0x7fffffff) < 0x7f800000; })