0.8.13.35:
authorNathan Froyd <froydnj@cs.rice.edu>
Sat, 7 Aug 2004 02:24:48 +0000 (02:24 +0000)
committerNathan Froyd <froydnj@cs.rice.edu>
Sat, 7 Aug 2004 02:24:48 +0000 (02:24 +0000)
* SB!VM:WORD-LOGICAL-FOO transforms were being defined per-backend,
  when in reality they can be shared.  Make it so.
* The `length' slot in SB!VM:PRIM-SLOT-OBJECT wasn't being used;
  delete it, but retain the :LENGTH option in
  SB!VM:DEFINE-PRIMITIVE-OBJECT, because that *is* being used.
  (mostly to generate offsets for GENESIS header files)

src/compiler/alpha/arith.lisp
src/compiler/generic/vm-macs.lisp
src/compiler/generic/vm-tran.lisp
src/compiler/hppa/arith.lisp
src/compiler/mips/arith.lisp
src/compiler/ppc/arith.lisp
src/compiler/sparc/arith.lisp
src/compiler/x86-64/arith.lisp
src/compiler/x86/arith.lisp
version.lisp-expr

index d054afc..b39ba7b 100644 (file)
       (emit-label done)
       (move res result))))
 
-(define-source-transform word-logical-not (x)
-  `(logand (lognot (the (unsigned-byte 32) ,x)) #.(1- (ash 1 32))))
-
-(deftransform word-logical-and ((x y))
-  '(logand x y))
-
-(define-source-transform word-logical-nand (x y)
-  `(word-logical-not (word-logical-and ,x ,y)))
-
-(deftransform word-logical-or ((x y))
-  '(logior x y))
-
-(define-source-transform word-logical-nor (x y)
-  `(logand (lognor (the (unsigned-byte 32) ,x) (the (unsigned-byte 32) ,y))
-           #.(1- (ash 1 32))))
-
-(deftransform word-logical-xor ((x y))
-  '(logxor x y))
-
-(define-source-transform word-logical-eqv (x y)
-  `(logand (logeqv (the (unsigned-byte 32) ,x) (the (unsigned-byte 32) ,y))
-          #.(1- (ash 1 32))))
-
-(define-source-transform word-logical-orc1 (x y)
-  `(logand (logorc1 (the (unsigned-byte 32) ,x) (the (unsigned-byte 32) ,y))
-          #.(1- (ash 1 32))))
-
-(define-source-transform word-logical-orc2 (x y)
-  `(logand (logorc2 (the (unsigned-byte 32) ,x) (the (unsigned-byte 32) ,y))
-          #.(1- (ash 1 32))))
-
-(define-source-transform word-logical-andc1 (x y)
-  `(logandc1 (the (unsigned-byte 32) ,x) (the (unsigned-byte 32) ,y)))
-
-(define-source-transform word-logical-andc2 (x y)
-  `(logandc2 (the (unsigned-byte 32) ,x) (the (unsigned-byte 32) ,y)))
-
 (define-vop (shift-towards-someplace)
   (:policy :fast-safe)
   (:args (num :scs (unsigned-reg))
index ef031a9..66d399a 100644 (file)
                (remove-keywords (cddr options) keywords)))))
 
 (def!struct (prim-object-slot
-            (:constructor make-slot (name docs rest-p offset length options))
+            (:constructor make-slot (name docs rest-p offset options))
             (:make-load-form-fun just-dump-it-normally)
             (:conc-name slot-))
   (name nil :type symbol)
   (docs nil :type (or null simple-string))
   (rest-p nil :type (member t nil))
   (offset 0 :type fixnum)
-  (length 1 :type fixnum)
   (options nil :type list))
 
 (def!struct (primitive-object (:make-load-form-fun just-dump-it-normally))
@@ -79,7 +78,7 @@
                       (set-known nil set-known-p) set-trans
                       &allow-other-keys)
            (if (atom spec) (list spec) spec)
-         (slots (make-slot slot-name docs rest-p offset length
+         (slots (make-slot slot-name docs rest-p offset
                            (remove-keywords options
                                             '(:docs :rest-p :length))))
          (let ((offset-sym (symbolicate name "-" slot-name
index 29c5c06..6a3e942 100644 (file)
            (defknown ,name (integer (integer 0)) (unsigned-byte ,width)
                      (foldable flushable movable))
            (define-modular-fun-optimizer ash ((integer count) :width width)
-             (when (and (<= width 32)
+             (when (and (<= width ,width)
                         (constant-lvar-p count) ;?
                         (plusp (lvar-value count)))
                (cut-to-width integer width)
                ',name))
            (setf (gethash ',name *modular-versions*) `(ash ,',width)))))
-  #!-alpha (def sb!vm::ash-left-mod32 32)
-  #!+alpha (def sb!vm::ash-left-mod64 64))
+  #!+#.(cl:if (cl:= 32 sb!vm:n-word-bits) '(and) '(or))
+  (def sb!vm::ash-left-mod32 32)
+  #!+#.(cl:if (cl:= 64 sb!vm:n-word-bits) '(and) '(or))
+  (def sb!vm::ash-left-mod64 64))
+
+\f
+;;;; word-wise logical operations
+
+;;; These transforms assume the presence of modular arithmetic to
+;;; generate efficient code.
+
+(define-source-transform word-logical-not (x)
+  `(logand (lognot (the sb!vm:word ,x) #.(1- (ash 1 sb!vm:n-word-bits)))))
+
+(deftransform word-logical-and ((x y))
+  '(logand x y))
+
+(deftransform word-logical-nand ((x y))
+  '(logand (lognand x y) #.(1- (ash 1 sb!vm:n-word-bits))))
+
+(deftransform word-logical-or ((x y))
+  '(logior x y))
+
+(deftransform word-logical-nor ((x y))
+  '(logand (lognor x y) #.(1- (ash 1 sb!vm:n-word-bits))))
+
+(deftransform word-logical-xor ((x y))
+  '(logxor x y))
+
+(deftransform word-logical-eqv ((x y))
+  '(logand (logeqv x y) #.(1- (ash 1 sb!vm:n-word-bits))))
+
+(deftransform word-logical-orc1 ((x y))
+  '(logand (logorc1 x y) #.(1- (ash 1 sb!vm:n-word-bits))))
+
+(deftransform word-logical-orc2 ((x y))
+  '(logand (logorc2 x y) #.(1- (ash 1 sb!vm:n-word-bits))))
+
+(deftransform word-logical-andc1 ((x y))
+  '(logand (logandc1 x y) #.(1- (ash 1 sb!vm:n-word-bits))))
+
+(deftransform word-logical-andc2 ((x y))
+  '(logand (logandc2 x y) #.(1- (ash 1 sb!vm:n-word-bits))))
+
 \f
 ;;; There are two different ways the multiplier can be recoded. The
 ;;; more obvious is to shift X by the correct amount for each bit set
index 880be1f..dafcd2a 100644 (file)
 (define-source-transform lognor (x y)
   `(lognot (logior ,x y)))
    
-;;;; 32-bit logical operations
-
-(define-source-transform word-logical-not (x)
-  `(logand (lognot (the (unsigned-byte 32) ,x)) #.(1- (ash 1 32))))
-
-(deftransform word-logical-and ((x y))
-  '(logand x y))
-
-(define-source-transform word-logical-nand (x y)
-  `(word-logical-not (word-logical-and ,x ,y)))
-
-(deftransform word-logical-or ((x y))
-  '(logior x y))
-
-(define-source-transform word-logical-nor (x y)
-  `(logand (lognor (the (unsigned-byte 32) ,x) (the (unsigned-byte 32) ,y))
-           #.(1- (ash 1 32))))
-
-(deftransform word-logical-xor ((x y))
-  '(logxor x y))
-
-(define-source-transform word-logical-eqv (x y)
-  `(word-logical-not (word-logical-xor ,x ,y)))
-
-(define-source-transform word-logical-orc1 (x y)
-  `(word-logical-or (word-logical-not ,x) ,y))
-
-(define-source-transform word-logical-orc2 (x y)
-  `(word-logical-or ,x (word-logical-not ,y)))
-
-(deftransform word-logical-andc1 (x y)
-  '(logandc1 x y))
-
-(deftransform word-logical-andc2 (x y)
-  '(logandc2 x y))
-
 (define-vop (shift-towards-someplace)
   (:policy :fast-safe)
   (:args (num :scs (unsigned-reg))
index 41db1f6..61d6c29 100644 (file)
       (emit-label done)
       (move result res))))
 
-(define-source-transform word-logical-not (x)
-  `(logand (lognot (the (unsigned-byte 32) ,x)) #.(1- (ash 1 32))))
-
-(deftransform word-logical-and ((x y))
-  '(logand x y))
-
-(define-source-transform word-logical-nand (x y)
-  `(word-logical-not (word-logical-and ,x ,y)))
-
-(deftransform word-logical-or ((x y))
-  '(logior x y))
-
-(define-source-transform word-logical-nor (x y)
-  `(logand (lognor (the (unsigned-byte 32) ,x) (the (unsigned-byte 32) ,y))
-          #.(1- (ash 1 32))))
-
-(deftransform word-logical-xor ((x y))
-  '(logxor x y))
-
-(define-source-transform word-logical-eqv (x y)
-  `(word-logical-not (word-logical-xor ,x ,y)))
-
-(define-source-transform word-logical-orc1 (x y)
-  `(word-logical-or (word-logical-not ,x) ,y))
-
-(define-source-transform word-logical-orc2 (x y)
-  `(word-logical-or ,x (word-logical-not ,y)))
-
-(define-source-transform word-logical-andc1 (x y)
-  `(word-logical-and (word-logical-not ,x) ,y))
-
-(define-source-transform word-logical-andc2 (x y)
-  `(word-logical-and ,x (word-logical-not ,y)))
-
 (define-vop (shift-towards-someplace)
   (:policy :fast-safe)
   (:args (num :scs (unsigned-reg))
index 8141ec4..df34914 100644 (file)
       (emit-label done)
       (move result res))))
 
-(define-source-transform word-logical-not (x)
-  `(logand (lognot (the (unsigned-byte 32) ,x)) #.(1- (ash 1 32))))
-
-(deftransform word-logical-and ((x y))
-  '(logand x y))
-
-(deftransform word-logical-nand ((x y))
-  '(logand (lognand x y) #.(1- (ash 1 32))))
-
-(deftransform word-logical-or ((x y))
-  '(logior x y))
-
-(deftransform word-logical-nor ((x y))
-  '(logand (lognor x y) #.(1- (ash 1 32))))
-
-(deftransform word-logical-xor ((x y))
-  '(logxor x y))
-
-(deftransform word-logical-eqv ((x y))
-  '(logand (logeqv x y) #.(1- (ash 1 32))))
-
-(deftransform word-logical-orc1 ((x y))
-  '(logand (logorc1 x y) #.(1- (ash 1 32))))
-
-(deftransform word-logical-orc2 ((x y))
-  '(logand (logorc2 x y) #.(1- (ash 1 32))))
-
-(deftransform word-logical-andc1 ((x y))
-  '(logand (logandc1 x y) #.(1- (ash 1 32))))
-
-(deftransform word-logical-andc2 ((x y))
-  '(logand (logandc2 x y) #.(1- (ash 1 32))))
-
 (define-vop (shift-towards-someplace)
   (:policy :fast-safe)
   (:args (num :scs (unsigned-reg))
index c722d15..f1f8536 100644 (file)
       (emit-label done)
       (move result res))))
 
-(define-source-transform word-logical-not (x)
-  `(logand (lognot (the (unsigned-byte 32) ,x)) #.(1- (ash 1 32))))
-
-(deftransform word-logical-and ((x y))
-  '(logand x y))
-
-(deftransform word-logical-nand ((x y))
-  '(logand (lognand x y) #.(1- (ash 1 32))))
-
-(deftransform word-logical-or ((x y))
-  '(logior x y))
-
-(deftransform word-logical-nor ((x y))
-  '(logand (lognor x y) #.(1- (ash 1 32))))
-
-(deftransform word-logical-xor ((x y))
-  '(logxor x y))
-
-(deftransform word-logical-eqv ((x y))
-  '(logand (logeqv x y) #.(1- (ash 1 32))))
-
-(deftransform word-logical-orc1 ((x y))
-  '(logand (logorc1 x y) #.(1- (ash 1 32))))
-
-(deftransform word-logical-orc2 ((x y))
-  '(logand (logorc2 x y) #.(1- (ash 1 32))))
-
-(deftransform word-logical-andc1 ((x y))
-  '(logand (logandc1 x y) #.(1- (ash 1 32))))
-
-(deftransform word-logical-andc2 ((x y))
-  '(logand (logandc2 x y) #.(1- (ash 1 32))))
-
 (define-vop (shift-towards-someplace)
   (:policy :fast-safe)
   (:args (num :scs (unsigned-reg))
index 0ac6aee..f549575 100644 (file)
     (move result prev)
     (inst shrd result next :cl)))
 
-(define-source-transform word-logical-not (x)
-  `(logand (lognot (the (unsigned-byte 64) ,x)) #.(1- (ash 1 64))))
-
-(deftransform word-logical-and ((x y))
-  '(logand x y))
-
-(define-source-transform word-logical-nand (x y)
-  `(word-logical-not (word-logical-and ,x ,y)))
-
-(deftransform word-logical-or ((x y))
-  '(logior x y))
-
-(define-source-transform word-logical-nor (x y)
-  `(word-logical-not (word-logical-or ,x ,y)))
-
-(deftransform word-logical-xor ((x y))
-  '(logxor x y))
-
-(define-source-transform word-logical-eqv (x y)
-  `(word-logical-not (word-logical-xor ,x ,y)))
-
-(define-source-transform word-logical-orc1 (x y)
-  `(word-logical-or (word-logical-not ,x) ,y))
-
-(define-source-transform word-logical-orc2 (x y)
-  `(word-logical-or ,x (word-logical-not ,y)))
-
-(define-source-transform word-logical-andc1 (x y)
-  `(word-logical-and (word-logical-not ,x) ,y))
-
-(define-source-transform word-logical-andc2 (x y)
-  `(word-logical-and ,x (word-logical-not ,y)))
-
 ;;; Only the lower 6 bits of the shift amount are significant.
 (define-vop (shift-towards-someplace)
   (:policy :fast-safe)
index 76d39af..9e8e07e 100644 (file)
     (move result prev)
     (inst shrd result next :cl)))
 
-(define-source-transform word-logical-not (x)
-  `(logand (lognot (the (unsigned-byte 32) ,x)) #.(1- (ash 1 32))))
-
-(deftransform word-logical-and ((x y))
-  '(logand x y))
-
-(define-source-transform word-logical-nand (x y)
-  `(word-logical-not (word-logical-and ,x ,y)))
-
-(deftransform word-logical-or ((x y))
-  '(logior x y))
-
-(define-source-transform word-logical-nor (x y)
-  `(word-logical-not (word-logical-or ,x ,y)))
-
-(deftransform word-logical-xor ((x y))
-  '(logxor x y))
-
-(define-source-transform word-logical-eqv (x y)
-  `(word-logical-not (word-logical-xor ,x ,y)))
-
-(define-source-transform word-logical-orc1 (x y)
-  `(word-logical-or (word-logical-not ,x) ,y))
-
-(define-source-transform word-logical-orc2 (x y)
-  `(word-logical-or ,x (word-logical-not ,y)))
-
-(define-source-transform word-logical-andc1 (x y)
-  `(word-logical-and (word-logical-not ,x) ,y))
-
-(define-source-transform word-logical-andc2 (x y)
-  `(word-logical-and ,x (word-logical-not ,y)))
-
 ;;; Only the lower 5 bits of the shift amount are significant.
 (define-vop (shift-towards-someplace)
   (:policy :fast-safe)
index e0c261c..64ed6cb 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"0.8.13.34"
+"0.8.13.35"