@@ -4618,51 +4618,31 @@ static int isElementRotate(int &LoSrc, int &HiSrc, ArrayRef<int> Mask) {
4618
4618
// VT is the type of the vector to return, <[vscale x ]n x ty>
4619
4619
// Src is the vector to deinterleave of type <[vscale x ]n*2 x ty>
4620
4620
static SDValue getDeinterleaveViaVNSRL(const SDLoc &DL, MVT VT, SDValue Src,
4621
- bool EvenElts,
4622
- const RISCVSubtarget &Subtarget,
4623
- SelectionDAG &DAG) {
4624
- // The result is a vector of type <m x n x ty>
4625
- MVT ContainerVT = VT;
4626
- // Convert fixed vectors to scalable if needed
4627
- if (ContainerVT.isFixedLengthVector()) {
4628
- assert(Src.getSimpleValueType().isFixedLengthVector());
4629
- ContainerVT = getContainerForFixedLengthVector(DAG, ContainerVT, Subtarget);
4630
-
4631
- // The source is a vector of type <m x n*2 x ty> (For the single source
4632
- // case, the high half is undefined)
4633
- MVT SrcContainerVT =
4634
- MVT::getVectorVT(ContainerVT.getVectorElementType(),
4635
- ContainerVT.getVectorElementCount() * 2);
4636
- Src = convertToScalableVector(SrcContainerVT, Src, DAG, Subtarget);
4621
+ bool EvenElts, SelectionDAG &DAG) {
4622
+ // The result is a vector of type <m x n x ty>. The source is a vector of
4623
+ // type <m x n*2 x ty> (For the single source case, the high half is undef)
4624
+ if (Src.getValueType() == VT) {
4625
+ EVT WideVT = VT.getDoubleNumVectorElementsVT();
4626
+ Src = DAG.getNode(ISD::INSERT_SUBVECTOR, DL, WideVT, DAG.getUNDEF(WideVT),
4627
+ Src, DAG.getVectorIdxConstant(0, DL));
4637
4628
}
4638
4629
4639
- auto [TrueMask, VL] = getDefaultVLOps(VT, ContainerVT, DL, DAG, Subtarget);
4640
-
4641
4630
// Bitcast the source vector from <m x n*2 x ty> -> <m x n x ty*2>
4642
4631
// This also converts FP to int.
4643
- unsigned EltBits = ContainerVT .getScalarSizeInBits();
4644
- MVT WideSrcContainerVT = MVT::getVectorVT(
4645
- MVT::getIntegerVT(EltBits * 2), ContainerVT .getVectorElementCount());
4646
- Src = DAG.getBitcast(WideSrcContainerVT , Src);
4632
+ unsigned EltBits = VT .getScalarSizeInBits();
4633
+ MVT WideSrcVT = MVT::getVectorVT(MVT::getIntegerVT(EltBits * 2),
4634
+ VT .getVectorElementCount());
4635
+ Src = DAG.getBitcast(WideSrcVT , Src);
4647
4636
4648
- // The integer version of the container type.
4649
- MVT IntContainerVT = ContainerVT.changeVectorElementTypeToInteger();
4637
+ MVT IntVT = VT.changeVectorElementTypeToInteger();
4650
4638
4651
4639
// If we want even elements, then the shift amount is 0. Otherwise, shift by
4652
4640
// the original element size.
4653
4641
unsigned Shift = EvenElts ? 0 : EltBits;
4654
- SDValue SplatShift = DAG.getNode(
4655
- RISCVISD::VMV_V_X_VL, DL, IntContainerVT, DAG.getUNDEF(ContainerVT),
4656
- DAG.getConstant(Shift, DL, Subtarget.getXLenVT()), VL);
4657
- SDValue Res =
4658
- DAG.getNode(RISCVISD::VNSRL_VL, DL, IntContainerVT, Src, SplatShift,
4659
- DAG.getUNDEF(IntContainerVT), TrueMask, VL);
4660
- // Cast back to FP if needed.
4661
- Res = DAG.getBitcast(ContainerVT, Res);
4662
-
4663
- if (VT.isFixedLengthVector())
4664
- Res = convertFromScalableVector(VT, Res, DAG, Subtarget);
4665
- return Res;
4642
+ SDValue Res = DAG.getNode(ISD::SRL, DL, WideSrcVT, Src,
4643
+ DAG.getConstant(Shift, DL, WideSrcVT));
4644
+ Res = DAG.getNode(ISD::TRUNCATE, DL, IntVT, Res);
4645
+ return DAG.getBitcast(VT, Res);
4666
4646
}
4667
4647
4668
4648
// Lower the following shuffle to vslidedown.
@@ -5356,7 +5336,7 @@ static SDValue lowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG,
5356
5336
// vnsrl to deinterleave.
5357
5337
if (SDValue Src =
5358
5338
isDeinterleaveShuffle(VT, ContainerVT, V1, V2, Mask, Subtarget))
5359
- return getDeinterleaveViaVNSRL(DL, VT, Src, Mask[0] == 0, Subtarget, DAG);
5339
+ return getDeinterleaveViaVNSRL(DL, VT, Src, Mask[0] == 0, DAG);
5360
5340
5361
5341
if (SDValue V =
5362
5342
lowerVECTOR_SHUFFLEAsVSlideup(DL, VT, V1, V2, Mask, Subtarget, DAG))
@@ -6258,7 +6238,7 @@ static bool hasPassthruOp(unsigned Opcode) {
6258
6238
Opcode <= RISCVISD::LAST_RISCV_STRICTFP_OPCODE &&
6259
6239
"not a RISC-V target specific op");
6260
6240
static_assert(RISCVISD::LAST_VL_VECTOR_OP - RISCVISD::FIRST_VL_VECTOR_OP ==
6261
- 128 &&
6241
+ 127 &&
6262
6242
RISCVISD::LAST_RISCV_STRICTFP_OPCODE -
6263
6243
ISD::FIRST_TARGET_STRICTFP_OPCODE ==
6264
6244
21 &&
@@ -6284,7 +6264,7 @@ static bool hasMaskOp(unsigned Opcode) {
6284
6264
Opcode <= RISCVISD::LAST_RISCV_STRICTFP_OPCODE &&
6285
6265
"not a RISC-V target specific op");
6286
6266
static_assert(RISCVISD::LAST_VL_VECTOR_OP - RISCVISD::FIRST_VL_VECTOR_OP ==
6287
- 128 &&
6267
+ 127 &&
6288
6268
RISCVISD::LAST_RISCV_STRICTFP_OPCODE -
6289
6269
ISD::FIRST_TARGET_STRICTFP_OPCODE ==
6290
6270
21 &&
@@ -10763,10 +10743,8 @@ SDValue RISCVTargetLowering::lowerVECTOR_DEINTERLEAVE(SDValue Op,
10763
10743
// We can deinterleave through vnsrl.wi if the element type is smaller than
10764
10744
// ELEN
10765
10745
if (VecVT.getScalarSizeInBits() < Subtarget.getELen()) {
10766
- SDValue Even =
10767
- getDeinterleaveViaVNSRL(DL, VecVT, Concat, true, Subtarget, DAG);
10768
- SDValue Odd =
10769
- getDeinterleaveViaVNSRL(DL, VecVT, Concat, false, Subtarget, DAG);
10746
+ SDValue Even = getDeinterleaveViaVNSRL(DL, VecVT, Concat, true, DAG);
10747
+ SDValue Odd = getDeinterleaveViaVNSRL(DL, VecVT, Concat, false, DAG);
10770
10748
return DAG.getMergeValues({Even, Odd}, DL);
10771
10749
}
10772
10750
@@ -20494,7 +20472,6 @@ const char *RISCVTargetLowering::getTargetNodeName(unsigned Opcode) const {
20494
20472
NODE_NAME_CASE(VWMACC_VL)
20495
20473
NODE_NAME_CASE(VWMACCU_VL)
20496
20474
NODE_NAME_CASE(VWMACCSU_VL)
20497
- NODE_NAME_CASE(VNSRL_VL)
20498
20475
NODE_NAME_CASE(SETCC_VL)
20499
20476
NODE_NAME_CASE(VMERGE_VL)
20500
20477
NODE_NAME_CASE(VMAND_VL)
0 commit comments