forked from OSchip/llvm-project
[Alignment][NFC] Migrate TTI::getMaskedMemoryOpCost to Align
This is patch is part of a series to introduce an Alignment type. See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html See this patch for the introduction of the type: https://reviews.llvm.org/D64790 Differential Revision: https://reviews.llvm.org/D82569
This commit is contained in:
parent
edcfef8fee
commit
7e1f79c3de
|
@ -1024,8 +1024,8 @@ public:
|
|||
|
||||
/// \return The cost of masked Load and Store instructions.
|
||||
int getMaskedMemoryOpCost(
|
||||
unsigned Opcode, Type *Src, unsigned Alignment, unsigned AddressSpace,
|
||||
TTI::TargetCostKind CostKind = TTI::TCK_RecipThroughput) const;
|
||||
unsigned Opcode, Type *Src, Align Alignment, unsigned AddressSpace,
|
||||
TTI::TargetCostKind CostKind = TTI::TCK_RecipThroughput) const;
|
||||
|
||||
/// \return The cost of Gather or Scatter operation
|
||||
/// \p Opcode - is a type of memory access Load or Store
|
||||
|
@ -1426,8 +1426,7 @@ public:
|
|||
unsigned AddressSpace,
|
||||
TTI::TargetCostKind CostKind,
|
||||
const Instruction *I) = 0;
|
||||
virtual int getMaskedMemoryOpCost(unsigned Opcode, Type *Src,
|
||||
unsigned Alignment,
|
||||
virtual int getMaskedMemoryOpCost(unsigned Opcode, Type *Src, Align Alignment,
|
||||
unsigned AddressSpace,
|
||||
TTI::TargetCostKind CostKind) = 0;
|
||||
virtual int getGatherScatterOpCost(unsigned Opcode, Type *DataTy,
|
||||
|
@ -1844,7 +1843,7 @@ public:
|
|||
return Impl.getMemoryOpCost(Opcode, Src, Alignment, AddressSpace,
|
||||
CostKind, I);
|
||||
}
|
||||
int getMaskedMemoryOpCost(unsigned Opcode, Type *Src, unsigned Alignment,
|
||||
int getMaskedMemoryOpCost(unsigned Opcode, Type *Src, Align Alignment,
|
||||
unsigned AddressSpace,
|
||||
TTI::TargetCostKind CostKind) override {
|
||||
return Impl.getMaskedMemoryOpCost(Opcode, Src, Alignment, AddressSpace,
|
||||
|
|
|
@ -464,7 +464,7 @@ public:
|
|||
return 1;
|
||||
}
|
||||
|
||||
unsigned getMaskedMemoryOpCost(unsigned Opcode, Type *Src, unsigned Alignment,
|
||||
unsigned getMaskedMemoryOpCost(unsigned Opcode, Type *Src, Align Alignment,
|
||||
unsigned AddressSpace,
|
||||
TTI::TargetCostKind CostKind) {
|
||||
return 1;
|
||||
|
|
|
@ -963,10 +963,10 @@ public:
|
|||
unsigned Cost;
|
||||
if (UseMaskForCond || UseMaskForGaps)
|
||||
Cost = static_cast<T *>(this)->getMaskedMemoryOpCost(
|
||||
Opcode, VecTy, Alignment, AddressSpace, CostKind);
|
||||
Opcode, VecTy, Align(Alignment), AddressSpace, CostKind);
|
||||
else
|
||||
Cost = static_cast<T *>(this)->getMemoryOpCost(
|
||||
Opcode, VecTy, MaybeAlign(Alignment), AddressSpace, CostKind);
|
||||
Opcode, VecTy, Align(Alignment), AddressSpace, CostKind);
|
||||
|
||||
// Legalize the vector type, and get the legalized and unlegalized type
|
||||
// sizes.
|
||||
|
@ -1389,13 +1389,13 @@ public:
|
|||
return 0;
|
||||
case Intrinsic::masked_store: {
|
||||
Type *Ty = Tys[0];
|
||||
unsigned TyAlign = ConcreteTTI->DL.getABITypeAlignment(Ty);
|
||||
Align TyAlign = ConcreteTTI->DL.getABITypeAlign(Ty);
|
||||
return ConcreteTTI->getMaskedMemoryOpCost(Instruction::Store, Ty, TyAlign,
|
||||
0, CostKind);
|
||||
}
|
||||
case Intrinsic::masked_load: {
|
||||
Type *Ty = RetTy;
|
||||
unsigned TyAlign = ConcreteTTI->DL.getABITypeAlignment(Ty);
|
||||
Align TyAlign = ConcreteTTI->DL.getABITypeAlign(Ty);
|
||||
return ConcreteTTI->getMaskedMemoryOpCost(Instruction::Load, Ty, TyAlign,
|
||||
0, CostKind);
|
||||
}
|
||||
|
|
|
@ -757,10 +757,9 @@ int TargetTransformInfo::getMemoryOpCost(unsigned Opcode, Type *Src,
|
|||
return Cost;
|
||||
}
|
||||
|
||||
int TargetTransformInfo::getMaskedMemoryOpCost(unsigned Opcode, Type *Src,
|
||||
unsigned Alignment,
|
||||
unsigned AddressSpace,
|
||||
TTI::TargetCostKind CostKind) const {
|
||||
int TargetTransformInfo::getMaskedMemoryOpCost(
|
||||
unsigned Opcode, Type *Src, Align Alignment, unsigned AddressSpace,
|
||||
TTI::TargetCostKind CostKind) const {
|
||||
int Cost =
|
||||
TTIImpl->getMaskedMemoryOpCost(Opcode, Src, Alignment, AddressSpace,
|
||||
CostKind);
|
||||
|
|
|
@ -200,9 +200,10 @@ unsigned HexagonTTIImpl::getMemoryOpCost(unsigned Opcode, Type *Src,
|
|||
CostKind, I);
|
||||
}
|
||||
|
||||
unsigned HexagonTTIImpl::getMaskedMemoryOpCost(unsigned Opcode,
|
||||
Type *Src, unsigned Alignment, unsigned AddressSpace,
|
||||
TTI::TargetCostKind CostKind) {
|
||||
unsigned HexagonTTIImpl::getMaskedMemoryOpCost(unsigned Opcode, Type *Src,
|
||||
Align Alignment,
|
||||
unsigned AddressSpace,
|
||||
TTI::TargetCostKind CostKind) {
|
||||
return BaseT::getMaskedMemoryOpCost(Opcode, Src, Alignment, AddressSpace,
|
||||
CostKind);
|
||||
}
|
||||
|
|
|
@ -115,9 +115,10 @@ public:
|
|||
unsigned AddressSpace,
|
||||
TTI::TargetCostKind CostKind,
|
||||
const Instruction *I = nullptr);
|
||||
unsigned getMaskedMemoryOpCost(unsigned Opcode, Type *Src, unsigned Alignment,
|
||||
unsigned AddressSpace,
|
||||
TTI::TargetCostKind CostKind = TTI::TCK_SizeAndLatency);
|
||||
unsigned
|
||||
getMaskedMemoryOpCost(unsigned Opcode, Type *Src, Align Alignment,
|
||||
unsigned AddressSpace,
|
||||
TTI::TargetCostKind CostKind = TTI::TCK_SizeAndLatency);
|
||||
unsigned getShuffleCost(TTI::ShuffleKind Kind, Type *Tp, int Index,
|
||||
Type *SubTp);
|
||||
unsigned getGatherScatterOpCost(unsigned Opcode, Type *DataTy,
|
||||
|
|
|
@ -3031,8 +3031,7 @@ int X86TTIImpl::getMemoryOpCost(unsigned Opcode, Type *Src,
|
|||
}
|
||||
|
||||
int X86TTIImpl::getMaskedMemoryOpCost(unsigned Opcode, Type *SrcTy,
|
||||
unsigned Alignment,
|
||||
unsigned AddressSpace,
|
||||
Align Alignment, unsigned AddressSpace,
|
||||
TTI::TargetCostKind CostKind) {
|
||||
bool IsLoad = (Instruction::Load == Opcode);
|
||||
bool IsStore = (Instruction::Store == Opcode);
|
||||
|
@ -3040,14 +3039,13 @@ int X86TTIImpl::getMaskedMemoryOpCost(unsigned Opcode, Type *SrcTy,
|
|||
VectorType *SrcVTy = dyn_cast<VectorType>(SrcTy);
|
||||
if (!SrcVTy)
|
||||
// To calculate scalar take the regular cost, without mask
|
||||
return getMemoryOpCost(Opcode, SrcTy, MaybeAlign(Alignment), AddressSpace,
|
||||
CostKind);
|
||||
return getMemoryOpCost(Opcode, SrcTy, Alignment, AddressSpace, CostKind);
|
||||
|
||||
unsigned NumElem = SrcVTy->getNumElements();
|
||||
auto *MaskTy =
|
||||
FixedVectorType::get(Type::getInt8Ty(SrcVTy->getContext()), NumElem);
|
||||
if ((IsLoad && !isLegalMaskedLoad(SrcVTy, Align(Alignment))) ||
|
||||
(IsStore && !isLegalMaskedStore(SrcVTy, Align(Alignment))) ||
|
||||
if ((IsLoad && !isLegalMaskedLoad(SrcVTy, Alignment)) ||
|
||||
(IsStore && !isLegalMaskedStore(SrcVTy, Alignment)) ||
|
||||
!isPowerOf2_32(NumElem)) {
|
||||
// Scalarization
|
||||
APInt DemandedElts = APInt::getAllOnesValue(NumElem);
|
||||
|
@ -3062,8 +3060,7 @@ int X86TTIImpl::getMaskedMemoryOpCost(unsigned Opcode, Type *SrcTy,
|
|||
getScalarizationOverhead(SrcVTy, DemandedElts, IsLoad, IsStore);
|
||||
int MemopCost =
|
||||
NumElem * BaseT::getMemoryOpCost(Opcode, SrcVTy->getScalarType(),
|
||||
MaybeAlign(Alignment), AddressSpace,
|
||||
CostKind);
|
||||
Alignment, AddressSpace, CostKind);
|
||||
return MemopCost + ValueSplitCost + MaskSplitCost + MaskCmpCost;
|
||||
}
|
||||
|
||||
|
|
|
@ -141,9 +141,9 @@ public:
|
|||
unsigned AddressSpace,
|
||||
TTI::TargetCostKind CostKind,
|
||||
const Instruction *I = nullptr);
|
||||
int getMaskedMemoryOpCost(unsigned Opcode, Type *Src, unsigned Alignment,
|
||||
unsigned AddressSpace,
|
||||
TTI::TargetCostKind CostKind = TTI::TCK_SizeAndLatency);
|
||||
int getMaskedMemoryOpCost(
|
||||
unsigned Opcode, Type *Src, Align Alignment, unsigned AddressSpace,
|
||||
TTI::TargetCostKind CostKind = TTI::TCK_SizeAndLatency);
|
||||
int getGatherScatterOpCost(unsigned Opcode, Type *DataTy, const Value *Ptr,
|
||||
bool VariableMask, unsigned Alignment,
|
||||
TTI::TargetCostKind CostKind,
|
||||
|
|
|
@ -5890,8 +5890,8 @@ unsigned LoopVectorizationCostModel::getConsecutiveMemOpCost(Instruction *I,
|
|||
const Align Alignment = getLoadStoreAlignment(I);
|
||||
unsigned Cost = 0;
|
||||
if (Legal->isMaskRequired(I))
|
||||
Cost += TTI.getMaskedMemoryOpCost(I->getOpcode(), VectorTy,
|
||||
Alignment.value(), AS, CostKind);
|
||||
Cost += TTI.getMaskedMemoryOpCost(I->getOpcode(), VectorTy, Alignment, AS,
|
||||
CostKind);
|
||||
else
|
||||
Cost += TTI.getMemoryOpCost(I->getOpcode(), VectorTy, Alignment, AS,
|
||||
CostKind, I);
|
||||
|
|
Loading…
Reference in New Issue