/// <0, Step, Step * 2, Step * 3, ...>
SDValue getStepVector(const SDLoc &DL, EVT ResVT, SDValue Step);
+ /// Returns a vector of type ResVT whose elements contain the linear sequence
+ /// <0, 1, 2, 3, ...>
+ SDValue getStepVector(const SDLoc &DL, EVT ResVT);
+
/// Returns an ISD::VECTOR_SHUFFLE node semantically equivalent to
/// the shuffle node in input but with swapped operands.
///
return SDValue(CondCodeNodes[Cond], 0);
}
+SDValue SelectionDAG::getStepVector(const SDLoc &DL, EVT ResVT) {
+ EVT OpVT = TLI->getTypeToTransformTo(*getContext(), ResVT.getScalarType());
+ return getStepVector(DL, ResVT, getConstant(1, DL, OpVT));
+}
+
SDValue SelectionDAG::getStepVector(const SDLoc &DL, EVT ResVT, SDValue Step) {
if (ResVT.isScalableVector())
return getNode(ISD::STEP_VECTOR, DL, ResVT, Step);
const TargetLowering &TLI = DAG.getTargetLoweringInfo();
auto DL = getCurSDLoc();
EVT ResultVT = TLI.getValueType(DAG.getDataLayout(), I.getType());
- EVT OpVT =
- TLI.getTypeToTransformTo(*DAG.getContext(), ResultVT.getScalarType());
- SDValue Step = DAG.getConstant(1, DL, OpVT);
- setValue(&I, DAG.getStepVector(DL, ResultVT, Step));
+ setValue(&I, DAG.getStepVector(DL, ResultVT));
}
void SelectionDAGBuilder::visitVectorReverse(const CallInst &I) {
SDValue SplatOne = DAG.getNode(ISD::SPLAT_VECTOR, DL, MVT::nxv2i64, One);
// create the vector 0,1,0,1,...
- SDValue SV = DAG.getNode(ISD::STEP_VECTOR, DL, MVT::nxv2i64, One);
+ SDValue SV = DAG.getStepVector(DL, MVT::nxv2i64);
SV = DAG.getNode(ISD::AND, DL, MVT::nxv2i64, SV, SplatOne);
// create the vector idx64,idx64+1,idx64,idx64+1,...
ScalarTy = MVT::i32;
// Lower index_vector(base, step) to mul(step step_vector(1)) + splat(base).
- SDValue One = DAG.getConstant(1, DL, ScalarTy);
- SDValue StepVector =
- DAG.getNode(ISD::STEP_VECTOR, DL, N->getValueType(0), One);
+ SDValue StepVector = DAG.getStepVector(DL, N->getValueType(0));
SDValue Step = DAG.getNode(ISD::SPLAT_VECTOR, DL, N->getValueType(0), Op2);
SDValue Mul = DAG.getNode(ISD::MUL, DL, N->getValueType(0), StepVector, Step);
SDValue Base = DAG.getNode(ISD::SPLAT_VECTOR, DL, N->getValueType(0), Op1);