@@ -781,6 +781,9 @@ class TargetTransformInfo {
781781 // / Return true if the target supports masked expand load.
782782 bool isLegalMaskedExpandLoad (Type *DataType) const ;
783783
784+ // / Return true if the target supports strided load.
785+ bool isLegalStridedLoadStore (Type *DataType, Align Alignment) const ;
786+
784787 // / Return true if this is an alternating opcode pattern that can be lowered
785788 // / to a single instruction on the target. In X86 this is for the addsub
786789 // / instruction which corrsponds to a Shuffle + Fadd + FSub pattern in IR.
@@ -1412,6 +1415,20 @@ class TargetTransformInfo {
14121415 Align Alignment, TTI::TargetCostKind CostKind = TTI::TCK_RecipThroughput,
14131416 const Instruction *I = nullptr ) const ;
14141417
1418+ // / \return The cost of strided memory operations.
1419+ // / \p Opcode - is a type of memory access Load or Store
1420+ // / \p DataTy - a vector type of the data to be loaded or stored
1421+ // / \p Ptr - pointer [or vector of pointers] - address[es] in memory
1422+ // / \p VariableMask - true when the memory access is predicated with a mask
1423+ // / that is not a compile-time constant
1424+ // / \p Alignment - alignment of single element
1425+ // / \p I - the optional original context instruction, if one exists, e.g. the
1426+ // / load/store to transform or the call to the gather/scatter intrinsic
1427+ InstructionCost getStridedMemoryOpCost (
1428+ unsigned Opcode, Type *DataTy, const Value *Ptr, bool VariableMask,
1429+ Align Alignment, TTI::TargetCostKind CostKind = TTI::TCK_RecipThroughput,
1430+ const Instruction *I = nullptr ) const ;
1431+
14151432 // / \return The cost of the interleaved memory operation.
14161433 // / \p Opcode is the memory operation code
14171434 // / \p VecTy is the vector type of the interleaved access.
@@ -1848,6 +1865,7 @@ class TargetTransformInfo::Concept {
18481865 Align Alignment) = 0;
18491866 virtual bool isLegalMaskedCompressStore (Type *DataType) = 0;
18501867 virtual bool isLegalMaskedExpandLoad (Type *DataType) = 0;
1868+ virtual bool isLegalStridedLoadStore (Type *DataType, Align Alignment) = 0;
18511869 virtual bool isLegalAltInstr (VectorType *VecTy, unsigned Opcode0,
18521870 unsigned Opcode1,
18531871 const SmallBitVector &OpcodeMask) const = 0;
@@ -2023,6 +2041,11 @@ class TargetTransformInfo::Concept {
20232041 bool VariableMask, Align Alignment,
20242042 TTI::TargetCostKind CostKind,
20252043 const Instruction *I = nullptr ) = 0 ;
2044+ virtual InstructionCost
2045+ getStridedMemoryOpCost (unsigned Opcode, Type *DataTy, const Value *Ptr,
2046+ bool VariableMask, Align Alignment,
2047+ TTI::TargetCostKind CostKind,
2048+ const Instruction *I = nullptr ) = 0 ;
20262049
20272050 virtual InstructionCost getInterleavedMemoryOpCost (
20282051 unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef<unsigned > Indices,
@@ -2341,6 +2364,9 @@ class TargetTransformInfo::Model final : public TargetTransformInfo::Concept {
23412364 bool isLegalMaskedExpandLoad (Type *DataType) override {
23422365 return Impl.isLegalMaskedExpandLoad (DataType);
23432366 }
2367+ bool isLegalStridedLoadStore (Type *DataType, Align Alignment) override {
2368+ return Impl.isLegalStridedLoadStore (DataType, Alignment);
2369+ }
23442370 bool isLegalAltInstr (VectorType *VecTy, unsigned Opcode0, unsigned Opcode1,
23452371 const SmallBitVector &OpcodeMask) const override {
23462372 return Impl.isLegalAltInstr (VecTy, Opcode0, Opcode1, OpcodeMask);
@@ -2671,6 +2697,14 @@ class TargetTransformInfo::Model final : public TargetTransformInfo::Concept {
26712697 return Impl.getGatherScatterOpCost (Opcode, DataTy, Ptr, VariableMask,
26722698 Alignment, CostKind, I);
26732699 }
2700+ InstructionCost
2701+ getStridedMemoryOpCost (unsigned Opcode, Type *DataTy, const Value *Ptr,
2702+ bool VariableMask, Align Alignment,
2703+ TTI::TargetCostKind CostKind,
2704+ const Instruction *I = nullptr ) override {
2705+ return Impl.getStridedMemoryOpCost (Opcode, DataTy, Ptr, VariableMask,
2706+ Alignment, CostKind, I);
2707+ }
26742708 InstructionCost getInterleavedMemoryOpCost (
26752709 unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef<unsigned > Indices,
26762710 Align Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind,
0 commit comments