[llvm] [TTI][Vectorize] Migrate masked/gather-scatter/strided/expand-compress costing (NFCI) (PR #165532)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 4 02:07:51 PST 2025
================
@@ -3017,6 +3022,53 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
return SingleCallCost;
}
+ /// Get memory intrinsic cost based on arguments.
+ InstructionCost getMemIntrinsicInstrCost(Intrinsic::ID Id, Type *DataTy,
+ const Value *Ptr, bool VariableMask,
+ Align Alignment,
+ TTI::TargetCostKind CostKind,
+ const Instruction *I) const {
+ switch (Id) {
+ case Intrinsic::experimental_vp_strided_load:
+ case Intrinsic::experimental_vp_strided_store: {
+ unsigned Opcode = (Id == Intrinsic::experimental_vp_strided_load)
+ ? Instruction::Load
+ : Instruction::Store;
+ return thisT()->getStridedMemoryOpCost(Opcode, DataTy, Ptr, VariableMask,
+ Alignment, CostKind, I);
+ }
+ case Intrinsic::masked_scatter:
+ case Intrinsic::masked_gather:
+ case Intrinsic::vp_scatter:
+ case Intrinsic::vp_gather: {
+ unsigned Opcode =
+ ((Id == Intrinsic::masked_gather) || (Id == Intrinsic::vp_gather))
+ ? Instruction::Load
+ : Instruction::Store;
+ return thisT()->getGatherScatterOpCost(Opcode, DataTy, Ptr, VariableMask,
+ Alignment, CostKind, I);
+ }
+ case Intrinsic::masked_load:
+ case Intrinsic::masked_store: {
+ unsigned Opcode = (Id == Intrinsic::masked_load) ? Instruction::Load
----------------
lukel97 wrote:
```suggestion
unsigned Opcode = Id == Intrinsic::masked_load ? Instruction::Load
```
https://github.com/llvm/llvm-project/pull/165532
More information about the llvm-commits
mailing list