diff options
| author | Chris Lattner <sabre@nondot.org> | 2009-03-13 05:53:31 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2009-03-13 05:53:31 +0000 |
| commit | cee56e7d33fecc74da6f16ebb48dd5b62d73ea8d (patch) | |
| tree | f3f46f89b9f15f322d90cf3bb6cee16966bf125d /test/CodeGen | |
| parent | 97a29a5fee209769c52d78564ffe9dde514d5f03 (diff) | |
generalize the previous code to use the full generality of LEA
for i32/i64 expressions (we could also do i16 on cpus where
i16 lea is fast, but I didn't add this). On the example, we now
generate:
_test:
movl 4(%esp), %eax
cmpl $42, (%eax)
setl %al
movzbl %al, %eax
leal 4(%eax,%eax,8), %eax
ret
instead of:
_test:
movl 4(%esp), %eax
cmpl $41, (%eax)
movl $4, %ecx
movl $13, %eax
cmovg %ecx, %eax
ret
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66869 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen')
| -rw-r--r-- | test/CodeGen/X86/select-no-cmov.ll | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/CodeGen/X86/select-no-cmov.ll b/test/CodeGen/X86/select-no-cmov.ll index 87382fe3c8..71636f9332 100644 --- a/test/CodeGen/X86/select-no-cmov.ll +++ b/test/CodeGen/X86/select-no-cmov.ll @@ -12,3 +12,15 @@ entry: %iftmp.0.0 = select i1 %1, i32 -1, i32 -2 ; <i32> [#uses=1] ret i32 %iftmp.0.0 } + +; setl %al +; movzbl %al, %eax +; leal 4(%eax,%eax,8), %eax +define i32 @test2(i32* nocapture %P) nounwind readonly { +entry: + %0 = load i32* %P, align 4 ; <i32> [#uses=1] + %1 = icmp sgt i32 %0, 41 ; <i1> [#uses=1] + %iftmp.0.0 = select i1 %1, i32 4, i32 13 ; <i32> [#uses=1] + ret i32 %iftmp.0.0 +} + |
