[cmucl-commit] [git] CMU Common Lisp branch master updated. snapshot-2012-03-7-g26419b3

Raymond Toy rtoy at common-lisp.net
Thu Mar 29 04:14:19 UTC 2012


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMU Common Lisp".

The branch, master has been updated
       via  26419b3ce542bb406d08585c051a1dc97ba208fb (commit)
       via  bd6f5eacbbf9869a0a69973d50d14577c9bfb3cc (commit)
      from  b08f245dbb9de963ca05142bb20d8fd27071a343 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 26419b3ce542bb406d08585c051a1dc97ba208fb
Author: Raymond Toy <toy.raymond at gmail.com>
Date:   Wed Mar 28 21:14:12 2012 -0700

    Add comments, clean up code a little.

diff --git a/src/contrib/packed-sse2/packed-sse2.lisp b/src/contrib/packed-sse2/packed-sse2.lisp
index c3b9668..4d8de08 100644
--- a/src/contrib/packed-sse2/packed-sse2.lisp
+++ b/src/contrib/packed-sse2/packed-sse2.lisp
@@ -9,7 +9,11 @@
 
 ;; SSE2 Packed operations.
 ;;
-;; We use (complex double-float) variables to hold the packed values.
+;; We use (complex double-float) variables to hold the packed values,
+;; including packed doubles and packed singles.  For convenience, use
+;; sse2-setpd or sse2-setps to initialize the packed variables with
+;; the given scalar values.  To extract the individual components of
+;; the packed values, use sse2-getpd or sse2-getps.
 
 (in-package #:vm)
 
@@ -128,47 +132,51 @@
 
 (declaim (inline sse2-shufpd sse2-shufps))
 
-(defun sse2-shufpd (x y i)
+;; This needs better documentation.  I (rtoy) can never remember what
+;; the magic I values actually do.
+(defun sse2-shufpd (dst src i)
   "Shuffle packed doubles in X and Y according to I."
-  (declare (type (complex double-float) x y)
+  (declare (type (complex double-float) dst src)
 	   (type (unsigned-byte 2) i))
   (ecase i
     (0
-     (%sse2-shufpd x y 0))
+     (%sse2-shufpd dst src 0))
     (1
-     (%sse2-shufpd x y 1))
+     (%sse2-shufpd dst src 1))
     (2
-     (%sse2-shufpd x y 2))
+     (%sse2-shufpd dst src 2))
     (3
-     (%sse2-shufpd x y 3))))
+     (%sse2-shufpd dst src 3))))
 
-(defun sse2-shufps (x y i)
+(defun sse2-shufps (dst src i)
   "Shuffle packed singles in X and Y according to I."
-  (declare (type (complex double-float) x y)
+  (declare (type (complex double-float) dst src)
 	   (type (unsigned-byte 4) i))
   (ecase i
     (0
-     (%sse2-shufps x y 0))
+     (%sse2-shufps dst src 0))
     (1
-     (%sse2-shufps x y 1))
+     (%sse2-shufps dst src 1))
     (2
-     (%sse2-shufps x y 2))
+     (%sse2-shufps dst src 2))
     (3
-     (%sse2-shufps x y 3))
+     (%sse2-shufps dst src 3))
     (4
-     (%sse2-shufps x y 4))
+     (%sse2-shufps dst src 4))
     (5
-     (%sse2-shufps x y 5))
+     (%sse2-shufps dst src 5))
     (6
-     (%sse2-shufps x y 6))
+     (%sse2-shufps dst src 6))
     (7
-     (%sse2-shufps x y 7))))
+     (%sse2-shufps dst src 7))))
 
 ;; x is the high part and y is the low part.
 (declaim (inline sse2-setpd sse2-getpd sse2-setps sse2-getps))
 (defun sse2-setpd (x y)
   "Create a packed double with X in the high part and Y in the low part"
   (declare (type double-float x y))
+  ;; Complex double-floats store the real part in the low half of the
+  ;; sse2 register.
   (complex y x))
 
 (defun sse2-getpd (pd)
@@ -185,7 +193,12 @@
   (flet ((pack-singles-to-double (hi lo)
 	   (let ((hi-bits (single-float-bits hi))
 		 (lo-bits (single-float-bits lo)))
+	     ;; Create a double-float where the most significant 32
+	     ;; bits contain the hi float and the low 32-bits contain
+	     ;; the low float.
 	     (make-double-float hi-bits (logand #xffffffff lo-bits)))))
+    ;; Pack the singles into a double and the pack the two doubles
+    ;; into a (complex double-float).
     (sse2-setpd (pack-singles-to-double x3 x2)
 		(pack-singles-to-double x1 x0))))
 

commit bd6f5eacbbf9869a0a69973d50d14577c9bfb3cc
Author: Raymond Toy <toy.raymond at gmail.com>
Date:   Wed Mar 28 21:11:18 2012 -0700

    Microoptimization:  (logand x #xffffffff) can be just a register move
    without and'ing.  (If x is a signed-byte 32.)

diff --git a/src/compiler/x86/arith.lisp b/src/compiler/x86/arith.lisp
index 96b480e..69d3426 100644
--- a/src/compiler/x86/arith.lisp
+++ b/src/compiler/x86/arith.lisp
@@ -348,8 +348,18 @@
 (define-vop (fast-logand-c/signed-unsigned=>unsigned
 	     fast-logand-c/unsigned=>unsigned)
   (:args (x :target r :scs (signed-reg signed-stack)))
-  (:arg-types signed-num (:constant (unsigned-byte 32))))
-
+  (:arg-types signed-num (:constant (unsigned-byte 32)))
+  (:generator 1
+    (cond ((and (= y #xffffffff)
+		(sc-is x signed-reg))
+	   ;; Just move x to the result if we're and'ing with all
+	   ;; ones, which doesn't change the bits.
+	   (unless (location= x r)
+	     (move r x)))
+	  (t
+	   (move r x)
+	   (inst and r y)))))
+	   
 (define-vop (fast-logand/unsigned-signed=>unsigned
 	     fast-logand/unsigned=>unsigned)
   (:args (x :target r :scs (unsigned-reg)

-----------------------------------------------------------------------

Summary of changes:
 src/compiler/x86/arith.lisp              |   14 +++++++-
 src/contrib/packed-sse2/packed-sse2.lisp |   47 +++++++++++++++++++-----------
 2 files changed, 42 insertions(+), 19 deletions(-)


hooks/post-receive
-- 
CMU Common Lisp


More information about the cmucl-commit mailing list