mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 20:23:11 +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,7 +1594,8 @@ 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
|
||||||
|
getMaskedMemoryOpCost(unsigned Opcode, Type *Src, Align Alignment,
|
||||||
unsigned AddressSpace,
|
unsigned AddressSpace,
|
||||||
TTI::TargetCostKind CostKind) = 0;
|
TTI::TargetCostKind CostKind) = 0;
|
||||||
virtual InstructionCost
|
virtual InstructionCost
|
||||||
@ -2075,8 +2076,8 @@ 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,8 +543,8 @@ 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,8 +1427,8 @@ 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()) {
|
||||||
|
@ -231,8 +231,8 @@ 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(
|
||||||
|
@ -210,9 +210,9 @@ 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,8 +3257,9 @@ 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,
|
||||||
|
unsigned AddressSpace,
|
||||||
TTI::TargetCostKind CostKind) {
|
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,8 +144,9 @@ 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,
|
||||||
|
unsigned AddressSpace,
|
||||||
TTI::TargetCostKind CostKind = TTI::TCK_SizeAndLatency);
|
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,
|
||||||
|
Loading…
Reference in New Issue
Block a user