[x86] add SBB optimization for SETAE (uge) condition code
authorSanjay Patel <spatel@rotateright.com>
Fri, 7 Jul 2017 14:56:20 +0000 (14:56 +0000)
committerSanjay Patel <spatel@rotateright.com>
Fri, 7 Jul 2017 14:56:20 +0000 (14:56 +0000)
commitdd36f7573330ef12c1b150a83ae128c5c4d26a77
tree6381cdf1e4028faca1e42ac031fff28be9a0b967
parent1bbdf4e11a6cc876a8a3dc3f0170f06afe95529b
[x86] add SBB optimization for SETAE (uge) condition code

x86 scalar select-of-constants (Cond ? C1 : C2) combining/lowering is a mess
with missing optimizations. We handle some patterns, but miss logical variants.

To clean that up, we should convert all select-of-constants to logic/math and
enhance the combining for the expected patterns from that. DAGCombiner already
has the foundation to allow the transforms, so we just need to fill in the holes
for x86 math op lowering. Selecting 0 or -1 needs extra attention to produce the
optimal code as shown here.

Attempt to verify that all of these IR forms are logically equivalent:
http://rise4fun.com/Alive/plxs

Earlier steps in this series:
rL306040
rL306072

Differential Revision: https://reviews.llvm.org/D34652

llvm-svn: 307404
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/sbb.ll