From: Stas Boukarev Date: Mon, 9 Sep 2013 15:54:05 +0000 (+0400) Subject: Micro-optimize move-immediate on x86-64. X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=17ba9560a86774392eed4e94896115865efafe13;p=sbcl.git Micro-optimize move-immediate on x86-64. Use XOR X, X when the immediate is 0. --- diff --git a/src/compiler/x86-64/move.lisp b/src/compiler/x86-64/move.lisp index dbf58ed..f10a953 100644 --- a/src/compiler/x86-64/move.lisp +++ b/src/compiler/x86-64/move.lisp @@ -103,9 +103,7 @@ (let ((val (tn-value x))) (etypecase val (integer - (if (and (zerop val) (sc-is y any-reg descriptor-reg)) - (zeroize y) - (move-immediate y (fixnumize val) temp))) + (move-immediate y (fixnumize val) temp)) (symbol (inst mov y (+ nil-value (static-symbol-offset val)))) (character @@ -127,7 +125,9 @@ ;; If target is a register, we can just mov it there directly ((and (tn-p target) (sc-is target signed-reg unsigned-reg descriptor-reg any-reg)) - (inst mov target val)) + (if (zerop val) + (zeroize target) + (inst mov target val))) ;; Likewise if the value is small enough. ((typep val '(signed-byte 32)) (inst mov target val)) diff --git a/src/compiler/x86-64/static-fn.lisp b/src/compiler/x86-64/static-fn.lisp index ec4809a..1f0c370 100644 --- a/src/compiler/x86-64/static-fn.lisp +++ b/src/compiler/x86-64/static-fn.lisp @@ -91,7 +91,7 @@ (inst enter n-word-bytes))) ,(if (zerop num-args) - '(inst xor ecx ecx) + '(zeroize ecx) `(inst mov ecx ,(fixnumize num-args))) (note-this-location vop :call-site)