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)
commitd6b9362fc245d6ef8c2b94f1fe0933430ac4fad8
tree8d89ded2dad01f932f7a6bef980cb6e3d940bb83
parent0fb8a7787ed25c61c52144cf7d1af5ac03f9dec9
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
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/select.ll