aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/x86_64/fpu/math_private.h
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2009-08-24 14:52:49 -0700
committerUlrich Drepper <drepper@redhat.com>2009-08-24 14:52:49 -0700
commit9a1ea1525eb8e02ce20eb93d65dc880186731bf7 (patch)
tree4615ed06ce861d8837f182fcc2d679fb780d368d /sysdeps/x86_64/fpu/math_private.h
parent4a8f61a797e4c02c5ea7ab810af0816914ca5233 (diff)
downloadglibc-9a1ea1525eb8e02ce20eb93d65dc880186731bf7.tar
glibc-9a1ea1525eb8e02ce20eb93d65dc880186731bf7.tar.gz
glibc-9a1ea1525eb8e02ce20eb93d65dc880186731bf7.tar.bz2
glibc-9a1ea1525eb8e02ce20eb93d65dc880186731bf7.zip
Optimize float construction/extraction on x86-64.
Diffstat (limited to 'sysdeps/x86_64/fpu/math_private.h')
-rw-r--r--sysdeps/x86_64/fpu/math_private.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/sysdeps/x86_64/fpu/math_private.h b/sysdeps/x86_64/fpu/math_private.h
index 4febcbb5ec..8f4b792e77 100644
--- a/sysdeps/x86_64/fpu/math_private.h
+++ b/sysdeps/x86_64/fpu/math_private.h
@@ -18,4 +18,24 @@ do \
while (0)
#include <math/math_private.h>
+
+/* We can do a few things better on x86-64. */
+
+/* Direct movement of float into integer register. */
+#undef GET_FLOAT_WORD
+#define GET_FLOAT_WORD(i,d) \
+do { \
+ int i_; \
+ asm ("movd %1, %0" : "=rm" (i_) : "x" (d)); \
+ (i) = i_; \
+} while (0)
+
+/* And the reverse. */
+#undef SET_FLOAT_WORD
+#define SET_FLOAT_WORD(d,i) \
+do { \
+ int i_ = i; \
+ asm ("movd %1, %0" : "=x" (d) : "rm" (i_)); \
+} while (0)
+
#endif