return DAG.getNode(ISD::VSELECT, DL, VT, SelectMask, V1, V2);
}
+ // We might be able to express the shuffle as a bitrotate. But even if we
+ // don't have Zvkb and have to expand, the expanded sequence of approx. 2
+ // shifts and a vor will have a higher throughput than a vrgather.
+ if (SDValue V = lowerVECTOR_SHUFFLEAsRotate(SVN, DAG, Subtarget))
+ return V;
+
+ if (VT.getScalarSizeInBits() == 8 && VT.getVectorNumElements() > 256) {
+ // On such a large vector we're unable to use i8 as the index type.
+ // FIXME: We could promote the index to i16 and use vrgatherei16, but that
+ // may involve vector splitting if we're already at LMUL=8, or our
+ // user-supplied maximum fixed-length LMUL.
+ return SDValue();
+ }
// As a backup, shuffles can be lowered via a vrgather instruction, possibly
// merged with a second vrgather.
MVT MaskVT = MVT::getVectorVT(MVT::i1, NumElts);
SDValue SelectMask = DAG.getBuildVector(MaskVT, DL, MaskVals);
- // We might be able to express the shuffle as a bitrotate. But even if we
- // don't have Zvkb and have to expand, the expanded sequence of approx. 2
- // shifts and a vor will have a higher throughput than a vrgather.
- if (SDValue V = lowerVECTOR_SHUFFLEAsRotate(SVN, DAG, Subtarget))
- return V;
-
- if (VT.getScalarSizeInBits() == 8 && VT.getVectorNumElements() > 256) {
- // On such a large vector we're unable to use i8 as the index type.
- // FIXME: We could promote the index to i16 and use vrgatherei16, but that
- // may involve vector splitting if we're already at LMUL=8, or our
- // user-supplied maximum fixed-length LMUL.
- return SDValue();
- }
-
unsigned GatherVXOpc = RISCVISD::VRGATHER_VX_VL;
unsigned GatherVVOpc = RISCVISD::VRGATHER_VV_VL;
MVT IndexVT = VT.changeTypeToInteger();