From 5b3933e2e404a538dcff7450196d5cbcccb7572d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Lindqvist?= Date: Fri, 20 May 2016 13:38:42 +0200 Subject: [PATCH] cpu.x86: xor rax, rax -> xor eax, eax The latter should be equivalent in all ways, but its encoding is one byte shorter. --- basis/cpu/x86/x86-tests.factor | 5 +++++ basis/cpu/x86/x86.factor | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/basis/cpu/x86/x86-tests.factor b/basis/cpu/x86/x86-tests.factor index 1786810047..5e61d3c34c 100644 --- a/basis/cpu/x86/x86-tests.factor +++ b/basis/cpu/x86/x86-tests.factor @@ -74,6 +74,11 @@ cpu x86.64? [ ] unit-test ] when +! %load-immediate +{ B{ 49 201 } } [ + [ RCX 0 %load-immediate ] B{ } make +] unit-test + ! %prologue { t } [ [ 2 cells %prologue ] B{ } make diff --git a/basis/cpu/x86/x86.factor b/basis/cpu/x86/x86.factor index 1a9af24b63..5462587280 100644 --- a/basis/cpu/x86/x86.factor +++ b/basis/cpu/x86/x86.factor @@ -61,7 +61,7 @@ M: x86 test-instruction? t ; M: x86 immediate-store? immediate-comparand? ; -M: x86 %load-immediate [ dup XOR ] [ MOV ] if-zero ; +M: x86 %load-immediate [ 32-bit-version-of dup XOR ] [ MOV ] if-zero ; M: x86 %load-reference [ swap 0 MOV rc-absolute-cell rel-literal ]