@@ -568,6 +568,32 @@ AArch64TTIImpl::getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
568
568
}
569
569
return Cost;
570
570
}
571
+ case Intrinsic::vector_extract: {
572
+ // If both the vector argument and the return type are legal types, then
573
+ // this should be a no-op or simple operation; return a relatively low cost.
574
+ LLVMContext &C = RetTy->getContext ();
575
+ EVT MRTy = getTLI ()->getValueType (DL, RetTy);
576
+ EVT MPTy = getTLI ()->getValueType (DL, ICA.getArgTypes ()[0 ]);
577
+ TargetLoweringBase::LegalizeKind RLK = getTLI ()->getTypeConversion (C, MRTy);
578
+ TargetLoweringBase::LegalizeKind PLK = getTLI ()->getTypeConversion (C, MPTy);
579
+ if (RLK.first == TargetLoweringBase::TypeLegal &&
580
+ PLK.first == TargetLoweringBase::TypeLegal)
581
+ return InstructionCost (1 );
582
+ break ;
583
+ }
584
+ case Intrinsic::vector_insert: {
585
+ // If both the vector and subvector arguments are legal types, then this
586
+ // should be a no-op or simple operation; return a relatively low cost.
587
+ LLVMContext &C = RetTy->getContext ();
588
+ EVT MTy0 = getTLI ()->getValueType (DL, ICA.getArgTypes ()[0 ]);
589
+ EVT MTy1 = getTLI ()->getValueType (DL, ICA.getArgTypes ()[1 ]);
590
+ TargetLoweringBase::LegalizeKind LK0 = getTLI ()->getTypeConversion (C, MTy0);
591
+ TargetLoweringBase::LegalizeKind LK1 = getTLI ()->getTypeConversion (C, MTy1);
592
+ if (LK0.first == TargetLoweringBase::TypeLegal &&
593
+ LK1.first == TargetLoweringBase::TypeLegal)
594
+ return InstructionCost (1 );
595
+ break ;
596
+ }
571
597
case Intrinsic::bitreverse: {
572
598
static const CostTblEntry BitreverseTbl[] = {
573
599
{Intrinsic::bitreverse, MVT::i32 , 1 },
0 commit comments