(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))
(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))
(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
(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
(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))
(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))
(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))
(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))
(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)
(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)
;;; 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"