@@ -10078,7 +10078,8 @@ SDValue TargetLowering::expandVectorFindLastActive(SDNode *N,
1007810078 VScaleRange = getVScaleRange(&DAG.getMachineFunction().getFunction(), 64);
1007910079 const TargetLowering &TLI = DAG.getTargetLoweringInfo();
1008010080 uint64_t EltWidth = TLI.getBitWidthForCttzElements(
10081- EVT(getVectorIdxTy(DAG.getDataLayout())), MaskVT.getVectorElementCount(),
10081+ EVT(getVectorIdxTy(DAG.getDataLayout())).getTypeForEVT(*DAG.getContext()),
10082+ MaskVT.getVectorElementCount(),
1008210083 /*ZeroIsPoison=*/true, &VScaleRange);
1008310084 // If the step vector element type is smaller than the mask element type,
1008410085 // use the mask type directly to avoid widening issues.
@@ -12540,64 +12541,6 @@ SDValue TargetLowering::expandVECTOR_COMPRESS(SDNode *Node,
1254012541 return DAG.getLoad(VecVT, DL, Chain, StackPtr, PtrInfo);
1254112542}
1254212543
12543- SDValue TargetLowering::expandCttzElts(SDNode *Node, SelectionDAG &DAG) const {
12544- SDLoc DL(Node);
12545- EVT VT = Node->getValueType(0);
12546- SDValue Op = Node->getOperand(0);
12547- EVT OpVT = Op.getValueType();
12548-
12549- if (OpVT.getVectorElementType() != MVT::i1) {
12550- // Compare the input vector elements to zero & use to count trailing zeros.
12551- SDValue AllZero = DAG.getConstant(0, DL, OpVT);
12552- EVT I1OpVT = EVT::getVectorVT(*DAG.getContext(), MVT::i1,
12553- OpVT.getVectorElementCount());
12554- // If cttz_elts is legal for the i1 type, use it instead of expanding.
12555- if (isOperationLegalOrCustom(Node->getOpcode(), I1OpVT)) {
12556- Op = DAG.getSetCC(DL, I1OpVT, Op, AllZero, ISD::SETNE);
12557- return DAG.getNode(Node->getOpcode(), DL, VT, Op);
12558- }
12559-
12560- Op = DAG.getSetCC(DL, OpVT, Op, AllZero, ISD::SETNE);
12561- }
12562-
12563- // If the zero-is-poison flag is set, we can assume the upper limit
12564- // of the result is VF-1.
12565- bool ZeroIsPoison = Node->getOpcode() == ISD::CTTZ_ELTS_ZERO_POISON;
12566- ConstantRange VScaleRange(1, true); // Dummy value.
12567- if (OpVT.isScalableVector())
12568- VScaleRange = getVScaleRange(&DAG.getMachineFunction().getFunction(), 64);
12569- unsigned EltWidth = getBitWidthForCttzElements(
12570- VT, OpVT.getVectorElementCount(), ZeroIsPoison, &VScaleRange);
12571-
12572- EVT NewEltVT = MVT::getIntegerVT(EltWidth);
12573-
12574- // Create the new vector type & get the vector length
12575- EVT NewVT = EVT::getVectorVT(*DAG.getContext(), NewEltVT,
12576- OpVT.getVectorElementCount());
12577-
12578- // Promote types now to avoid redundant zexts.
12579- if (getTypeAction(NewVT.getSimpleVT()) == TypePromoteInteger) {
12580- NewVT = getTypeToTransformTo(*DAG.getContext(), NewVT);
12581- NewEltVT = NewVT.getVectorElementType();
12582- }
12583- if (getTypeAction(NewEltVT.getSimpleVT()) == TypePromoteInteger)
12584- NewEltVT = getTypeToTransformTo(*DAG.getContext(), NewEltVT);
12585-
12586- SDValue VL = DAG.getElementCount(DL, NewEltVT, NewVT.getVectorElementCount());
12587-
12588- SDValue StepVec = DAG.getStepVector(DL, NewVT);
12589- SDValue SplatVL = DAG.getSplat(NewVT, DL, VL);
12590- SDValue StepVL = DAG.getNode(ISD::SUB, DL, NewVT, SplatVL, StepVec);
12591- SDValue Ext = DAG.getSExtOrTrunc(Op, DL, NewVT);
12592- SDValue And = DAG.getNode(ISD::AND, DL, NewVT, StepVL, Ext);
12593- SDValue Max =
12594- DAG.getNode(ISD::VECREDUCE_UMAX, DL, NewVT.getVectorElementType(), And);
12595- SDValue Sub = DAG.getNode(ISD::SUB, DL, NewEltVT, VL,
12596- DAG.getZExtOrTrunc(Max, DL, NewEltVT));
12597-
12598- return DAG.getZExtOrTrunc(Sub, DL, VT);
12599- }
12600-
1260112544SDValue TargetLowering::expandPartialReduceMLA(SDNode *N,
1260212545 SelectionDAG &DAG) const {
1260312546 SDLoc DL(N);
0 commit comments