mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 12:12:47 +01:00
[TTI] NFC: Change getMaskedMemoryOpCost to return InstructionCost
This patch migrates the TTI cost interfaces to return an InstructionCost. See this patch for the introduction of the type: https://reviews.llvm.org/D91174 See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2020-November/146408.html Reviewed By: dmgreen Differential Revision: https://reviews.llvm.org/D100204
This commit is contained in:
parent
c121181edc
commit
32a70b87c0
@ -1135,7 +1135,7 @@ public:
|
|||||||
const Instruction *I = nullptr) const;
|
const Instruction *I = nullptr) const;
|
||||||
|
|
||||||
/// \return The cost of masked Load and Store instructions.
|
/// \return The cost of masked Load and Store instructions.
|
||||||
int getMaskedMemoryOpCost(
|
InstructionCost getMaskedMemoryOpCost(
|
||||||
unsigned Opcode, Type *Src, Align Alignment, unsigned AddressSpace,
|
unsigned Opcode, Type *Src, Align Alignment, unsigned AddressSpace,
|
||||||
TTI::TargetCostKind CostKind = TTI::TCK_RecipThroughput) const;
|
TTI::TargetCostKind CostKind = TTI::TCK_RecipThroughput) const;
|
||||||
|
|
||||||
@ -1594,9 +1594,10 @@ public:
|
|||||||
unsigned AddressSpace,
|
unsigned AddressSpace,
|
||||||
TTI::TargetCostKind CostKind,
|
TTI::TargetCostKind CostKind,
|
||||||
const Instruction *I) = 0;
|
const Instruction *I) = 0;
|
||||||
virtual int getMaskedMemoryOpCost(unsigned Opcode, Type *Src, Align Alignment,
|
virtual InstructionCost
|
||||||
unsigned AddressSpace,
|
getMaskedMemoryOpCost(unsigned Opcode, Type *Src, Align Alignment,
|
||||||
TTI::TargetCostKind CostKind) = 0;
|
unsigned AddressSpace,
|
||||||
|
TTI::TargetCostKind CostKind) = 0;
|
||||||
virtual InstructionCost
|
virtual InstructionCost
|
||||||
getGatherScatterOpCost(unsigned Opcode, Type *DataTy, const Value *Ptr,
|
getGatherScatterOpCost(unsigned Opcode, Type *DataTy, const Value *Ptr,
|
||||||
bool VariableMask, Align Alignment,
|
bool VariableMask, Align Alignment,
|
||||||
@ -2075,9 +2076,9 @@ public:
|
|||||||
return Impl.getMemoryOpCost(Opcode, Src, Alignment, AddressSpace,
|
return Impl.getMemoryOpCost(Opcode, Src, Alignment, AddressSpace,
|
||||||
CostKind, I);
|
CostKind, I);
|
||||||
}
|
}
|
||||||
int getMaskedMemoryOpCost(unsigned Opcode, Type *Src, Align Alignment,
|
InstructionCost getMaskedMemoryOpCost(unsigned Opcode, Type *Src,
|
||||||
unsigned AddressSpace,
|
Align Alignment, unsigned AddressSpace,
|
||||||
TTI::TargetCostKind CostKind) override {
|
TTI::TargetCostKind CostKind) override {
|
||||||
return Impl.getMaskedMemoryOpCost(Opcode, Src, Alignment, AddressSpace,
|
return Impl.getMaskedMemoryOpCost(Opcode, Src, Alignment, AddressSpace,
|
||||||
CostKind);
|
CostKind);
|
||||||
}
|
}
|
||||||
|
@ -543,9 +543,9 @@ public:
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned getMaskedMemoryOpCost(unsigned Opcode, Type *Src, Align Alignment,
|
InstructionCost getMaskedMemoryOpCost(unsigned Opcode, Type *Src,
|
||||||
unsigned AddressSpace,
|
Align Alignment, unsigned AddressSpace,
|
||||||
TTI::TargetCostKind CostKind) const {
|
TTI::TargetCostKind CostKind) const {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1084,7 +1084,7 @@ public:
|
|||||||
auto *SubVT = FixedVectorType::get(VT->getElementType(), NumSubElts);
|
auto *SubVT = FixedVectorType::get(VT->getElementType(), NumSubElts);
|
||||||
|
|
||||||
// Firstly, the cost of load/store operation.
|
// Firstly, the cost of load/store operation.
|
||||||
unsigned Cost;
|
InstructionCost Cost;
|
||||||
if (UseMaskForCond || UseMaskForGaps)
|
if (UseMaskForCond || UseMaskForGaps)
|
||||||
Cost = thisT()->getMaskedMemoryOpCost(Opcode, VecTy, Alignment,
|
Cost = thisT()->getMaskedMemoryOpCost(Opcode, VecTy, Alignment,
|
||||||
AddressSpace, CostKind);
|
AddressSpace, CostKind);
|
||||||
@ -1186,7 +1186,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!UseMaskForCond)
|
if (!UseMaskForCond)
|
||||||
return Cost;
|
return *Cost.getValue();
|
||||||
|
|
||||||
Type *I8Type = Type::getInt8Ty(VT->getContext());
|
Type *I8Type = Type::getInt8Ty(VT->getContext());
|
||||||
auto *MaskVT = FixedVectorType::get(I8Type, NumElts);
|
auto *MaskVT = FixedVectorType::get(I8Type, NumElts);
|
||||||
@ -1219,7 +1219,7 @@ public:
|
|||||||
Cost += thisT()->getArithmeticInstrCost(BinaryOperator::And, MaskVT,
|
Cost += thisT()->getArithmeticInstrCost(BinaryOperator::And, MaskVT,
|
||||||
CostKind);
|
CostKind);
|
||||||
|
|
||||||
return Cost;
|
return *Cost.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get intrinsic cost based on arguments.
|
/// Get intrinsic cost based on arguments.
|
||||||
|
@ -827,12 +827,11 @@ int TargetTransformInfo::getMemoryOpCost(unsigned Opcode, Type *Src,
|
|||||||
return Cost;
|
return Cost;
|
||||||
}
|
}
|
||||||
|
|
||||||
int TargetTransformInfo::getMaskedMemoryOpCost(
|
InstructionCost TargetTransformInfo::getMaskedMemoryOpCost(
|
||||||
unsigned Opcode, Type *Src, Align Alignment, unsigned AddressSpace,
|
unsigned Opcode, Type *Src, Align Alignment, unsigned AddressSpace,
|
||||||
TTI::TargetCostKind CostKind) const {
|
TTI::TargetCostKind CostKind) const {
|
||||||
int Cost =
|
InstructionCost Cost = TTIImpl->getMaskedMemoryOpCost(Opcode, Src, Alignment,
|
||||||
TTIImpl->getMaskedMemoryOpCost(Opcode, Src, Alignment, AddressSpace,
|
AddressSpace, CostKind);
|
||||||
CostKind);
|
|
||||||
assert(Cost >= 0 && "TTI should not produce negative costs!");
|
assert(Cost >= 0 && "TTI should not produce negative costs!");
|
||||||
return Cost;
|
return Cost;
|
||||||
}
|
}
|
||||||
|
@ -1427,10 +1427,10 @@ int ARMTTIImpl::getMemoryOpCost(unsigned Opcode, Type *Src,
|
|||||||
CostKind, I);
|
CostKind, I);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned ARMTTIImpl::getMaskedMemoryOpCost(unsigned Opcode, Type *Src,
|
InstructionCost
|
||||||
Align Alignment,
|
ARMTTIImpl::getMaskedMemoryOpCost(unsigned Opcode, Type *Src, Align Alignment,
|
||||||
unsigned AddressSpace,
|
unsigned AddressSpace,
|
||||||
TTI::TargetCostKind CostKind) {
|
TTI::TargetCostKind CostKind) {
|
||||||
if (ST->hasMVEIntegerOps()) {
|
if (ST->hasMVEIntegerOps()) {
|
||||||
if (Opcode == Instruction::Load && isLegalMaskedLoad(Src, Alignment))
|
if (Opcode == Instruction::Load && isLegalMaskedLoad(Src, Alignment))
|
||||||
return ST->getMVEVectorCostFactor(CostKind);
|
return ST->getMVEVectorCostFactor(CostKind);
|
||||||
|
@ -231,9 +231,9 @@ public:
|
|||||||
TTI::TargetCostKind CostKind,
|
TTI::TargetCostKind CostKind,
|
||||||
const Instruction *I = nullptr);
|
const Instruction *I = nullptr);
|
||||||
|
|
||||||
unsigned getMaskedMemoryOpCost(unsigned Opcode, Type *Src, Align Alignment,
|
InstructionCost getMaskedMemoryOpCost(unsigned Opcode, Type *Src,
|
||||||
unsigned AddressSpace,
|
Align Alignment, unsigned AddressSpace,
|
||||||
TTI::TargetCostKind CostKind);
|
TTI::TargetCostKind CostKind);
|
||||||
|
|
||||||
int getInterleavedMemoryOpCost(
|
int getInterleavedMemoryOpCost(
|
||||||
unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef<unsigned> Indices,
|
unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef<unsigned> Indices,
|
||||||
|
@ -210,10 +210,10 @@ unsigned HexagonTTIImpl::getMemoryOpCost(unsigned Opcode, Type *Src,
|
|||||||
CostKind, I);
|
CostKind, I);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned HexagonTTIImpl::getMaskedMemoryOpCost(unsigned Opcode, Type *Src,
|
InstructionCost
|
||||||
Align Alignment,
|
HexagonTTIImpl::getMaskedMemoryOpCost(unsigned Opcode, Type *Src,
|
||||||
unsigned AddressSpace,
|
Align Alignment, unsigned AddressSpace,
|
||||||
TTI::TargetCostKind CostKind) {
|
TTI::TargetCostKind CostKind) {
|
||||||
return BaseT::getMaskedMemoryOpCost(Opcode, Src, Alignment, AddressSpace,
|
return BaseT::getMaskedMemoryOpCost(Opcode, Src, Alignment, AddressSpace,
|
||||||
CostKind);
|
CostKind);
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,7 @@ public:
|
|||||||
unsigned AddressSpace,
|
unsigned AddressSpace,
|
||||||
TTI::TargetCostKind CostKind,
|
TTI::TargetCostKind CostKind,
|
||||||
const Instruction *I = nullptr);
|
const Instruction *I = nullptr);
|
||||||
unsigned
|
InstructionCost
|
||||||
getMaskedMemoryOpCost(unsigned Opcode, Type *Src, Align Alignment,
|
getMaskedMemoryOpCost(unsigned Opcode, Type *Src, Align Alignment,
|
||||||
unsigned AddressSpace,
|
unsigned AddressSpace,
|
||||||
TTI::TargetCostKind CostKind = TTI::TCK_SizeAndLatency);
|
TTI::TargetCostKind CostKind = TTI::TCK_SizeAndLatency);
|
||||||
|
@ -3257,9 +3257,10 @@ int X86TTIImpl::getMemoryOpCost(unsigned Opcode, Type *Src,
|
|||||||
return Cost;
|
return Cost;
|
||||||
}
|
}
|
||||||
|
|
||||||
int X86TTIImpl::getMaskedMemoryOpCost(unsigned Opcode, Type *SrcTy,
|
InstructionCost
|
||||||
Align Alignment, unsigned AddressSpace,
|
X86TTIImpl::getMaskedMemoryOpCost(unsigned Opcode, Type *SrcTy, Align Alignment,
|
||||||
TTI::TargetCostKind CostKind) {
|
unsigned AddressSpace,
|
||||||
|
TTI::TargetCostKind CostKind) {
|
||||||
bool IsLoad = (Instruction::Load == Opcode);
|
bool IsLoad = (Instruction::Load == Opcode);
|
||||||
bool IsStore = (Instruction::Store == Opcode);
|
bool IsStore = (Instruction::Store == Opcode);
|
||||||
|
|
||||||
@ -3288,8 +3289,7 @@ int X86TTIImpl::getMaskedMemoryOpCost(unsigned Opcode, Type *SrcTy,
|
|||||||
int MemopCost =
|
int MemopCost =
|
||||||
NumElem * BaseT::getMemoryOpCost(Opcode, SrcVTy->getScalarType(),
|
NumElem * BaseT::getMemoryOpCost(Opcode, SrcVTy->getScalarType(),
|
||||||
Alignment, AddressSpace, CostKind);
|
Alignment, AddressSpace, CostKind);
|
||||||
return *(MemopCost + ValueSplitCost + MaskSplitCost + MaskCmpCost)
|
return MemopCost + ValueSplitCost + MaskSplitCost + MaskCmpCost;
|
||||||
.getValue();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Legalize the type.
|
// Legalize the type.
|
||||||
|
@ -144,9 +144,10 @@ public:
|
|||||||
unsigned AddressSpace,
|
unsigned AddressSpace,
|
||||||
TTI::TargetCostKind CostKind,
|
TTI::TargetCostKind CostKind,
|
||||||
const Instruction *I = nullptr);
|
const Instruction *I = nullptr);
|
||||||
int getMaskedMemoryOpCost(
|
InstructionCost
|
||||||
unsigned Opcode, Type *Src, Align Alignment, unsigned AddressSpace,
|
getMaskedMemoryOpCost(unsigned Opcode, Type *Src, Align Alignment,
|
||||||
TTI::TargetCostKind CostKind = TTI::TCK_SizeAndLatency);
|
unsigned AddressSpace,
|
||||||
|
TTI::TargetCostKind CostKind = TTI::TCK_SizeAndLatency);
|
||||||
InstructionCost getGatherScatterOpCost(unsigned Opcode, Type *DataTy,
|
InstructionCost getGatherScatterOpCost(unsigned Opcode, Type *DataTy,
|
||||||
const Value *Ptr, bool VariableMask,
|
const Value *Ptr, bool VariableMask,
|
||||||
Align Alignment,
|
Align Alignment,
|
||||||
|
Loading…
Reference in New Issue
Block a user