@@ -579,10 +579,12 @@ class TargetTransformInfoImplBase {
579
579
return InstructionCost::getInvalid ();
580
580
}
581
581
582
- InstructionCost
583
- getShuffleCost (TTI::ShuffleKind Kind, VectorType *Ty, ArrayRef<int > Mask,
584
- TTI::TargetCostKind CostKind, int Index, VectorType *SubTp,
585
- ArrayRef<const Value *> Args = std::nullopt) const {
582
+ InstructionCost getShuffleCost (TTI::ShuffleKind Kind, VectorType *Ty,
583
+ ArrayRef<int > Mask,
584
+ TTI::TargetCostKind CostKind, int Index,
585
+ VectorType *SubTp,
586
+ ArrayRef<const Value *> Args = std::nullopt,
587
+ const Instruction *CxtI = nullptr ) const {
586
588
return 1 ;
587
589
}
588
590
@@ -1341,13 +1343,13 @@ class TargetTransformInfoImplCRTPBase : public TargetTransformInfoImplBase {
1341
1343
if (Shuffle->isExtractSubvectorMask (SubIndex))
1342
1344
return TargetTTI->getShuffleCost (TTI::SK_ExtractSubvector, VecSrcTy,
1343
1345
Mask, CostKind, SubIndex, VecTy,
1344
- Operands);
1346
+ Operands, Shuffle );
1345
1347
1346
1348
if (Shuffle->isInsertSubvectorMask (NumSubElts, SubIndex))
1347
1349
return TargetTTI->getShuffleCost (
1348
1350
TTI::SK_InsertSubvector, VecTy, Mask, CostKind, SubIndex,
1349
1351
FixedVectorType::get (VecTy->getScalarType (), NumSubElts),
1350
- Operands);
1352
+ Operands, Shuffle );
1351
1353
1352
1354
int ReplicationFactor, VF;
1353
1355
if (Shuffle->isReplicationMask (ReplicationFactor, VF)) {
@@ -1374,7 +1376,7 @@ class TargetTransformInfoImplCRTPBase : public TargetTransformInfoImplBase {
1374
1376
1375
1377
return TargetTTI->getShuffleCost (
1376
1378
IsUnary ? TTI::SK_PermuteSingleSrc : TTI::SK_PermuteTwoSrc, VecTy,
1377
- AdjustMask, CostKind, 0 , nullptr );
1379
+ AdjustMask, CostKind, 0 , nullptr , {}, Shuffle );
1378
1380
}
1379
1381
1380
1382
// Narrowing shuffle - perform shuffle at original wider width and
@@ -1383,49 +1385,53 @@ class TargetTransformInfoImplCRTPBase : public TargetTransformInfoImplBase {
1383
1385
1384
1386
InstructionCost ShuffleCost = TargetTTI->getShuffleCost (
1385
1387
IsUnary ? TTI::SK_PermuteSingleSrc : TTI::SK_PermuteTwoSrc,
1386
- VecSrcTy, AdjustMask, CostKind, 0 , nullptr );
1388
+ VecSrcTy, AdjustMask, CostKind, 0 , nullptr , {}, Shuffle );
1387
1389
1388
1390
SmallVector<int , 16 > ExtractMask (Mask.size ());
1389
1391
std::iota (ExtractMask.begin (), ExtractMask.end (), 0 );
1390
- return ShuffleCost + TargetTTI->getShuffleCost (TTI::SK_ExtractSubvector,
1391
- VecSrcTy, ExtractMask ,
1392
- CostKind, 0 , VecTy);
1392
+ return ShuffleCost + TargetTTI->getShuffleCost (
1393
+ TTI::SK_ExtractSubvector, VecSrcTy ,
1394
+ ExtractMask, CostKind, 0 , VecTy, {}, Shuffle );
1393
1395
}
1394
1396
1395
1397
if (Shuffle->isIdentity ())
1396
1398
return 0 ;
1397
1399
1398
1400
if (Shuffle->isReverse ())
1399
1401
return TargetTTI->getShuffleCost (TTI::SK_Reverse, VecTy, Mask, CostKind,
1400
- 0 , nullptr , Operands);
1402
+ 0 , nullptr , Operands, Shuffle );
1401
1403
1402
1404
if (Shuffle->isSelect ())
1403
1405
return TargetTTI->getShuffleCost (TTI::SK_Select, VecTy, Mask, CostKind,
1404
- 0 , nullptr , Operands);
1406
+ 0 , nullptr , Operands, Shuffle );
1405
1407
1406
1408
if (Shuffle->isTranspose ())
1407
1409
return TargetTTI->getShuffleCost (TTI::SK_Transpose, VecTy, Mask,
1408
- CostKind, 0 , nullptr , Operands);
1410
+ CostKind, 0 , nullptr , Operands,
1411
+ Shuffle);
1409
1412
1410
1413
if (Shuffle->isZeroEltSplat ())
1411
1414
return TargetTTI->getShuffleCost (TTI::SK_Broadcast, VecTy, Mask,
1412
- CostKind, 0 , nullptr , Operands);
1415
+ CostKind, 0 , nullptr , Operands,
1416
+ Shuffle);
1413
1417
1414
1418
if (Shuffle->isSingleSource ())
1415
1419
return TargetTTI->getShuffleCost (TTI::SK_PermuteSingleSrc, VecTy, Mask,
1416
- CostKind, 0 , nullptr , Operands);
1420
+ CostKind, 0 , nullptr , Operands,
1421
+ Shuffle);
1417
1422
1418
1423
if (Shuffle->isInsertSubvectorMask (NumSubElts, SubIndex))
1419
1424
return TargetTTI->getShuffleCost (
1420
1425
TTI::SK_InsertSubvector, VecTy, Mask, CostKind, SubIndex,
1421
- FixedVectorType::get (VecTy->getScalarType (), NumSubElts), Operands);
1426
+ FixedVectorType::get (VecTy->getScalarType (), NumSubElts), Operands,
1427
+ Shuffle);
1422
1428
1423
1429
if (Shuffle->isSplice (SubIndex))
1424
1430
return TargetTTI->getShuffleCost (TTI::SK_Splice, VecTy, Mask, CostKind,
1425
- SubIndex, nullptr , Operands);
1431
+ SubIndex, nullptr , Operands, Shuffle );
1426
1432
1427
1433
return TargetTTI->getShuffleCost (TTI::SK_PermuteTwoSrc, VecTy, Mask,
1428
- CostKind, 0 , nullptr , Operands);
1434
+ CostKind, 0 , nullptr , Operands, Shuffle );
1429
1435
}
1430
1436
case Instruction::ExtractElement: {
1431
1437
auto *EEI = dyn_cast<ExtractElementInst>(U);
0 commit comments