@@ -3805,8 +3805,7 @@ static SDValue lowerBuildVectorViaDominantValues(SDValue Op, SelectionDAG &DAG,
38053805 if (V.isUndef() || !Processed.insert(V).second)
38063806 continue;
38073807 if (ValueCounts[V] == 1) {
3808- Vec = DAG.getNode(ISD::INSERT_VECTOR_ELT, DL, VT, Vec, V,
3809- DAG.getVectorIdxConstant(OpIdx.index(), DL));
3808+ Vec = DAG.getInsertVectorElt(DL, Vec, V, OpIdx.index());
38103809 } else {
38113810 // Blend in all instances of this value using a VSELECT, using a
38123811 // mask where each bit signals whether that element is the one
@@ -3963,10 +3962,9 @@ static SDValue lowerBuildVectorOfConstants(SDValue Op, SelectionDAG &DAG,
39633962 if (ViaIntVT == MVT::i32)
39643963 SplatValue = SignExtend64<32>(SplatValue);
39653964
3966- SDValue Vec = DAG.getNode(ISD::INSERT_VECTOR_ELT, DL, ViaVecVT,
3967- DAG.getUNDEF(ViaVecVT),
3968- DAG.getSignedConstant(SplatValue, DL, XLenVT),
3969- DAG.getVectorIdxConstant(0, DL));
3965+ SDValue Vec = DAG.getInsertVectorElt(
3966+ DL, DAG.getUNDEF(ViaVecVT),
3967+ DAG.getSignedConstant(SplatValue, DL, XLenVT), 0);
39703968 if (ViaVecLen != 1)
39713969 Vec = DAG.getExtractSubvector(DL, MVT::getVectorVT(ViaIntVT, 1), Vec, 0);
39723970 return DAG.getBitcast(VT, Vec);
@@ -7180,9 +7178,8 @@ SDValue RISCVTargetLowering::LowerOperation(SDValue Op,
71807178 EVT BVT = EVT::getVectorVT(*DAG.getContext(), Op0VT, 1);
71817179 if (!isTypeLegal(BVT))
71827180 return SDValue();
7183- return DAG.getBitcast(VT, DAG.getNode(ISD::INSERT_VECTOR_ELT, DL, BVT,
7184- DAG.getUNDEF(BVT), Op0,
7185- DAG.getVectorIdxConstant(0, DL)));
7181+ return DAG.getBitcast(
7182+ VT, DAG.getInsertVectorElt(DL, DAG.getUNDEF(BVT), Op0, 0));
71867183 }
71877184 return SDValue();
71887185 }
@@ -7194,8 +7191,7 @@ SDValue RISCVTargetLowering::LowerOperation(SDValue Op,
71947191 if (!isTypeLegal(BVT))
71957192 return SDValue();
71967193 SDValue BVec = DAG.getBitcast(BVT, Op0);
7197- return DAG.getNode(ISD::EXTRACT_VECTOR_ELT, DL, VT, BVec,
7198- DAG.getVectorIdxConstant(0, DL));
7194+ return DAG.getExtractVectorElt(DL, VT, BVec, 0);
71997195 }
72007196 return SDValue();
72017197 }
@@ -9916,8 +9912,7 @@ SDValue RISCVTargetLowering::lowerEXTRACT_VECTOR_ELT(SDValue Op,
99169912
99179913 if (!EltVT.isInteger()) {
99189914 // Floating-point extracts are handled in TableGen.
9919- return DAG.getNode(ISD::EXTRACT_VECTOR_ELT, DL, EltVT, Vec,
9920- DAG.getVectorIdxConstant(0, DL));
9915+ return DAG.getExtractVectorElt(DL, EltVT, Vec, 0);
99219916 }
99229917
99239918 SDValue Elt0 = DAG.getNode(RISCVISD::VMV_X_S, DL, XLenVT, Vec);
@@ -10321,8 +10316,7 @@ SDValue RISCVTargetLowering::LowerINTRINSIC_WO_CHAIN(SDValue Op,
1032110316 return DAG.getNode(ISD::TRUNCATE, DL, Op.getValueType(), Res);
1032210317 }
1032310318 case Intrinsic::riscv_vfmv_f_s:
10324- return DAG.getNode(ISD::EXTRACT_VECTOR_ELT, DL, Op.getValueType(),
10325- Op.getOperand(1), DAG.getVectorIdxConstant(0, DL));
10319+ return DAG.getExtractVectorElt(DL, Op.getValueType(), Op.getOperand(1), 0);
1032610320 case Intrinsic::riscv_vmv_v_x:
1032710321 return lowerScalarSplat(Op.getOperand(1), Op.getOperand(2),
1032810322 Op.getOperand(3), Op.getSimpleValueType(), DL, DAG,
@@ -10856,8 +10850,7 @@ static SDValue lowerReductionSeq(unsigned RVVOpcode, MVT ResVT,
1085610850 SDValue Policy = DAG.getTargetConstant(RISCVVType::TAIL_AGNOSTIC, DL, XLenVT);
1085710851 SDValue Ops[] = {PassThru, Vec, InitialValue, Mask, VL, Policy};
1085810852 SDValue Reduction = DAG.getNode(RVVOpcode, DL, M1VT, Ops);
10859- return DAG.getNode(ISD::EXTRACT_VECTOR_ELT, DL, ResVT, Reduction,
10860- DAG.getVectorIdxConstant(0, DL));
10853+ return DAG.getExtractVectorElt(DL, ResVT, Reduction, 0);
1086110854}
1086210855
1086310856SDValue RISCVTargetLowering::lowerVECREDUCE(SDValue Op,
@@ -10902,8 +10895,7 @@ SDValue RISCVTargetLowering::lowerVECREDUCE(SDValue Op,
1090210895 case ISD::UMIN:
1090310896 case ISD::SMAX:
1090410897 case ISD::SMIN:
10905- StartV = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, DL, VecEltVT, Vec,
10906- DAG.getVectorIdxConstant(0, DL));
10898+ StartV = DAG.getExtractVectorElt(DL, VecEltVT, Vec, 0);
1090710899 }
1090810900 return lowerReductionSeq(RVVOpcode, Op.getSimpleValueType(), StartV, Vec,
1090910901 Mask, VL, DL, DAG, Subtarget);
@@ -10934,9 +10926,7 @@ getRVVFPReductionOpAndOperands(SDValue Op, SelectionDAG &DAG, EVT EltVT,
1093410926 case ISD::VECREDUCE_FMAXIMUM:
1093510927 case ISD::VECREDUCE_FMIN:
1093610928 case ISD::VECREDUCE_FMAX: {
10937- SDValue Front =
10938- DAG.getNode(ISD::EXTRACT_VECTOR_ELT, DL, EltVT, Op.getOperand(0),
10939- DAG.getVectorIdxConstant(0, DL));
10929+ SDValue Front = DAG.getExtractVectorElt(DL, EltVT, Op.getOperand(0), 0);
1094010930 unsigned RVVOpc =
1094110931 (Opcode == ISD::VECREDUCE_FMIN || Opcode == ISD::VECREDUCE_FMINIMUM)
1094210932 ? RISCVISD::VECREDUCE_FMIN_VL
@@ -14055,8 +14045,7 @@ void RISCVTargetLowering::ReplaceNodeResults(SDNode *N,
1405514045 EVT BVT = EVT::getVectorVT(*DAG.getContext(), VT, 1);
1405614046 if (isTypeLegal(BVT)) {
1405714047 SDValue BVec = DAG.getBitcast(BVT, Op0);
14058- Results.push_back(DAG.getNode(ISD::EXTRACT_VECTOR_ELT, DL, VT, BVec,
14059- DAG.getVectorIdxConstant(0, DL)));
14048+ Results.push_back(DAG.getExtractVectorElt(DL, VT, BVec, 0));
1406014049 }
1406114050 }
1406214051 break;
@@ -18202,12 +18191,11 @@ static SDValue performINSERT_VECTOR_ELTCombine(SDNode *N, SelectionDAG &DAG,
1820218191 if (ConcatVT.getVectorElementType() != InVal.getValueType())
1820318192 return SDValue();
1820418193 unsigned ConcatNumElts = ConcatVT.getVectorNumElements();
18205- SDValue NewIdx = DAG.getVectorIdxConstant( Elt % ConcatNumElts, DL) ;
18194+ unsigned NewIdx = Elt % ConcatNumElts;
1820618195
1820718196 unsigned ConcatOpIdx = Elt / ConcatNumElts;
1820818197 SDValue ConcatOp = InVec.getOperand(ConcatOpIdx);
18209- ConcatOp = DAG.getNode(ISD::INSERT_VECTOR_ELT, DL, ConcatVT,
18210- ConcatOp, InVal, NewIdx);
18198+ ConcatOp = DAG.getInsertVectorElt(DL, ConcatOp, InVal, NewIdx);
1821118199
1821218200 SmallVector<SDValue> ConcatOps(InVec->ops());
1821318201 ConcatOps[ConcatOpIdx] = ConcatOp;
0 commit comments