X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler%2Fx86-64%2Fmove.lisp;h=7872710c01304c7b84894f239e789c25c9a79816;hb=18775b5e3c9a75f5301e09ddef649f2f35ab9752;hp=be974f27dd43c7ea237ddc4399b218df78c65df9;hpb=7deecae2d959173eda6a153d490c752c32050a9e;p=sbcl.git diff --git a/src/compiler/x86-64/move.lisp b/src/compiler/x86-64/move.lisp index be974f2..7872710 100644 --- a/src/compiler/x86-64/move.lisp +++ b/src/compiler/x86-64/move.lisp @@ -290,9 +290,10 @@ (:generator 1 (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 :qword :index x - :scale (ash 1 n-fixnum-tag-bits)))) + (if (= n-fixnum-tag-bits 1) + (inst lea y (make-ea :qword :base x :index x)) + (inst lea y (make-ea :qword :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) @@ -347,15 +348,20 @@ (:generator 20 (aver (not (location= x y))) (let ((done (gen-label))) - (inst mov y #.(ash lowtag-mask n-positive-fixnum-bits)) + (inst mov y #.(ash (1- (ash 1 (1+ n-fixnum-tag-bits))) + n-positive-fixnum-bits)) ;; 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 y) - ;; Faster but bigger then SHL Y 4. The cost of doing this - ;; speculatively should be noise compared to bignum consing if - ;; that is needed and saves one branch. - (inst lea y (make-ea :qword :index x :scale (ash 1 n-fixnum-tag-bits))) + ;; Using LEA is faster but bigger than MOV+SHL; it also doesn't + ;; twiddle the sign flag. The cost of doing this speculatively + ;; should be noise compared to bignum consing if that is needed + ;; and saves one branch. + (if (= n-fixnum-tag-bits 1) + (inst lea y (make-ea :qword :base x :index x)) + (inst lea y (make-ea :qword :index x + :scale (ash 1 n-fixnum-tag-bits)))) (inst jmp :z done) (inst mov y x) (inst lea temp-reg-tn