@@ -3507,63 +3507,63 @@ static std::optional<VIDSequence> isSimpleVIDSequence(SDValue Op,
35073507
35083508// Match a splatted value (SPLAT_VECTOR/BUILD_VECTOR) of an EXTRACT_VECTOR_ELT
35093509// and lower it as a VRGATHER_VX_VL from the source vector.
3510- static SDValue matchSplatAsGather(SDValue SplatVal, MVT SrcVT , const SDLoc &DL,
3510+ static SDValue matchSplatAsGather(SDValue SplatVal, MVT VT , const SDLoc &DL,
35113511 SelectionDAG &DAG,
35123512 const RISCVSubtarget &Subtarget) {
35133513 if (SplatVal.getOpcode() != ISD::EXTRACT_VECTOR_ELT)
35143514 return SDValue();
3515- SDValue SplatVec = SplatVal.getOperand(0);
3515+ SDValue Vec = SplatVal.getOperand(0);
35163516 // Don't perform this optimization for i1 vectors, or if the element types are
35173517 // different
35183518 // FIXME: Support i1 vectors, maybe by promoting to i8?
3519- MVT EltTy = SrcVT .getVectorElementType();
3520- MVT VecVT = SplatVec .getSimpleValueType();
3519+ MVT EltTy = VT .getVectorElementType();
3520+ MVT VecVT = Vec .getSimpleValueType();
35213521 if (EltTy == MVT::i1 || EltTy != VecVT.getVectorElementType())
35223522 return SDValue();
35233523 SDValue Idx = SplatVal.getOperand(1);
35243524 // The index must be a legal type.
35253525 if (Idx.getValueType() != Subtarget.getXLenVT())
35263526 return SDValue();
35273527
3528- // Check that we know Idx lies within SrcVT
3528+ // Check that we know Idx lies within VT
35293529 if (auto *CIdx = dyn_cast<ConstantSDNode>(Idx)) {
3530- if (CIdx->getZExtValue() >= SrcVT .getVectorElementCount().getKnownMinValue())
3530+ if (CIdx->getZExtValue() >= VT .getVectorElementCount().getKnownMinValue())
35313531 return SDValue();
35323532 }
3533- else if (!TypeSize::isKnownLE(SplatVec .getValueSizeInBits(), SrcVT .getSizeInBits()))
3533+ else if (!TypeSize::isKnownLE(Vec .getValueSizeInBits(), VT .getSizeInBits()))
35343534 return SDValue();
35353535
35363536 // Convert fixed length vectors to scalable
3537- MVT ContainerVT = SrcVT ;
3538- if (SrcVT .isFixedLengthVector())
3539- ContainerVT = getContainerForFixedLengthVector(DAG, SrcVT , Subtarget);
3537+ MVT ContainerVT = VT ;
3538+ if (VT .isFixedLengthVector())
3539+ ContainerVT = getContainerForFixedLengthVector(DAG, VT , Subtarget);
35403540
35413541 MVT ContainerVecVT = VecVT;
35423542 if (VecVT.isFixedLengthVector()) {
35433543 ContainerVecVT = getContainerForFixedLengthVector(DAG, VecVT, Subtarget);
3544- SplatVec = convertToScalableVector(ContainerVecVT, SplatVec , DAG, Subtarget);
3544+ Vec = convertToScalableVector(ContainerVecVT, Vec , DAG, Subtarget);
35453545 }
35463546
3547- // Put SplatVec in a SrcVT sized vector
3547+ // Put Vec in a VT sized vector
35483548 if (ContainerVecVT.getVectorMinNumElements() <
35493549 ContainerVT.getVectorMinNumElements())
3550- SplatVec = DAG.getNode(ISD::INSERT_SUBVECTOR, DL, ContainerVT,
3551- DAG.getUNDEF(ContainerVT), SplatVec ,
3550+ Vec = DAG.getNode(ISD::INSERT_SUBVECTOR, DL, ContainerVT,
3551+ DAG.getUNDEF(ContainerVT), Vec ,
35523552 DAG.getVectorIdxConstant(0, DL));
35533553 else
3554- SplatVec = DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, ContainerVT, SplatVec ,
3554+ Vec = DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, ContainerVT, Vec ,
35553555 DAG.getVectorIdxConstant(0, DL));
35563556
3557- // We checked that Idx fits inside SrcVT earlier
3558- auto [Mask, VL] = getDefaultVLOps(SrcVT , ContainerVT, DL, DAG, Subtarget);
3557+ // We checked that Idx fits inside VT earlier
3558+ auto [Mask, VL] = getDefaultVLOps(VT , ContainerVT, DL, DAG, Subtarget);
35593559
3560- SDValue Gather = DAG.getNode(RISCVISD::VRGATHER_VX_VL, DL, ContainerVT, SplatVec ,
3560+ SDValue Gather = DAG.getNode(RISCVISD::VRGATHER_VX_VL, DL, ContainerVT, Vec ,
35613561 Idx, DAG.getUNDEF(ContainerVT), Mask, VL);
35623562
3563- if (!SrcVT .isFixedLengthVector())
3563+ if (!VT .isFixedLengthVector())
35643564 return Gather;
35653565
3566- return convertFromScalableVector(SrcVT , Gather, DAG, Subtarget);
3566+ return convertFromScalableVector(VT , Gather, DAG, Subtarget);
35673567}
35683568
35693569/// Try and optimize BUILD_VECTORs with "dominant values" - these are values
0 commit comments