This supports things like
(setcc uge X, 0) -> true
(setcc ugt X, 0) -> (setcc ne X, 0)
The AArch64 test changes are to avoid using things that we can simplify now. I'll probably commit these separately.
Paths
| Differential D42948
[SelectionDAG] Support some SimplifySetCC cases for comparing against vector splats of constants. ClosedPublic Authored by craig.topper on Feb 5 2018, 11:11 PM.
Details Summary This supports things like (setcc uge X, 0) -> true The AArch64 test changes are to avoid using things that we can simplify now. I'll probably commit these separately.
Diff Detail
Event TimelineHerald added subscribers: kristof.beyls, javed.absar, sdardis, aemerson. · View Herald TranscriptFeb 5 2018, 11:11 PM Comment Actions Please check in the AArch64 (and MIPS?) test changes ahead of this. I'd prefer to add some dedicated minimal tests, so we know exactly what the improvements are without digging through the more complicated diffs. That would be stuff like this I think: define <4 x i32> @lt_min(<4 x i32> %x) { %cmp = icmp slt <4 x i32> %x, <i32 2147483648, i32 2147483648, i32 2147483648, i32 2147483648> %r = sext <4 x i1> %cmp to <4 x i32> ret <4 x i32> %r }
Comment Actions
We're a ZeroOrNegativeOneBooleanContent target for vectors, so this may be useful.
Comment Actions Add directed tests. I believe there are some missing optimizations due to not enabling canonicalization of GE/LE to GT/LT for vectors. Comment Actions
We might have to be more careful with vector ISAs because they tend to leave out the full set of predicates. Ie, do we have to check for legal-or-custom if this transform can happen late, or can we assume that all predicates must be handled for all data types? I checked in the baseline tests at rL325138 - can you rebase here, so we just see the improvements? Comment Actions
Do you think we should override isCondCodeLegal? Comment Actions
No - that looks exactly like what I was thinking of. I just couldn't tell from the diffs if we're checking that consistently...so this patch should be good as-is (just rebased). Refactoring to better organize this blob can be a follow-up. :) Comment Actions We're not checking isCondCodeLegal consistently. The only calls to it are in the two blocks that covered with !isVector. I'm not sure we can use isCondCodeLegal correctly with SSE/AVX and AVX512 having different behaviors.
Comment Actions Change to only allow vector adjustments before legalize ops since the isCondCodeLegal is probably not correct for targets today. But this will at least give us a chance to make some simplifications. This revision is now accepted and ready to land.Mar 1 2018, 1:24 PM Closed by commit rL326495: [SelectionDAG] Support some SimplifySetCC cases for comparing against vector… (authored by ctopper). · Explain WhyMar 1 2018, 2:19 PM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 136603 llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp
llvm/trunk/test/CodeGen/X86/avx512-insert-extract.ll
llvm/trunk/test/CodeGen/X86/vector-compare-simplify.ll
|