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 | Why we need this pattern? and should be a commutable op? | |
test/CodeGen/PowerPC/vec-select.ll | ||
25 | I think it would be better if we swap %neg.i, %a to test commutable patterns. | |
27 | I think it would be better if we swap %and.i, %and1.i to test commutable patterns. | |
42 | How about adding a test of <2 x i64> for vector double too? |
lib/Target/PowerPC/PPCInstrVSX.td | ||
---|---|---|
964 | 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 | ||
25 | OK. | |
27 | OK. I swapped the operands of the and on one and the operands of the or on another. | |
42 | Will do. |
Removed redundant pattern.
Added commuted tests, a v2i64 test and a negative (v4i1) test.
Why we need this pattern? and should be a commutable op?