From 17ba9560a86774392eed4e94896115865efafe13 Mon Sep 17 00:00:00 2001 From: Stas Boukarev Date: Mon, 9 Sep 2013 19:54:05 +0400 Subject: [PATCH] Micro-optimize move-immediate on x86-64. Use XOR X, X when the immediate is 0. --- src/compiler/x86-64/move.lisp | 8 ++++---- src/compiler/x86-64/static-fn.lisp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) 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) -- 1.7.10.4