@@ -343,49 +343,6 @@ RISCVTTIImpl::getConstantPoolLoadCost(Type *Ty, TTI::TargetCostKind CostKind) {
343343 /* AddressSpace=*/ 0 , CostKind);
344344}
345345
346- InstructionCost
347- RISCVTTIImpl::isMultipleInsertSubvector (VectorType *Tp, ArrayRef<int > Mask,
348- TTI::TargetCostKind CostKind) {
349- if (!isa<FixedVectorType>(Tp))
350- return InstructionCost::getInvalid ();
351- std::pair<InstructionCost, MVT> LT = getTypeLegalizationCost (Tp);
352- if (LT.second .getScalarSizeInBits () == 1 )
353- return InstructionCost::getInvalid ();
354- // Try to guess SubTp.
355- for (unsigned SubVecSize = 1 , E = Mask.size (); SubVecSize < E;
356- SubVecSize <<= 1 ) {
357- if (E % SubVecSize != 0 )
358- continue ;
359- SmallVector<int > RepeatedPattern (createSequentialMask (0 , SubVecSize, 0 ));
360- bool Skip = false ;
361- for (unsigned I = 0 ; I != E; I += SubVecSize)
362- if (!Mask.slice (I, SubVecSize).equals (RepeatedPattern)) {
363- Skip = true ;
364- break ;
365- }
366- if (Skip)
367- continue ;
368- InstructionCost Cost = 0 ;
369- unsigned NumSlides = Log2_32 (E / SubVecSize);
370- // The cost of extraction from a subvector is 0 if the index is 0.
371- for (unsigned I = 0 ; I != NumSlides; ++I) {
372- unsigned InsertIndex = SubVecSize * (1 << I);
373- FixedVectorType *SubTp = FixedVectorType::get (
374- cast<FixedVectorType>(Tp)->getElementType (), InsertIndex);
375- FixedVectorType *DesTp =
376- FixedVectorType::getDoubleElementsVectorType (SubTp);
377- std::pair<InstructionCost, MVT> DesLT = getTypeLegalizationCost (DesTp);
378- // Add the cost of whole vector register move because the destination
379- // vector register group for vslideup cannot overlap the source.
380- Cost += DesLT.first * TLI->getLMULCost (DesLT.second );
381- Cost += getShuffleCost (TTI::SK_InsertSubvector, DesTp, {}, CostKind,
382- InsertIndex, SubTp);
383- }
384- return Cost;
385- }
386- return InstructionCost::getInvalid ();
387- }
388-
389346static VectorType *getVRGatherIndexType (MVT DataVT, const RISCVSubtarget &ST,
390347 LLVMContext &C) {
391348 assert ((DataVT.getScalarSizeInBits () != 8 ||
@@ -437,10 +394,6 @@ InstructionCost RISCVTTIImpl::getShuffleCost(TTI::ShuffleKind Kind,
437394 LT.second , CostKind);
438395 }
439396 }
440- if (InstructionCost Cost =
441- isMultipleInsertSubvector (Tp, Mask, CostKind);
442- Cost.isValid ())
443- return Cost;
444397 }
445398 // vrgather + cost of generating the mask constant.
446399 // We model this for an unknown mask with a single vrgather.
0 commit comments