X86: Add a bunch of peeps for add and sub of SETB.
authorBenjamin Kramer <benny.kra@googlemail.com>
Sun, 8 May 2011 18:36:07 +0000 (18:36 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Sun, 8 May 2011 18:36:07 +0000 (18:36 +0000)
commitf51190b6977ec1ae93be83fd109a3f99855bb653
tree937cb7f0499c68d3bceba36bd5b1c4f98a775cf6
parent4eafe109459eb115f13f1d19c5ff3cb3678e8c7a
X86: Add a bunch of peeps for add and sub of SETB.

"b + ((a < b) ? 1 : 0)" compiles into
cmpl %esi, %edi
adcl $0, %esi
instead of
cmpl %esi, %edi
sbbl %eax, %eax
andl $1, %eax
addl %esi, %eax

This saves a register, a false dependency on %eax
(Intel's CPUs still don't ignore it) and it's shorter.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131070 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86InstrCompiler.td
test/CodeGen/X86/add-of-carry.ll
test/CodeGen/X86/peep-setb.ll [new file with mode: 0644]