@@ -3805,8 +3805,7 @@ static SDValue lowerBuildVectorViaDominantValues(SDValue Op, SelectionDAG &DAG,
3805
3805
if (V.isUndef() || !Processed.insert(V).second)
3806
3806
continue;
3807
3807
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());
3810
3809
} else {
3811
3810
// Blend in all instances of this value using a VSELECT, using a
3812
3811
// mask where each bit signals whether that element is the one
@@ -3963,10 +3962,9 @@ static SDValue lowerBuildVectorOfConstants(SDValue Op, SelectionDAG &DAG,
3963
3962
if (ViaIntVT == MVT::i32)
3964
3963
SplatValue = SignExtend64<32>(SplatValue);
3965
3964
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);
3970
3968
if (ViaVecLen != 1)
3971
3969
Vec = DAG.getExtractSubvector(DL, MVT::getVectorVT(ViaIntVT, 1), Vec, 0);
3972
3970
return DAG.getBitcast(VT, Vec);
@@ -7180,9 +7178,8 @@ SDValue RISCVTargetLowering::LowerOperation(SDValue Op,
7180
7178
EVT BVT = EVT::getVectorVT(*DAG.getContext(), Op0VT, 1);
7181
7179
if (!isTypeLegal(BVT))
7182
7180
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));
7186
7183
}
7187
7184
return SDValue();
7188
7185
}
@@ -7194,8 +7191,7 @@ SDValue RISCVTargetLowering::LowerOperation(SDValue Op,
7194
7191
if (!isTypeLegal(BVT))
7195
7192
return SDValue();
7196
7193
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);
7199
7195
}
7200
7196
return SDValue();
7201
7197
}
@@ -9916,8 +9912,7 @@ SDValue RISCVTargetLowering::lowerEXTRACT_VECTOR_ELT(SDValue Op,
9916
9912
9917
9913
if (!EltVT.isInteger()) {
9918
9914
// 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);
9921
9916
}
9922
9917
9923
9918
SDValue Elt0 = DAG.getNode(RISCVISD::VMV_X_S, DL, XLenVT, Vec);
@@ -10321,8 +10316,7 @@ SDValue RISCVTargetLowering::LowerINTRINSIC_WO_CHAIN(SDValue Op,
10321
10316
return DAG.getNode(ISD::TRUNCATE, DL, Op.getValueType(), Res);
10322
10317
}
10323
10318
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);
10326
10320
case Intrinsic::riscv_vmv_v_x:
10327
10321
return lowerScalarSplat(Op.getOperand(1), Op.getOperand(2),
10328
10322
Op.getOperand(3), Op.getSimpleValueType(), DL, DAG,
@@ -10856,8 +10850,7 @@ static SDValue lowerReductionSeq(unsigned RVVOpcode, MVT ResVT,
10856
10850
SDValue Policy = DAG.getTargetConstant(RISCVVType::TAIL_AGNOSTIC, DL, XLenVT);
10857
10851
SDValue Ops[] = {PassThru, Vec, InitialValue, Mask, VL, Policy};
10858
10852
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);
10861
10854
}
10862
10855
10863
10856
SDValue RISCVTargetLowering::lowerVECREDUCE(SDValue Op,
@@ -10902,8 +10895,7 @@ SDValue RISCVTargetLowering::lowerVECREDUCE(SDValue Op,
10902
10895
case ISD::UMIN:
10903
10896
case ISD::SMAX:
10904
10897
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);
10907
10899
}
10908
10900
return lowerReductionSeq(RVVOpcode, Op.getSimpleValueType(), StartV, Vec,
10909
10901
Mask, VL, DL, DAG, Subtarget);
@@ -10934,9 +10926,7 @@ getRVVFPReductionOpAndOperands(SDValue Op, SelectionDAG &DAG, EVT EltVT,
10934
10926
case ISD::VECREDUCE_FMAXIMUM:
10935
10927
case ISD::VECREDUCE_FMIN:
10936
10928
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);
10940
10930
unsigned RVVOpc =
10941
10931
(Opcode == ISD::VECREDUCE_FMIN || Opcode == ISD::VECREDUCE_FMINIMUM)
10942
10932
? RISCVISD::VECREDUCE_FMIN_VL
@@ -14055,8 +14045,7 @@ void RISCVTargetLowering::ReplaceNodeResults(SDNode *N,
14055
14045
EVT BVT = EVT::getVectorVT(*DAG.getContext(), VT, 1);
14056
14046
if (isTypeLegal(BVT)) {
14057
14047
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));
14060
14049
}
14061
14050
}
14062
14051
break;
@@ -18202,12 +18191,11 @@ static SDValue performINSERT_VECTOR_ELTCombine(SDNode *N, SelectionDAG &DAG,
18202
18191
if (ConcatVT.getVectorElementType() != InVal.getValueType())
18203
18192
return SDValue();
18204
18193
unsigned ConcatNumElts = ConcatVT.getVectorNumElements();
18205
- SDValue NewIdx = DAG.getVectorIdxConstant( Elt % ConcatNumElts, DL) ;
18194
+ unsigned NewIdx = Elt % ConcatNumElts;
18206
18195
18207
18196
unsigned ConcatOpIdx = Elt / ConcatNumElts;
18208
18197
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);
18211
18199
18212
18200
SmallVector<SDValue> ConcatOps(InVec->ops());
18213
18201
ConcatOps[ConcatOpIdx] = ConcatOp;
0 commit comments