[DAG] Add wrappers for insert and extract sub-vector [nfc] (#137230)
Mechanical change to introduce the new wrappers, and add enough users to make the usage pattern clear. Once this lands, I'm going to do a further pass to adjust more callsites as separate changes. --------- Co-authored-by: Luke Lau <luke_lau@icloud.com>
This commit is contained in:
@@ -924,6 +924,20 @@ public:
|
||||
/// Example: shuffle A, B, <0,5,2,7> -> shuffle B, A, <4,1,6,3>
|
||||
SDValue getCommutedVectorShuffle(const ShuffleVectorSDNode &SV);
|
||||
|
||||
/// Insert \p SubVec at the \p Idx element of \p Vec.
|
||||
SDValue getInsertSubvector(const SDLoc &DL, SDValue Vec, SDValue SubVec,
|
||||
unsigned Idx) {
|
||||
return getNode(ISD::INSERT_SUBVECTOR, DL, Vec.getValueType(), Vec, SubVec,
|
||||
getVectorIdxConstant(Idx, DL));
|
||||
}
|
||||
|
||||
/// Return the \p VT typed sub-vector of \p Vec at \p Idx
|
||||
SDValue getExtractSubvector(const SDLoc &DL, EVT VT, SDValue Vec,
|
||||
unsigned Idx) {
|
||||
return getNode(ISD::EXTRACT_SUBVECTOR, DL, VT, Vec,
|
||||
getVectorIdxConstant(Idx, DL));
|
||||
}
|
||||
|
||||
/// Convert Op, which must be of float type, to the
|
||||
/// float type VT, by either extending or rounding (by truncation).
|
||||
SDValue getFPExtendOrRound(SDValue Op, const SDLoc &DL, EVT VT);
|
||||
|
||||
@@ -12674,8 +12674,7 @@ SelectionDAG::matchBinOpReduction(SDNode *Extract, ISD::NodeType &BinOp,
|
||||
if (!TLI->isExtractSubvectorCheap(SubVT, OpVT, 0))
|
||||
return SDValue();
|
||||
BinOp = (ISD::NodeType)CandidateBinOp;
|
||||
return getNode(ISD::EXTRACT_SUBVECTOR, SDLoc(Op), SubVT, Op,
|
||||
getVectorIdxConstant(0, SDLoc(Op)));
|
||||
return getExtractSubvector(SDLoc(Op), SubVT, Op, 0);
|
||||
};
|
||||
|
||||
// At each stage, we're looking for something that looks like:
|
||||
@@ -13045,8 +13044,7 @@ SelectionDAG::SplitVector(const SDValue &N, const SDLoc &DL, const EVT &LoVT,
|
||||
N.getValueType().getVectorMinNumElements() &&
|
||||
"More vector elements requested than available!");
|
||||
SDValue Lo, Hi;
|
||||
Lo =
|
||||
getNode(ISD::EXTRACT_SUBVECTOR, DL, LoVT, N, getVectorIdxConstant(0, DL));
|
||||
Lo = getExtractSubvector(DL, LoVT, N, 0);
|
||||
// For scalable vectors it is safe to use LoVT.getVectorMinNumElements()
|
||||
// (rather than having to use ElementCount), because EXTRACT_SUBVECTOR scales
|
||||
// IDX with the runtime scaling factor of the result vector type. For
|
||||
@@ -13078,8 +13076,7 @@ SDValue SelectionDAG::WidenVector(const SDValue &N, const SDLoc &DL) {
|
||||
EVT VT = N.getValueType();
|
||||
EVT WideVT = EVT::getVectorVT(*getContext(), VT.getVectorElementType(),
|
||||
NextPowerOf2(VT.getVectorNumElements()));
|
||||
return getNode(ISD::INSERT_SUBVECTOR, DL, WideVT, getUNDEF(WideVT), N,
|
||||
getVectorIdxConstant(0, DL));
|
||||
return getInsertSubvector(DL, getUNDEF(WideVT), N, 0);
|
||||
}
|
||||
|
||||
void SelectionDAG::ExtractVectorElements(SDValue Op,
|
||||
|
||||
@@ -2803,8 +2803,7 @@ static SDValue convertToScalableVector(EVT VT, SDValue V, SelectionDAG &DAG,
|
||||
assert(V.getValueType().isFixedLengthVector() &&
|
||||
"Expected a fixed length vector operand!");
|
||||
SDLoc DL(V);
|
||||
SDValue Zero = DAG.getVectorIdxConstant(0, DL);
|
||||
return DAG.getNode(ISD::INSERT_SUBVECTOR, DL, VT, DAG.getUNDEF(VT), V, Zero);
|
||||
return DAG.getInsertSubvector(DL, DAG.getUNDEF(VT), V, 0);
|
||||
}
|
||||
|
||||
// Shrink V so it's just big enough to maintain a VT's worth of data.
|
||||
@@ -3648,12 +3647,9 @@ static SDValue matchSplatAsGather(SDValue SplatVal, MVT VT, const SDLoc &DL,
|
||||
// Put Vec in a VT sized vector
|
||||
if (SrcContainerVT.getVectorMinNumElements() <
|
||||
ContainerVT.getVectorMinNumElements())
|
||||
Src = DAG.getNode(ISD::INSERT_SUBVECTOR, DL, ContainerVT,
|
||||
DAG.getUNDEF(ContainerVT), Src,
|
||||
DAG.getVectorIdxConstant(0, DL));
|
||||
Src = DAG.getInsertSubvector(DL, DAG.getUNDEF(ContainerVT), Src, 0);
|
||||
else
|
||||
Src = DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, ContainerVT, Src,
|
||||
DAG.getVectorIdxConstant(0, DL));
|
||||
Src = DAG.getExtractSubvector(DL, ContainerVT, Src, 0);
|
||||
|
||||
// We checked that Idx fits inside VT earlier
|
||||
auto [Mask, VL] = getDefaultVLOps(VT, ContainerVT, DL, DAG, Subtarget);
|
||||
@@ -4578,17 +4574,14 @@ static SDValue lowerScalarInsert(SDValue Scalar, SDValue VL, MVT VT,
|
||||
ExtractedVal, DAG, Subtarget);
|
||||
}
|
||||
if (ExtractedContainerVT.bitsLE(VT))
|
||||
return DAG.getNode(ISD::INSERT_SUBVECTOR, DL, VT, Passthru,
|
||||
ExtractedVal, DAG.getVectorIdxConstant(0, DL));
|
||||
return DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, VT, ExtractedVal,
|
||||
DAG.getVectorIdxConstant(0, DL));
|
||||
return DAG.getInsertSubvector(DL, Passthru, ExtractedVal, 0);
|
||||
return DAG.getExtractSubvector(DL, VT, ExtractedVal, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (VT.isFloatingPoint())
|
||||
return DAG.getNode(RISCVISD::VFMV_S_F_VL, DL, VT,
|
||||
DAG.getUNDEF(VT), Scalar, VL);
|
||||
return DAG.getNode(RISCVISD::VFMV_S_F_VL, DL, VT, DAG.getUNDEF(VT), Scalar,
|
||||
VL);
|
||||
|
||||
// Avoid the tricky legalization cases by falling back to using the
|
||||
// splat code which already handles it gracefully.
|
||||
@@ -4787,8 +4780,7 @@ static SDValue getDeinterleaveShiftAndTrunc(const SDLoc &DL, MVT VT,
|
||||
Res = DAG.getNode(ISD::TRUNCATE, DL, ResVT, Res);
|
||||
MVT CastVT = ResVT.changeVectorElementType(VT.getVectorElementType());
|
||||
Res = DAG.getBitcast(CastVT, Res);
|
||||
return DAG.getNode(ISD::INSERT_SUBVECTOR, DL, VT, DAG.getUNDEF(VT), Res,
|
||||
DAG.getVectorIdxConstant(0, DL));
|
||||
return DAG.getInsertSubvector(DL, DAG.getUNDEF(VT), Res, 0);
|
||||
}
|
||||
|
||||
/// Match a single source shuffle which is an identity except that some
|
||||
@@ -5248,8 +5240,7 @@ static SDValue lowerBitreverseShuffle(ShuffleVectorSDNode *SVN,
|
||||
// to insert it into the larger vector and then shift up the reversed bits
|
||||
// afterwards to get rid of the gap introduced.
|
||||
if (ViaEltSize > NumElts)
|
||||
V = DAG.getNode(ISD::INSERT_SUBVECTOR, DL, ViaBitVT, DAG.getUNDEF(ViaBitVT),
|
||||
V, DAG.getVectorIdxConstant(0, DL));
|
||||
V = DAG.getInsertSubvector(DL, DAG.getUNDEF(ViaBitVT), V, 0);
|
||||
|
||||
SDValue Res =
|
||||
DAG.getNode(ISD::BITREVERSE, DL, ViaVT, DAG.getBitcast(ViaVT, V));
|
||||
@@ -5263,8 +5254,7 @@ static SDValue lowerBitreverseShuffle(ShuffleVectorSDNode *SVN,
|
||||
Res = DAG.getBitcast(ViaBitVT, Res);
|
||||
|
||||
if (ViaEltSize > NumElts)
|
||||
Res = DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, VT, Res,
|
||||
DAG.getVectorIdxConstant(0, DL));
|
||||
Res = DAG.getExtractSubvector(DL, VT, Res, 0);
|
||||
return Res;
|
||||
}
|
||||
|
||||
@@ -5784,8 +5774,7 @@ static SDValue lowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG,
|
||||
return Concat;
|
||||
|
||||
SDValue Vec = DAG.getUNDEF(VT);
|
||||
return DAG.getNode(ISD::INSERT_SUBVECTOR, DL, VT, Vec, Concat,
|
||||
DAG.getVectorIdxConstant(0, DL));
|
||||
return DAG.getInsertSubvector(DL, Vec, Concat, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5834,10 +5823,8 @@ static SDValue lowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG,
|
||||
// Prefer vzip2a if available.
|
||||
// TODO: Extend to matching zip2b if EvenSrc and OddSrc allow.
|
||||
if (Subtarget.hasVendorXRivosVizip()) {
|
||||
EvenV = DAG.getNode(ISD::INSERT_SUBVECTOR, DL, VT, DAG.getUNDEF(VT),
|
||||
EvenV, DAG.getVectorIdxConstant(0, DL));
|
||||
OddV = DAG.getNode(ISD::INSERT_SUBVECTOR, DL, VT, DAG.getUNDEF(VT), OddV,
|
||||
DAG.getVectorIdxConstant(0, DL));
|
||||
EvenV = DAG.getInsertSubvector(DL, DAG.getUNDEF(VT), EvenV, 0);
|
||||
OddV = DAG.getInsertSubvector(DL, DAG.getUNDEF(VT), OddV, 0);
|
||||
return lowerVZIP(RISCVISD::RI_VZIP2A_VL, EvenV, OddV, DL, DAG, Subtarget);
|
||||
}
|
||||
return getWideningInterleave(EvenV, OddV, DL, DAG, Subtarget);
|
||||
@@ -5972,8 +5959,7 @@ static SDValue lowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG,
|
||||
if (isSpreadMask(Mask, Factor, Index)) {
|
||||
MVT NarrowVT =
|
||||
MVT::getVectorVT(VT.getVectorElementType(), NumElts / Factor);
|
||||
SDValue Src = DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, NarrowVT, V1,
|
||||
DAG.getVectorIdxConstant(0, DL));
|
||||
SDValue Src = DAG.getExtractSubvector(DL, NarrowVT, V1, 0);
|
||||
return getWideningSpread(Src, Factor, Index, DL, DAG);
|
||||
}
|
||||
}
|
||||
@@ -5994,12 +5980,10 @@ static SDValue lowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG,
|
||||
std::max((uint64_t)MinVLMAX, PowerOf2Ceil(MaxIdx + 1));
|
||||
if (NewNumElts != NumElts) {
|
||||
MVT NewVT = MVT::getVectorVT(VT.getVectorElementType(), NewNumElts);
|
||||
SDValue ZeroIdx = DAG.getVectorIdxConstant(0, DL);
|
||||
V1 = DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, NewVT, V1, ZeroIdx);
|
||||
V1 = DAG.getExtractSubvector(DL, NewVT, V1, 0);
|
||||
SDValue Res = DAG.getVectorShuffle(NewVT, DL, V1, DAG.getUNDEF(NewVT),
|
||||
Mask.take_front(NewNumElts));
|
||||
return DAG.getNode(ISD::INSERT_SUBVECTOR, DL, VT, DAG.getUNDEF(VT), Res,
|
||||
ZeroIdx);
|
||||
return DAG.getInsertSubvector(DL, DAG.getUNDEF(VT), Res, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6151,8 +6135,7 @@ static SDValue lowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG,
|
||||
DAG.getUNDEF(IndexContainerVT), LHSIndices,
|
||||
SlideAmt, TrueMask, VL);
|
||||
SDValue SubIndex =
|
||||
DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, SubIndexVT, LHSIndices,
|
||||
DAG.getVectorIdxConstant(0, DL));
|
||||
DAG.getExtractSubvector(DL, SubIndexVT, LHSIndices, 0);
|
||||
SDValue SubVec =
|
||||
DAG.getNode(GatherVVOpc, DL, M1VT, SubV1, SubIndex,
|
||||
DAG.getUNDEF(M1VT), InnerTrueMask, InnerVL);
|
||||
@@ -9951,8 +9934,7 @@ SDValue RISCVTargetLowering::lowerEXTRACT_VECTOR_ELT(SDValue Op,
|
||||
if (auto SmallerVT =
|
||||
getSmallestVTForIndex(ContainerVT, *MaxIdx, DL, DAG, Subtarget)) {
|
||||
ContainerVT = *SmallerVT;
|
||||
Vec = DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, ContainerVT, Vec,
|
||||
DAG.getConstant(0, DL, XLenVT));
|
||||
Vec = DAG.getExtractSubvector(DL, ContainerVT, Vec, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10959,12 +10941,11 @@ static SDValue lowerReductionSeq(unsigned RVVOpcode, MVT ResVT,
|
||||
// prove it is non-zero. For the AVL=0 case, we need the scalar to
|
||||
// be the result of the reduction operation.
|
||||
auto InnerVL = NonZeroAVL ? VL : DAG.getConstant(1, DL, XLenVT);
|
||||
SDValue InitialValue = lowerScalarInsert(StartValue, InnerVL, InnerVT, DL,
|
||||
DAG, Subtarget);
|
||||
SDValue InitialValue =
|
||||
lowerScalarInsert(StartValue, InnerVL, InnerVT, DL, DAG, Subtarget);
|
||||
if (M1VT != InnerVT)
|
||||
InitialValue =
|
||||
DAG.getNode(ISD::INSERT_SUBVECTOR, DL, M1VT, DAG.getUNDEF(M1VT),
|
||||
InitialValue, DAG.getVectorIdxConstant(0, DL));
|
||||
DAG.getInsertSubvector(DL, DAG.getUNDEF(M1VT), InitialValue, 0);
|
||||
SDValue PassThru = NonZeroAVL ? DAG.getUNDEF(M1VT) : InitialValue;
|
||||
SDValue Policy = DAG.getTargetConstant(RISCVVType::TAIL_AGNOSTIC, DL, XLenVT);
|
||||
SDValue Ops[] = {PassThru, Vec, InitialValue, Mask, VL, Policy};
|
||||
@@ -11214,9 +11195,7 @@ SDValue RISCVTargetLowering::lowerINSERT_SUBVECTOR(SDValue Op,
|
||||
Vec = convertToScalableVector(ContainerVT, Vec, DAG, Subtarget);
|
||||
}
|
||||
|
||||
SubVec = DAG.getNode(ISD::INSERT_SUBVECTOR, DL, ContainerVT,
|
||||
DAG.getUNDEF(ContainerVT), SubVec,
|
||||
DAG.getVectorIdxConstant(0, DL));
|
||||
SubVec = DAG.getInsertSubvector(DL, DAG.getUNDEF(ContainerVT), SubVec, 0);
|
||||
|
||||
SDValue Mask =
|
||||
getDefaultVLOps(VecVT, ContainerVT, DL, DAG, Subtarget).first;
|
||||
@@ -11342,9 +11321,7 @@ SDValue RISCVTargetLowering::lowerINSERT_SUBVECTOR(SDValue Op,
|
||||
DAG.getVectorIdxConstant(AlignedIdx, DL));
|
||||
}
|
||||
|
||||
SubVec = DAG.getNode(ISD::INSERT_SUBVECTOR, DL, InterSubVT,
|
||||
DAG.getUNDEF(InterSubVT), SubVec,
|
||||
DAG.getVectorIdxConstant(0, DL));
|
||||
SubVec = DAG.getInsertSubvector(DL, DAG.getUNDEF(InterSubVT), SubVec, 0);
|
||||
|
||||
auto [Mask, VL] = getDefaultVLOps(VecVT, ContainerVecVT, DL, DAG, Subtarget);
|
||||
|
||||
@@ -11458,8 +11435,7 @@ SDValue RISCVTargetLowering::lowerEXTRACT_SUBVECTOR(SDValue Op,
|
||||
if (auto ShrunkVT =
|
||||
getSmallestVTForIndex(ContainerVT, LastIdx, DL, DAG, Subtarget)) {
|
||||
ContainerVT = *ShrunkVT;
|
||||
Vec = DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, ContainerVT, Vec,
|
||||
DAG.getVectorIdxConstant(0, DL));
|
||||
Vec = DAG.getExtractSubvector(DL, ContainerVT, Vec, 0);
|
||||
}
|
||||
|
||||
SDValue Mask =
|
||||
@@ -11472,8 +11448,7 @@ SDValue RISCVTargetLowering::lowerEXTRACT_SUBVECTOR(SDValue Op,
|
||||
getVSlidedown(DAG, Subtarget, DL, ContainerVT,
|
||||
DAG.getUNDEF(ContainerVT), Vec, SlidedownAmt, Mask, VL);
|
||||
// Now we can use a cast-like subvector extract to get the result.
|
||||
Slidedown = DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, SubVecVT, Slidedown,
|
||||
DAG.getVectorIdxConstant(0, DL));
|
||||
Slidedown = DAG.getExtractSubvector(DL, SubVecVT, Slidedown, 0);
|
||||
return DAG.getBitcast(Op.getValueType(), Slidedown);
|
||||
}
|
||||
|
||||
@@ -11560,8 +11535,7 @@ SDValue RISCVTargetLowering::lowerEXTRACT_SUBVECTOR(SDValue Op,
|
||||
|
||||
// Now the vector is in the right position, extract our final subvector. This
|
||||
// should resolve to a COPY.
|
||||
Slidedown = DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, SubVecVT, Slidedown,
|
||||
DAG.getVectorIdxConstant(0, DL));
|
||||
Slidedown = DAG.getExtractSubvector(DL, SubVecVT, Slidedown, 0);
|
||||
|
||||
// We might have bitcast from a mask type: cast back to the original type if
|
||||
// required.
|
||||
@@ -11664,16 +11638,15 @@ SDValue RISCVTargetLowering::lowerVECTOR_DEINTERLEAVE(SDValue Op,
|
||||
if (SDValue Src = foldConcatVector(V1, V2);
|
||||
Src && getLMUL1VT(VT).bitsGT(VT)) {
|
||||
EVT NewVT = VT.getDoubleNumVectorElementsVT();
|
||||
SDValue ZeroIdx = DAG.getVectorIdxConstant(0, DL);
|
||||
Src = DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, NewVT, Src, ZeroIdx);
|
||||
Src = DAG.getExtractSubvector(DL, NewVT, Src, 0);
|
||||
// Freeze the source so we can increase its use count.
|
||||
Src = DAG.getFreeze(Src);
|
||||
SDValue Even = lowerVZIP(RISCVISD::RI_VUNZIP2A_VL, Src,
|
||||
DAG.getUNDEF(NewVT), DL, DAG, Subtarget);
|
||||
SDValue Odd = lowerVZIP(RISCVISD::RI_VUNZIP2B_VL, Src,
|
||||
DAG.getUNDEF(NewVT), DL, DAG, Subtarget);
|
||||
Even = DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, VT, Even, ZeroIdx);
|
||||
Odd = DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, VT, Odd, ZeroIdx);
|
||||
Even = DAG.getExtractSubvector(DL, VT, Even, 0);
|
||||
Odd = DAG.getExtractSubvector(DL, VT, Odd, 0);
|
||||
return DAG.getMergeValues({Even, Odd}, DL);
|
||||
}
|
||||
|
||||
@@ -11717,13 +11690,11 @@ SDValue RISCVTargetLowering::lowerVECTOR_DEINTERLEAVE(SDValue Op,
|
||||
|
||||
SDValue EvenSplat = DAG.getConstant(0b01010101, DL, MVT::nxv8i8);
|
||||
EvenSplat = DAG.getBitcast(MVT::nxv64i1, EvenSplat);
|
||||
SDValue EvenMask = DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, MaskVT,
|
||||
EvenSplat, DAG.getVectorIdxConstant(0, DL));
|
||||
SDValue EvenMask = DAG.getExtractSubvector(DL, MaskVT, EvenSplat, 0);
|
||||
|
||||
SDValue OddSplat = DAG.getConstant(0b10101010, DL, MVT::nxv8i8);
|
||||
OddSplat = DAG.getBitcast(MVT::nxv64i1, OddSplat);
|
||||
SDValue OddMask = DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, MaskVT, OddSplat,
|
||||
DAG.getVectorIdxConstant(0, DL));
|
||||
SDValue OddMask = DAG.getExtractSubvector(DL, MaskVT, OddSplat, 0);
|
||||
|
||||
// vcompress the even and odd elements into two separate vectors
|
||||
SDValue EvenWide = DAG.getNode(ISD::VECTOR_COMPRESS, DL, ConcatVT, Concat,
|
||||
@@ -12103,9 +12074,7 @@ SDValue RISCVTargetLowering::lowerVECTOR_REVERSE(SDValue Op,
|
||||
Hi = DAG.getNode(ISD::VECTOR_REVERSE, DL, HiVT, Hi);
|
||||
// Reassemble the low and high pieces reversed.
|
||||
// FIXME: This is a CONCAT_VECTORS.
|
||||
SDValue Res =
|
||||
DAG.getNode(ISD::INSERT_SUBVECTOR, DL, VecVT, DAG.getUNDEF(VecVT), Hi,
|
||||
DAG.getVectorIdxConstant(0, DL));
|
||||
SDValue Res = DAG.getInsertSubvector(DL, DAG.getUNDEF(VecVT), Hi, 0);
|
||||
return DAG.getNode(
|
||||
ISD::INSERT_SUBVECTOR, DL, VecVT, Res, Lo,
|
||||
DAG.getVectorIdxConstant(LoVT.getVectorMinNumElements(), DL));
|
||||
@@ -12254,8 +12223,7 @@ RISCVTargetLowering::lowerFixedLengthVectorStoreToRVV(SDValue Op,
|
||||
if (VT.getVectorElementType() == MVT::i1 && VT.getVectorNumElements() < 8) {
|
||||
VT = MVT::v8i1;
|
||||
StoreVal =
|
||||
DAG.getNode(ISD::INSERT_SUBVECTOR, DL, VT, DAG.getConstant(0, DL, VT),
|
||||
StoreVal, DAG.getVectorIdxConstant(0, DL));
|
||||
DAG.getInsertSubvector(DL, DAG.getConstant(0, DL, VT), StoreVal, 0);
|
||||
}
|
||||
|
||||
MVT ContainerVT = getContainerForFixedLengthVector(VT);
|
||||
@@ -14687,8 +14655,7 @@ static SDValue combineBinOpToReduce(SDNode *N, SelectionDAG &DAG,
|
||||
// If we looked through an INSERT_SUBVECTOR we need to restore it.
|
||||
if (ScalarVT != ScalarV.getValueType())
|
||||
NewScalarV =
|
||||
DAG.getNode(ISD::INSERT_SUBVECTOR, DL, ScalarVT, DAG.getUNDEF(ScalarVT),
|
||||
NewScalarV, DAG.getVectorIdxConstant(0, DL));
|
||||
DAG.getInsertSubvector(DL, DAG.getUNDEF(ScalarVT), NewScalarV, 0);
|
||||
|
||||
SDValue Ops[] = {Reduce.getOperand(0), Reduce.getOperand(1),
|
||||
NewScalarV, Reduce.getOperand(3),
|
||||
@@ -19966,13 +19933,10 @@ SDValue RISCVTargetLowering::PerformDAGCombine(SDNode *N,
|
||||
// Use M1 or smaller to avoid over constraining register allocation
|
||||
const MVT M1VT = getLMUL1VT(VT);
|
||||
if (M1VT.bitsLT(VT)) {
|
||||
SDValue M1Passthru =
|
||||
DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, M1VT, Passthru,
|
||||
DAG.getVectorIdxConstant(0, DL));
|
||||
SDValue M1Passthru = DAG.getExtractSubvector(DL, M1VT, Passthru, 0);
|
||||
SDValue Result =
|
||||
DAG.getNode(N->getOpcode(), DL, M1VT, M1Passthru, Scalar, VL);
|
||||
Result = DAG.getNode(ISD::INSERT_SUBVECTOR, DL, VT, Passthru, Result,
|
||||
DAG.getVectorIdxConstant(0, DL));
|
||||
Result = DAG.getInsertSubvector(DL, Passthru, Result, 0);
|
||||
return Result;
|
||||
}
|
||||
|
||||
@@ -19991,8 +19955,7 @@ SDValue RISCVTargetLowering::PerformDAGCombine(SDNode *N,
|
||||
MVT VecVT = N->getOperand(0).getSimpleValueType();
|
||||
const MVT M1VT = getLMUL1VT(VecVT);
|
||||
if (M1VT.bitsLT(VecVT)) {
|
||||
Vec = DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, M1VT, Vec,
|
||||
DAG.getVectorIdxConstant(0, DL));
|
||||
Vec = DAG.getExtractSubvector(DL, M1VT, Vec, 0);
|
||||
return DAG.getNode(RISCVISD::VMV_X_S, DL, N->getSimpleValueType(0), Vec);
|
||||
}
|
||||
break;
|
||||
@@ -23631,15 +23594,11 @@ bool RISCVTargetLowering::splitValueIntoRegisterParts(
|
||||
assert(Count != 0 && "The number of element should not be zero.");
|
||||
EVT SameEltTypeVT =
|
||||
EVT::getVectorVT(Context, ValueEltVT, Count, /*IsScalable=*/true);
|
||||
Val = DAG.getNode(ISD::INSERT_SUBVECTOR, DL, SameEltTypeVT,
|
||||
DAG.getUNDEF(SameEltTypeVT), Val,
|
||||
DAG.getVectorIdxConstant(0, DL));
|
||||
Val = DAG.getInsertSubvector(DL, DAG.getUNDEF(SameEltTypeVT), Val, 0);
|
||||
}
|
||||
Val = DAG.getNode(ISD::BITCAST, DL, PartVT, Val);
|
||||
} else {
|
||||
Val =
|
||||
DAG.getNode(ISD::INSERT_SUBVECTOR, DL, PartVT, DAG.getUNDEF(PartVT),
|
||||
Val, DAG.getVectorIdxConstant(0, DL));
|
||||
Val = DAG.getInsertSubvector(DL, DAG.getUNDEF(PartVT), Val, 0);
|
||||
}
|
||||
Parts[0] = Val;
|
||||
return true;
|
||||
@@ -23708,8 +23667,7 @@ SDValue RISCVTargetLowering::joinRegisterPartsIntoValue(
|
||||
EVT::getVectorVT(Context, ValueEltVT, Count, /*IsScalable=*/true);
|
||||
Val = DAG.getNode(ISD::BITCAST, DL, SameEltTypeVT, Val);
|
||||
}
|
||||
Val = DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, ValueVT, Val,
|
||||
DAG.getVectorIdxConstant(0, DL));
|
||||
Val = DAG.getExtractSubvector(DL, ValueVT, Val, 0);
|
||||
return Val;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user