diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2012-10-13 10:39:49 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2012-10-13 10:39:49 +0000 |
commit | d6b9362fc245d6ef8c2b94f1fe0933430ac4fad8 (patch) | |
tree | 8d89ded2dad01f932f7a6bef980cb6e3d940bb83 /llvm/test/CodeGen/X86/select.ll | |
parent | 0fb8a7787ed25c61c52144cf7d1af5ac03f9dec9 (diff) | |
download | bcm5719-llvm-d6b9362fc245d6ef8c2b94f1fe0933430ac4fad8.tar.gz bcm5719-llvm-d6b9362fc245d6ef8c2b94f1fe0933430ac4fad8.zip |
X86: Promote i8 cmov when both operands are coming from truncates of the same width.
X86 doesn't have i8 cmovs so isel would emit a branch. Emitting branches at this
level is often not a good idea because it's too late for many optimizations to
kick in. This solution doesn't add any extensions (truncs are free) and tries
to avoid introducing partial register stalls by filtering direct copyfromregs.
I'm seeing a ~10% speedup on reading a random .png file with libpng15 via
graphicsmagick on x86_64/westmere, but YMMV depending on the microarchitecture.
llvm-svn: 165868
Diffstat (limited to 'llvm/test/CodeGen/X86/select.ll')
-rw-r--r-- | llvm/test/CodeGen/X86/select.ll | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/select.ll b/llvm/test/CodeGen/X86/select.ll index 2e39473057b..f4c8d9e767c 100644 --- a/llvm/test/CodeGen/X86/select.ll +++ b/llvm/test/CodeGen/X86/select.ll @@ -344,3 +344,16 @@ entry: ; ATOM: negw ; ATOM: sbbw } + +define i8 @test18(i32 %x, i8 zeroext %a, i8 zeroext %b) nounwind { + %cmp = icmp slt i32 %x, 15 + %sel = select i1 %cmp, i8 %a, i8 %b + ret i8 %sel +; CHECK: test18: +; CHECK: cmpl $15 +; CHECK: cmovll + +; ATOM: test18: +; ATOM: cmpl $15 +; ATOM: cmovll +} |