summaryrefslogtreecommitdiff
path: root/libc/sysdeps/x86_64/fpu/math_private.h
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/x86_64/fpu/math_private.h')
-rw-r--r--libc/sysdeps/x86_64/fpu/math_private.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/libc/sysdeps/x86_64/fpu/math_private.h b/libc/sysdeps/x86_64/fpu/math_private.h
index 4febcbb5e..4be753654 100644
--- a/libc/sysdeps/x86_64/fpu/math_private.h
+++ b/libc/sysdeps/x86_64/fpu/math_private.h
@@ -18,4 +18,41 @@ 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 EXTRACT_WORDS64
+#define EXTRACT_WORDS64(i,d) \
+do { \
+ long int i_; \
+ asm ("movd %1, %0" : "=rm" (i_) : "x" (d)); \
+ (i) = i_; \
+} while (0)
+
+/* And the reverse. */
+#undef INSERT_WORDS64
+#define INSERT_WORDS64(d,i) \
+do { \
+ long int i_ = i; \
+ asm ("movd %1, %0" : "=x" (d) : "rm" (i_)); \
+} while (0)
+
+/* 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