As pointed out in https://bugs.llvm.org/show_bug.cgi?id=41777
we do not emit a vector select even when the pretty much asks for one. This patch changes that.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
I like that this also optimizes the case where C is a not
vec_sel(a, b, ~c) => vec_sel(b, a, c)
Have we thought about adding support in DAGCombine or even InstCombine to combine into ISD::VSELECT too?
lib/Target/PowerPC/PPCInstrVSX.td | ||
---|---|---|
964 ↗ | (On Diff #198539) | Why we need this pattern? and should be a commutable op? |
test/CodeGen/PowerPC/vec-select.ll | ||
24 ↗ | (On Diff #198539) | I think it would be better if we swap %neg.i, %a to test commutable patterns. |
26 ↗ | (On Diff #198539) | I think it would be better if we swap %and.i, %and1.i to test commutable patterns. |
41 ↗ | (On Diff #198539) | How about adding a test of <2 x i64> for vector double too? |
lib/Target/PowerPC/PPCInstrVSX.td | ||
---|---|---|
964 ↗ | (On Diff #198539) | No good reason. I put it in to be safe in case ISEL somehow doesn't match a commuted pattern. That doesn't appear to happen so I'll remove it. |
test/CodeGen/PowerPC/vec-select.ll | ||
24 ↗ | (On Diff #198539) | OK. |
26 ↗ | (On Diff #198539) | OK. I swapped the operands of the and on one and the operands of the or on another. |
41 ↗ | (On Diff #198539) | Will do. |
Removed redundant pattern.
Added commuted tests, a v2i64 test and a negative (v4i1) test.