From 187d987edee54378c260c41b113e5cc99454e146 Mon Sep 17 00:00:00 2001
From: Raymond Toy <toy.raymond@gmail.com>
Date: Sat, 23 Jan 2016 14:31:09 -0800
Subject: [PATCH] Use SSE2 instructions for MAKE-DOUBLE-FLOAT

Instead of storing the high and low words to memory and then loading
it into the double-reg, use SSE2 instructions to directly create the
double-float from the high and low words.
---
 src/compiler/x86/float-sse2.lisp | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/src/compiler/x86/float-sse2.lisp b/src/compiler/x86/float-sse2.lisp
index 876b19d93..741d3c5e8 100644
--- a/src/compiler/x86/float-sse2.lisp
+++ b/src/compiler/x86/float-sse2.lisp
@@ -1178,21 +1178,22 @@
            (inst movd res bits)))))))
 
 (define-vop (make-double-float)
-  (:args (hi-bits :scs (signed-reg))
-	 (lo-bits :scs (unsigned-reg)))
+  (:args (hi-bits :scs (signed-reg)
+		  :load-if (not (sc-is hi-bits signed-stack)))
+	 (lo-bits :scs (unsigned-reg)
+		  :load-if (not (sc-is lo-bits signed-stack))))
   (:results (res :scs (double-reg)))
-  (:temporary (:sc double-stack) temp)
   (:arg-types signed-num unsigned-num)
   (:result-types double-float)
   (:translate make-double-float)
+  (:temporary (:sc double-reg) temp)
   (:policy :fast-safe)
   (:vop-var vop)
-  (:generator 2
-    (let ((offset (1+ (tn-offset temp))))
-      (storew hi-bits ebp-tn (- offset))
-      (storew lo-bits ebp-tn (- (1+ offset)))
-      (inst movsd res (make-ea :dword :base ebp-tn
-			    :disp (- (* (1+ offset) word-bytes)))))))
+  (:generator 4
+    (inst movd temp hi-bits)
+    (inst psllq temp 32)
+    (inst movd res lo-bits)
+    (inst orpd res temp)))
 
 
 (define-vop (single-float-bits)
-- 
GitLab