X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler%2Fx86-64%2Fmove.lisp;h=a5de78c2b817caab9a203673b904161ca99378c7;hb=085501b44cc1cbdd9e260139d30b383372ddd1b8;hp=53b16bfb7127d0a5dacd72077289f26edd1f56c2;hpb=9c9020f77ca14545b36795fcc86db2103cc8621e;p=sbcl.git diff --git a/src/compiler/x86-64/move.lisp b/src/compiler/x86-64/move.lisp index 53b16bf..a5de78c 100644 --- a/src/compiler/x86-64/move.lisp +++ b/src/compiler/x86-64/move.lisp @@ -11,6 +11,17 @@ (in-package "SB!VM") +(defun zeroize (tn) + (let ((offset (tn-offset tn))) + ;; Using the 32-bit instruction accomplishes the same thing and is + ;; one byte shorter. + (if (<= offset edi-offset) + (let ((tn (make-random-tn :kind :normal + :sc (sc-or-lose 'dword-reg) + :offset offset))) + (inst xor tn tn)) + (inst xor tn tn)))) + (define-move-fun (load-immediate 1) (vop x y) ((immediate) (any-reg descriptor-reg)) @@ -18,7 +29,7 @@ (etypecase val (integer (if (zerop val) - (inst xor y y) + (zeroize y) (inst mov y (fixnumize val)))) (symbol (load-symbol y val)) @@ -30,7 +41,7 @@ ((immediate) (signed-reg unsigned-reg)) (let ((val (tn-value x))) (if (zerop val) - (inst xor y y) + (zeroize y) (inst mov y val)))) (define-move-fun (load-character 1) (vop x y) @@ -80,7 +91,7 @@ (etypecase val (integer (if (and (zerop val) (sc-is y any-reg descriptor-reg)) - (inst xor y y) + (zeroize y) (move-immediate y (fixnumize val) temp))) (symbol (inst mov y (+ nil-value (static-symbol-offset val)))) @@ -134,7 +145,7 @@ (let ((val (tn-value x))) (etypecase val ((integer 0 0) - (inst xor y y)) + (zeroize y)) ((or (signed-byte 29) (unsigned-byte 29)) (inst mov y (fixnumize val))) (integer @@ -282,7 +293,6 @@ (aver (not (location= x y))) (let ((bignum (gen-label)) (done (gen-label))) - (inst mov y x) ;; We can't do the overflow check with SHL Y, 3, since the ;; state of the overflow flag is only reliably set when ;; shifting by 1. There used to be code here for doing "shift @@ -291,7 +301,7 @@ ;; we can just do a straight multiply instead of trying to ;; optimize it to a shift. This is both faster and smaller. ;; -- JES, 2006-07-08 - (inst imul y 8) + (inst imul y x (ash 1 n-fixnum-tag-bits)) (inst jmp :o bignum) (emit-label done)