Micro-optimize LENGTH/LIST and VALUES-LIST on x86-64 for code size.
authorLutz Euler <lutz.euler@freenet.de>
Tue, 17 Apr 2012 16:26:48 +0000 (18:26 +0200)
committerLutz Euler <lutz.euler@freenet.de>
Tue, 17 Apr 2012 16:26:48 +0000 (18:26 +0200)
As already common in several other places prefer a 32-bit temporary over
a 64-bit one for type checking in these VOPs to possibly spare a REX
prefix.

src/compiler/x86-64/subprim.lisp
src/compiler/x86-64/values.lisp

index 1f44f03..b30b3d1 100644 (file)
@@ -18,7 +18,7 @@
   (:translate length)
   (:args (object :scs (descriptor-reg control-stack) :target ptr))
   (:arg-types list)
-  (:temporary (:sc unsigned-reg :offset eax-offset) eax)
+  (:temporary (:sc dword-reg :offset eax-offset) eax)
   (:temporary (:sc descriptor-reg :from (:argument 0)) ptr)
   (:results (count :scs (any-reg)))
   (:result-types positive-fixnum)
@@ -43,7 +43,7 @@
     (inst jmp :e DONE)
     ;; Otherwise, check to see whether we hit the end of a dotted list. If
     ;; not, loop back for more.
-    (move eax ptr)
+    (move eax (make-dword-tn ptr))
     (inst and al-tn lowtag-mask)
     (inst cmp al-tn list-pointer-lowtag)
     (inst jmp :e LOOP)
index 0ea0535..658815f 100644 (file)
@@ -76,7 +76,7 @@
             (count :scs (any-reg)))
   (:temporary (:sc descriptor-reg :from (:argument 0) :to (:result 1)) list)
   (:temporary (:sc descriptor-reg :to (:result 1)) nil-temp)
-  (:temporary (:sc unsigned-reg :offset rax-offset :to (:result 1)) rax)
+  (:temporary (:sc dword-reg :offset eax-offset :to (:result 1)) eax)
   (:vop-var vop)
   (:save-p :compute-only)
   (:generator 0
@@ -89,7 +89,7 @@
     (inst jmp :e DONE)
     (pushw list cons-car-slot list-pointer-lowtag)
     (loadw list list cons-cdr-slot list-pointer-lowtag)
-    (inst mov rax list)
+    (inst mov eax (make-dword-tn list))
     (inst and al-tn lowtag-mask)
     (inst cmp al-tn list-pointer-lowtag)
     (inst jmp :e LOOP)