Update of /cvsroot/sbcl/sbcl/src/compiler/x86
In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv18021/src/compiler/x86
Modified Files:
arith.lisp cell.lisp move.lisp system.lisp
Log Message:
1.0.33.20: MORE CONSTANTIFICATION
Use FIXNUM-TAG-MASK and N-FIXNUM-TAG-BITS where appropriate.
Index: arith.lisp
===================================================================
RCS file: /cvsroot/sbcl/sbcl/src/compiler/x86/arith.lisp,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -d -r1.58 -r1.59
--- arith.lisp 1 May 2009 18:17:46 -0000 1.58
+++ arith.lisp 17 Dec 2009 21:01:47 -0000 1.59
@@ -359,7 +359,7 @@
(:note "inline fixnum arithmetic")
(:generator 4
(move r x)
- (inst sar r 2)
+ (inst sar r n-fixnum-tag-bits)
(inst imul r y)))
(define-vop (fast-*-c/fixnum=>fixnum fast-safe-arith-op)
@@ -445,8 +445,9 @@
(inst cdq)
(inst idiv eax y)
(if (location= quo eax)
- (inst shl eax 2)
- (inst lea quo (make-ea :dword :index eax :scale 4)))
+ (inst shl eax n-fixnum-tag-bits)
+ (inst lea quo (make-ea :dword :index eax
+ :scale (ash 1 n-fixnum-tag-bits))))
(move rem edx)))
(define-vop (fast-truncate-c/fixnum=>fixnum fast-safe-arith-op)
@@ -471,8 +472,9 @@
(inst mov y-arg (fixnumize y))
(inst idiv eax y-arg)
(if (location= quo eax)
- (inst shl eax 2)
- (inst lea quo (make-ea :dword :index eax :scale 4)))
+ (inst shl eax n-fixnum-tag-bits)
+ (inst lea quo (make-ea :dword :index eax
+ :scale (ash 1 n-fixnum-tag-bits))))
(move rem edx)))
(define-vop (fast-truncate/unsigned=>unsigned fast-safe-arith-op)
@@ -1581,7 +1583,7 @@
(:result-types unsigned-num)
(:generator 1
(move digit fixnum)
- (inst sar digit 2)))
+ (inst sar digit n-fixnum-tag-bits)))
(define-vop (bignum-floor)
(:translate sb!bignum:%floor)
@@ -1617,7 +1619,7 @@
(:generator 1
(move res digit)
(when (sc-is res any-reg control-stack)
- (inst shl res 2))))
+ (inst shl res n-fixnum-tag-bits))))
(define-vop (digit-ashr)
(:translate sb!bignum:%ashr)
Index: cell.lisp
===================================================================
RCS file: /cvsroot/sbcl/sbcl/src/compiler/x86/cell.lisp,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- cell.lisp 8 May 2009 19:08:08 -0000 1.46
+++ cell.lisp 17 Dec 2009 21:01:47 -0000 1.47
@@ -504,7 +504,7 @@
(loadw tmp object 0 instance-pointer-lowtag)
(inst shr tmp n-widetag-bits)
(when (sc-is index any-reg)
- (inst shl tmp 2)
+ (inst shl tmp n-fixnum-tag-bits)
(inst sub tmp index))
(inst mov value (make-ea-for-raw-slot object index tmp 1))))
@@ -522,7 +522,7 @@
(loadw tmp object 0 instance-pointer-lowtag)
(inst shr tmp n-widetag-bits)
(when (sc-is index any-reg)
- (inst shl tmp 2)
+ (inst shl tmp n-fixnum-tag-bits)
(inst sub tmp index))
(inst mov (make-ea-for-raw-slot object index tmp 1) value)
(move result value)))
@@ -549,7 +549,7 @@
(loadw tmp object 0 instance-pointer-lowtag)
(inst shr tmp n-widetag-bits)
(when (sc-is index any-reg)
- (inst shl tmp 2)
+ (inst shl tmp n-fixnum-tag-bits)
(inst sub tmp index))
(inst xadd (make-ea-for-raw-slot object index tmp 1) diff :lock)
(move result diff)))
@@ -566,7 +566,7 @@
(loadw tmp object 0 instance-pointer-lowtag)
(inst shr tmp n-widetag-bits)
(when (sc-is index any-reg)
- (inst shl tmp 2)
+ (inst shl tmp n-fixnum-tag-bits)
(inst sub tmp index))
(with-empty-tn@...)
(inst fld (make-ea-for-raw-slot object index tmp 1)))))
@@ -585,7 +585,7 @@
(loadw tmp object 0 instance-pointer-lowtag)
(inst shr tmp n-widetag-bits)
(when (sc-is index any-reg)
- (inst shl tmp 2)
+ (inst shl tmp n-fixnum-tag-bits)
(inst sub tmp index))
(unless (zerop (tn-offset value))
(inst fxch value))
@@ -622,7 +622,7 @@
(loadw tmp object 0 instance-pointer-lowtag)
(inst shr tmp n-widetag-bits)
(when (sc-is index any-reg)
- (inst shl tmp 2)
+ (inst shl tmp n-fixnum-tag-bits)
(inst sub tmp index))
(with-empty-tn@...)
(inst fldd (make-ea-for-raw-slot object index tmp 2)))))
@@ -641,7 +641,7 @@
(loadw tmp object 0 instance-pointer-lowtag)
(inst shr tmp n-widetag-bits)
(when (sc-is index any-reg)
- (inst shl tmp 2)
+ (inst shl tmp n-fixnum-tag-bits)
(inst sub tmp index))
(unless (zerop (tn-offset value))
(inst fxch value))
@@ -679,7 +679,7 @@
(loadw tmp object 0 instance-pointer-lowtag)
(inst shr tmp n-widetag-bits)
(when (sc-is index any-reg)
- (inst shl tmp 2)
+ (inst shl tmp n-fixnum-tag-bits)
(inst sub tmp index))
(let ((real-tn (complex-single-reg-real-tn value)))
(with-empty-tn@... (real-tn)
@@ -702,7 +702,7 @@
(loadw tmp object 0 instance-pointer-lowtag)
(inst shr tmp n-widetag-bits)
(when (sc-is index any-reg)
- (inst shl tmp 2)
+ (inst shl tmp n-fixnum-tag-bits)
(inst sub tmp index))
(let ((value-real (complex-single-reg-real-tn value))
(result-real (complex-single-reg-real-tn result)))
@@ -758,7 +758,7 @@
(loadw tmp object 0 instance-pointer-lowtag)
(inst shr tmp n-widetag-bits)
(when (sc-is index any-reg)
- (inst shl tmp 2)
+ (inst shl tmp n-fixnum-tag-bits)
(inst sub tmp index))
(let ((real-tn (complex-double-reg-real-tn value)))
(with-empty-tn@... (real-tn)
@@ -781,7 +781,7 @@
(loadw tmp object 0 instance-pointer-lowtag)
(inst shr tmp n-widetag-bits)
(when (sc-is index any-reg)
- (inst shl tmp 2)
+ (inst shl tmp n-fixnum-tag-bits)
(inst sub tmp index))
(let ((value-real (complex-double-reg-real-tn value))
(result-real (complex-double-reg-real-tn result)))
Index: move.lisp
===================================================================
RCS file: /cvsroot/sbcl/sbcl/src/compiler/x86/move.lisp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- move.lisp 18 Jul 2009 17:53:00 -0000 1.19
+++ move.lisp 17 Dec 2009 21:01:47 -0000 1.20
@@ -178,12 +178,12 @@
:from (:argument 0) :to (:result 0) :target y) eax)
(:generator 4
(move eax x)
- (inst test al-tn 3)
+ (inst test al-tn fixnum-tag-mask)
(inst jmp :z fixnum)
(loadw y eax bignum-digits-offset other-pointer-lowtag)
(inst jmp done)
FIXNUM
- (inst sar eax 2)
+ (inst sar eax n-fixnum-tag-bits)
(move y eax)
DONE))
(define-move-vop move-to-word/integer :move
@@ -203,11 +203,12 @@
(cond ((and (sc-is x signed-reg unsigned-reg)
(not (location= x y)))
;; Uses 7 bytes, but faster on the Pentium
- (inst lea y (make-ea :dword :index x :scale 4)))
+ (inst lea y (make-ea :dword :index x
+ :scale (ash 1 n-fixnum-tag-bits))))
(t
;; Uses: If x is a reg 2 + 3; if x = y uses only 3 bytes
(move y x)
- (inst shl y 2)))))
+ (inst shl y n-fixnum-tag-bits)))))
(define-move-vop move-from-word/fixnum :move
(signed-reg unsigned-reg) (any-reg descriptor-reg))
@@ -251,10 +252,10 @@
;; The assembly routines test the sign flag from this one, so if
;; you change stuff here, make sure the sign flag doesn't get
;; overwritten before the CALL!
- (inst test x #.(ash lowtag-mask (- n-word-bits n-fixnum-tag-bits 1)))
+ (inst test x #.(ash lowtag-mask n-positive-fixnum-bits))
;; Faster but bigger then SHL Y 2. The cost of doing this speculatively
;; is noise compared to bignum consing if that is needed.
- (inst lea y (make-ea :dword :index x :scale 4))
+ (inst lea y (make-ea :dword :index x :scale (ash 1 n-fixnum-tag-bits)))
(inst jmp :z done)
(inst mov y x)
(inst call (make-fixup (ecase (tn-offset y)
Index: system.lisp
===================================================================
RCS file: /cvsroot/sbcl/sbcl/src/compiler/x86/system.lisp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- system.lisp 20 Sep 2008 03:09:58 -0000 1.27
+++ system.lisp 17 Dec 2009 21:01:47 -0000 1.28
@@ -44,7 +44,7 @@
(inst jmp :ne done)
;; Pick off fixnums.
- (inst and al-tn 3)
+ (inst and al-tn fixnum-tag-mask)
(inst jmp :e done)
;; must be an other immediate
@@ -142,7 +142,7 @@
(:results (res :scs (any-reg descriptor-reg) :from (:argument 0)))
(:generator 2
(move res val)
- (inst shl res (- n-widetag-bits 2))
+ (inst shl res (- n-widetag-bits n-fixnum-tag-bits))
(inst or res (sc-case type
(unsigned-reg type)
(immediate (tn-value type))))))
|