diff options
author | Chris Lattner <sabre@nondot.org> | 2011-04-18 06:22:33 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2011-04-18 06:22:33 +0000 |
commit | 07add49a4ba2b296ad1da2aa0eeb51e0edbd7ec4 (patch) | |
tree | d28eafd23be9484fdcdc3f9ed0f7fbffdb1b6880 /llvm/test/CodeGen/X86/fast-isel-x86-64.ll | |
parent | 353fda159dca7a8d3d93546dadec862af8d7167f (diff) | |
download | bcm5719-llvm-07add49a4ba2b296ad1da2aa0eeb51e0edbd7ec4.tar.gz bcm5719-llvm-07add49a4ba2b296ad1da2aa0eeb51e0edbd7ec4.zip |
Implement major new fastisel functionality: the matcher can now handle immediates with
value constraints on them (when defined as ImmLeaf's). This is particularly important
for X86-64, where almost all reg/imm instructions take a i64immSExt32 immediate operand,
which has a value constraint. Before this patch we ended up iseling the examples into
such amazing code as:
movabsq $7, %rax
imulq %rax, %rdi
movq %rdi, %rax
ret
now we produce:
imulq $7, %rdi, %rax
ret
This dramatically shrinks the generated code at -O0 on x86-64.
llvm-svn: 129691
Diffstat (limited to 'llvm/test/CodeGen/X86/fast-isel-x86-64.ll')
-rw-r--r-- | llvm/test/CodeGen/X86/fast-isel-x86-64.ll | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/fast-isel-x86-64.ll b/llvm/test/CodeGen/X86/fast-isel-x86-64.ll index e74fd30b644..b666e84bbcc 100644 --- a/llvm/test/CodeGen/X86/fast-isel-x86-64.ll +++ b/llvm/test/CodeGen/X86/fast-isel-x86-64.ll @@ -93,3 +93,21 @@ entry: ; CHECK: leal (,%rdi,8), %eax } + +; rdar://9289507 - folding of immediates into 64-bit operations. +define i64 @test8(i64 %x) nounwind ssp { +entry: + %add = add nsw i64 %x, 7 + ret i64 %add + +; CHECK: test8: +; CHECK: addq $7, %rdi +} + +define i64 @test9(i64 %x) nounwind ssp { +entry: + %add = mul nsw i64 %x, 7 + ret i64 %add +; CHECK: test9: +; CHECK: imulq $7, %rdi, %rax +} |