Expand [nX]vXi1 vp.select the same way as [nX]vXi1 vselect.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp | ||
---|---|---|
1204 | nit: Implement | |
1211 | nit: EVL would be a more appropriate name, I think. | |
1216 | nit: VP_XOR | |
1221 | The following expansion is only correct under certain conditions: when the vselect condition and operand types are identically-sized integer vectors and when the mask is -1/0. See the original ExpandVSELECT for that. Since we don't have an in-tree test case for anything other than expanding [nx]vXi1 VSELECT maybe it's sufficient for now to resort to UnrollVectorOp whenever the operand types aren't i1 vectors? UnrollVectorOp will no doubt fail for VP_SELECT right now, but we wouldn't be making anything worse. Not sure: any thoughts @craig.topper? @RKSimon? |
llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp | ||
---|---|---|
1204 | This code only works if Mask's VT is the same as Op1/Op2 VT but that isn't guaranteed in general. We should call UnrollVectorOp for that just like ExpandVSELECT. | |
1221 | I think I'm fine with calling Unroll if it isn't an nxvXi1 vector. | |
1222 | Why a lamdba? Can't we just do SDValue Ones = DAG.getAllOnesConstant(DL, VT); SDValue NotMask = DAG.getNode(ISD::VP_XOR, DL, VT, Mask, Ones, Ones, Length); Arguably that should be DAG.getNode(ISD::VP_XOR, DL, VT, Mask, Ones, Mask, Length); so the XOR has the same mask as the other ops. |
@craig.topper Can you please land this one for me? I tried to fix the pipeline by rebasing (hence the last diff), but it appears to be broken in main. I'll ask for commit access after this patch has been landed so that I don't need to ask you for it again. Thanks!
nit: Implement