1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 12:41:49 +01:00

Use "test reg,reg" in place of "cmp reg,0" for 64-bit operands. This was

previously only done for 32-bit and smaller operands.

llvm-svn: 42024
This commit is contained in:
Dan Gohman 2007-09-17 14:35:24 +00:00
parent 901cb2662d
commit b9449c9118
2 changed files with 13 additions and 0 deletions

View File

@ -1076,6 +1076,12 @@ def : Pat<(X86tailcall (i64 texternalsym:$dst)),
def : Pat<(X86tailcall GR64:$dst),
(CALL64r GR64:$dst)>;
// Comparisons.
// TEST R,R is smaller than CMP R,0
def : Pat<(X86cmp GR64:$src1, 0),
(TEST64rr GR64:$src1, GR64:$src1)>;
// {s|z}extload bool -> {s|z}extload byte
def : Pat<(sextloadi64i1 addr:$src), (MOVSX64rm8 addr:$src)>;
def : Pat<(zextloadi64i1 addr:$src), (MOVZX64rm8 addr:$src)>;

7
test/CodeGen/X86/cmp0.ll Normal file
View File

@ -0,0 +1,7 @@
; RUN: llvm-as < %s | llc -march=x86-64 | grep -v cmp
define i64 @foo(i64 %x) {
%t = icmp eq i64 %x, 0
%r = zext i1 %t to i64
ret i64 %r
}