@@ -3848,11 +3848,10 @@ static SDValue lowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG,
3848
3848
3849
3849
// If we're compiling for an exact VLEN value, we can split our work per
3850
3850
// register in the register group.
3851
- const unsigned MinVLen = Subtarget.getRealMinVLen();
3852
- const unsigned MaxVLen = Subtarget.getRealMaxVLen();
3853
- if (MinVLen == MaxVLen && VT.getSizeInBits().getKnownMinValue() > MinVLen) {
3851
+ if (const auto VLen = Subtarget.getRealVLen();
3852
+ VLen && VT.getSizeInBits().getKnownMinValue() > *VLen) {
3854
3853
MVT ElemVT = VT.getVectorElementType();
3855
- unsigned ElemsPerVReg = MinVLen / ElemVT.getFixedSizeInBits();
3854
+ unsigned ElemsPerVReg = *VLen / ElemVT.getFixedSizeInBits();
3856
3855
EVT ContainerVT = getContainerForFixedLengthVector(DAG, VT, Subtarget);
3857
3856
MVT OneRegVT = MVT::getVectorVT(ElemVT, ElemsPerVReg);
3858
3857
MVT M1VT = getContainerForFixedLengthVector(DAG, OneRegVT, Subtarget);
@@ -4763,9 +4762,8 @@ static SDValue lowerShuffleViaVRegSplitting(ShuffleVectorSDNode *SVN,
4763
4762
4764
4763
// If we don't know exact data layout, not much we can do. If this
4765
4764
// is already m1 or smaller, no point in splitting further.
4766
- const unsigned MinVLen = Subtarget.getRealMinVLen();
4767
- const unsigned MaxVLen = Subtarget.getRealMaxVLen();
4768
- if (MinVLen != MaxVLen || VT.getSizeInBits().getFixedValue() <= MinVLen)
4765
+ const auto VLen = Subtarget.getRealVLen();
4766
+ if (!VLen || VT.getSizeInBits().getFixedValue() <= *VLen)
4769
4767
return SDValue();
4770
4768
4771
4769
// Avoid picking up bitrotate patterns which we have a linear-in-lmul
@@ -4776,7 +4774,7 @@ static SDValue lowerShuffleViaVRegSplitting(ShuffleVectorSDNode *SVN,
4776
4774
return SDValue();
4777
4775
4778
4776
MVT ElemVT = VT.getVectorElementType();
4779
- unsigned ElemsPerVReg = MinVLen / ElemVT.getFixedSizeInBits();
4777
+ unsigned ElemsPerVReg = *VLen / ElemVT.getFixedSizeInBits();
4780
4778
unsigned VRegsPerSrc = NumElts / ElemsPerVReg;
4781
4779
4782
4780
SmallVector<std::pair<int, SmallVector<int>>>
@@ -8328,15 +8326,13 @@ SDValue RISCVTargetLowering::lowerEXTRACT_VECTOR_ELT(SDValue Op,
8328
8326
// constant index, we can always perform the extract in m1 (or
8329
8327
// smaller) as we can determine the register corresponding to
8330
8328
// the index in the register group.
8331
- const unsigned MinVLen = Subtarget.getRealMinVLen();
8332
- const unsigned MaxVLen = Subtarget.getRealMaxVLen();
8329
+ const auto VLen = Subtarget.getRealVLen();
8333
8330
if (auto *IdxC = dyn_cast<ConstantSDNode>(Idx);
8334
- IdxC && MinVLen == MaxVLen &&
8335
- VecVT.getSizeInBits().getKnownMinValue() > MinVLen) {
8331
+ IdxC && VLen && VecVT.getSizeInBits().getKnownMinValue() > *VLen) {
8336
8332
MVT M1VT = getLMUL1VT(ContainerVT);
8337
8333
unsigned OrigIdx = IdxC->getZExtValue();
8338
8334
EVT ElemVT = VecVT.getVectorElementType();
8339
- unsigned ElemsPerVReg = MinVLen / ElemVT.getFixedSizeInBits();
8335
+ unsigned ElemsPerVReg = *VLen / ElemVT.getFixedSizeInBits();
8340
8336
unsigned RemIdx = OrigIdx % ElemsPerVReg;
8341
8337
unsigned SubRegIdx = OrigIdx / ElemsPerVReg;
8342
8338
unsigned ExtractIdx =
@@ -9797,15 +9793,14 @@ SDValue RISCVTargetLowering::lowerEXTRACT_SUBVECTOR(SDValue Op,
9797
9793
if (OrigIdx == 0)
9798
9794
return Op;
9799
9795
9800
- const unsigned MinVLen = Subtarget.getRealMinVLen();
9801
- const unsigned MaxVLen = Subtarget.getRealMaxVLen();
9796
+ const auto VLen = Subtarget.getRealVLen();
9802
9797
9803
9798
// If the subvector vector is a fixed-length type and we don't know VLEN
9804
9799
// exactly, we cannot use subregister manipulation to simplify the codegen; we
9805
9800
// don't know which register of a LMUL group contains the specific subvector
9806
9801
// as we only know the minimum register size. Therefore we must slide the
9807
9802
// vector group down the full amount.
9808
- if (SubVecVT.isFixedLengthVector() && MinVLen != MaxVLen ) {
9803
+ if (SubVecVT.isFixedLengthVector() && !VLen ) {
9809
9804
MVT ContainerVT = VecVT;
9810
9805
if (VecVT.isFixedLengthVector()) {
9811
9806
ContainerVT = getContainerForFixedLengthVector(VecVT);
@@ -9852,8 +9847,8 @@ SDValue RISCVTargetLowering::lowerEXTRACT_SUBVECTOR(SDValue Op,
9852
9847
// and decomposeSubvectorInsertExtractToSubRegs takes this into account. So if
9853
9848
// we have a fixed length subvector, we need to adjust the index by 1/vscale.
9854
9849
if (SubVecVT.isFixedLengthVector()) {
9855
- assert(MinVLen == MaxVLen );
9856
- unsigned Vscale = MinVLen / RISCV::RVVBitsPerBlock;
9850
+ assert(VLen );
9851
+ unsigned Vscale = *VLen / RISCV::RVVBitsPerBlock;
9857
9852
auto Decompose =
9858
9853
RISCVTargetLowering::decomposeSubvectorInsertExtractToSubRegs(
9859
9854
VecVT, ContainerSubVecVT, OrigIdx / Vscale, TRI);
0 commit comments