[PowerPC] Fixup SELECT_CC (and SETCC) patterns with i1 comparison operands
authorHal Finkel <hfinkel@anl.gov>
Sun, 30 Aug 2015 22:12:50 +0000 (22:12 +0000)
committerHal Finkel <hfinkel@anl.gov>
Sun, 30 Aug 2015 22:12:50 +0000 (22:12 +0000)
commitfdc7c7ad10aded7dbd3bb2ce85f194efa5d08c06
tree1e5f982f3eb058d8b216d5eab380ba5537297e44
parent957622ea93878ccc2cc43f57b1ce1b45d052da3e
[PowerPC] Fixup SELECT_CC (and SETCC) patterns with i1 comparison operands

There were really two problems here. The first was that we had the truth tables
for signed i1 comparisons backward. I imagine these are not very common, but if
you have:
  setcc i1 x, y, LT
this has the '0 1' and the '1 0' results flipped compared to:
  setcc i1 x, y, ULT
because, in the signed case, '1 0' is really '-1 0', and the answer is not the
same as in the unsigned case.

The second problem was that we did not have patterns (at all) for the unsigned
comparisons select_cc nodes for i1 comparison operands. This was the specific
cause of PR24552. These had to be added (and a missing Altivec promotion added
as well) to make sure these function for all types. I've added a bunch more
test cases for these patterns, and there are a few FIXMEs in the test case
regarding code-quality.

Fixes PR24552.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246400 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/PowerPC/PPCISelLowering.cpp
lib/Target/PowerPC/PPCInstrInfo.td
lib/Target/PowerPC/PPCInstrQPX.td
lib/Target/PowerPC/PPCInstrVSX.td
test/CodeGen/PowerPC/select-i1-vs-i1.ll [new file with mode: 0644]