@@ -2758,19 +2758,6 @@ static SDValue getAllOnesMask(MVT VecVT, SDValue VL, const SDLoc &DL,
2758
2758
return DAG.getNode(RISCVISD::VMSET_VL, DL, MaskVT, VL);
2759
2759
}
2760
2760
2761
- static SDValue getVLOp(uint64_t NumElts, MVT ContainerVT, const SDLoc &DL,
2762
- SelectionDAG &DAG, const RISCVSubtarget &Subtarget) {
2763
- // If we know the exact VLEN, and our VL is exactly equal to VLMAX,
2764
- // canonicalize the representation. InsertVSETVLI will pick the immediate
2765
- // encoding later if profitable.
2766
- const auto [MinVLMAX, MaxVLMAX] =
2767
- RISCVTargetLowering::computeVLMAXBounds(ContainerVT, Subtarget);
2768
- if (MinVLMAX == MaxVLMAX && NumElts == MinVLMAX)
2769
- return DAG.getRegister(RISCV::X0, Subtarget.getXLenVT());
2770
-
2771
- return DAG.getConstant(NumElts, DL, Subtarget.getXLenVT());
2772
- }
2773
-
2774
2761
static std::pair<SDValue, SDValue>
2775
2762
getDefaultScalableVLOps(MVT VecVT, const SDLoc &DL, SelectionDAG &DAG,
2776
2763
const RISCVSubtarget &Subtarget) {
@@ -2784,7 +2771,7 @@ static std::pair<SDValue, SDValue>
2784
2771
getDefaultVLOps(uint64_t NumElts, MVT ContainerVT, const SDLoc &DL,
2785
2772
SelectionDAG &DAG, const RISCVSubtarget &Subtarget) {
2786
2773
assert(ContainerVT.isScalableVector() && "Expecting scalable container type");
2787
- SDValue VL = getVLOp (NumElts, ContainerVT, DL, DAG, Subtarget);
2774
+ SDValue VL = DAG.getConstant (NumElts, DL, Subtarget.getXLenVT() );
2788
2775
SDValue Mask = getAllOnesMask(ContainerVT, VL, DL, DAG);
2789
2776
return {Mask, VL};
2790
2777
}
@@ -9427,8 +9414,7 @@ SDValue RISCVTargetLowering::LowerINTRINSIC_W_CHAIN(SDValue Op,
9427
9414
MVT VT = Op->getSimpleValueType(0);
9428
9415
MVT ContainerVT = getContainerForFixedLengthVector(VT);
9429
9416
9430
- SDValue VL = getVLOp(VT.getVectorNumElements(), ContainerVT, DL, DAG,
9431
- Subtarget);
9417
+ SDValue VL = DAG.getConstant(VT.getVectorNumElements(), DL, XLenVT);
9432
9418
SDValue IntID = DAG.getTargetConstant(VlsegInts[NF - 2], DL, XLenVT);
9433
9419
auto *Load = cast<MemIntrinsicSDNode>(Op);
9434
9420
SmallVector<EVT, 9> ContainerVTs(NF, ContainerVT);
@@ -9507,8 +9493,7 @@ SDValue RISCVTargetLowering::LowerINTRINSIC_VOID(SDValue Op,
9507
9493
MVT VT = Op->getOperand(2).getSimpleValueType();
9508
9494
MVT ContainerVT = getContainerForFixedLengthVector(VT);
9509
9495
9510
- SDValue VL = getVLOp(VT.getVectorNumElements(), ContainerVT, DL, DAG,
9511
- Subtarget);
9496
+ SDValue VL = DAG.getConstant(VT.getVectorNumElements(), DL, XLenVT);
9512
9497
SDValue IntID = DAG.getTargetConstant(VssegInts[NF - 2], DL, XLenVT);
9513
9498
SDValue Ptr = Op->getOperand(NF + 2);
9514
9499
@@ -9974,7 +9959,7 @@ SDValue RISCVTargetLowering::lowerINSERT_SUBVECTOR(SDValue Op,
9974
9959
// Set the vector length to only the number of elements we care about. Note
9975
9960
// that for slideup this includes the offset.
9976
9961
unsigned EndIndex = OrigIdx + SubVecVT.getVectorNumElements();
9977
- SDValue VL = getVLOp (EndIndex, ContainerVT, DL, DAG, Subtarget );
9962
+ SDValue VL = DAG.getConstant (EndIndex, DL, XLenVT );
9978
9963
9979
9964
// Use tail agnostic policy if we're inserting over Vec's tail.
9980
9965
unsigned Policy = RISCVII::TAIL_UNDISTURBED_MASK_UNDISTURBED;
@@ -10211,8 +10196,7 @@ SDValue RISCVTargetLowering::lowerEXTRACT_SUBVECTOR(SDValue Op,
10211
10196
getDefaultVLOps(VecVT, ContainerVT, DL, DAG, Subtarget).first;
10212
10197
// Set the vector length to only the number of elements we care about. This
10213
10198
// avoids sliding down elements we're going to discard straight away.
10214
- SDValue VL = getVLOp(SubVecVT.getVectorNumElements(), ContainerVT, DL, DAG,
10215
- Subtarget);
10199
+ SDValue VL = DAG.getConstant(SubVecVT.getVectorNumElements(), DL, XLenVT);
10216
10200
SDValue SlidedownAmt = DAG.getConstant(OrigIdx, DL, XLenVT);
10217
10201
SDValue Slidedown =
10218
10202
getVSlidedown(DAG, Subtarget, DL, ContainerVT,
@@ -10287,8 +10271,7 @@ SDValue RISCVTargetLowering::lowerEXTRACT_SUBVECTOR(SDValue Op,
10287
10271
SDValue SlidedownAmt = DAG.getElementCount(DL, XLenVT, RemIdx);
10288
10272
auto [Mask, VL] = getDefaultScalableVLOps(InterSubVT, DL, DAG, Subtarget);
10289
10273
if (SubVecVT.isFixedLengthVector())
10290
- VL = getVLOp(SubVecVT.getVectorNumElements(), InterSubVT, DL, DAG,
10291
- Subtarget);
10274
+ VL = DAG.getConstant(SubVecVT.getVectorNumElements(), DL, XLenVT);
10292
10275
SDValue Slidedown =
10293
10276
getVSlidedown(DAG, Subtarget, DL, InterSubVT, DAG.getUNDEF(InterSubVT),
10294
10277
Vec, SlidedownAmt, Mask, VL);
@@ -10668,7 +10651,7 @@ RISCVTargetLowering::lowerFixedLengthVectorLoadToRVV(SDValue Op,
10668
10651
return DAG.getMergeValues({Result, NewLoad.getValue(1)}, DL);
10669
10652
}
10670
10653
10671
- SDValue VL = getVLOp (VT.getVectorNumElements(), ContainerVT, DL, DAG, Subtarget );
10654
+ SDValue VL = DAG.getConstant (VT.getVectorNumElements(), DL, XLenVT );
10672
10655
10673
10656
bool IsMaskOp = VT.getVectorElementType() == MVT::i1;
10674
10657
SDValue IntID = DAG.getTargetConstant(
@@ -10715,7 +10698,6 @@ RISCVTargetLowering::lowerFixedLengthVectorStoreToRVV(SDValue Op,
10715
10698
SDValue NewValue =
10716
10699
convertToScalableVector(ContainerVT, StoreVal, DAG, Subtarget);
10717
10700
10718
-
10719
10701
// If we know the exact VLEN and our fixed length vector completely fills
10720
10702
// the container, use a whole register store instead.
10721
10703
const auto [MinVLMAX, MaxVLMAX] =
@@ -10728,8 +10710,7 @@ RISCVTargetLowering::lowerFixedLengthVectorStoreToRVV(SDValue Op,
10728
10710
MMO->getFlags(), MMO->getAAInfo());
10729
10711
}
10730
10712
10731
- SDValue VL = getVLOp(VT.getVectorNumElements(), ContainerVT, DL, DAG,
10732
- Subtarget);
10713
+ SDValue VL = DAG.getConstant(VT.getVectorNumElements(), DL, XLenVT);
10733
10714
10734
10715
bool IsMaskOp = VT.getVectorElementType() == MVT::i1;
10735
10716
SDValue IntID = DAG.getTargetConstant(
0 commit comments