X86: Promote i8 cmov when both operands are coming from truncates of the same width.
authorBenjamin Kramer <benny.kra@googlemail.com>
Sat, 13 Oct 2012 10:39:49 +0000 (10:39 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Sat, 13 Oct 2012 10:39:49 +0000 (10:39 +0000)
commit444dccecfc6c6d0dad4f400141a12f9ca76943d8
treecf6c680b2f5dcd504d8c2e431788672778843a34
parentc2fcf1a67126a079e34f04bd09a50ae85fdd9469
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165868 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86ISelLowering.cpp
test/CodeGen/X86/select.ll