mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 12:12:47 +01:00
[TTI] NFC: Change getGatherScatterOpCost 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/D100200
This commit is contained in:
parent
cb03a318d0
commit
ee0f916cf3
@ -1148,7 +1148,7 @@ public:
|
||||
/// \p Alignment - alignment of single element
|
||||
/// \p I - the optional original context instruction, if one exists, e.g. the
|
||||
/// load/store to transform or the call to the gather/scatter intrinsic
|
||||
int getGatherScatterOpCost(
|
||||
InstructionCost getGatherScatterOpCost(
|
||||
unsigned Opcode, Type *DataTy, const Value *Ptr, bool VariableMask,
|
||||
Align Alignment, TTI::TargetCostKind CostKind = TTI::TCK_RecipThroughput,
|
||||
const Instruction *I = nullptr) const;
|
||||
@ -1596,9 +1596,9 @@ public:
|
||||
virtual int getMaskedMemoryOpCost(unsigned Opcode, Type *Src, Align Alignment,
|
||||
unsigned AddressSpace,
|
||||
TTI::TargetCostKind CostKind) = 0;
|
||||
virtual int getGatherScatterOpCost(unsigned Opcode, Type *DataTy,
|
||||
const Value *Ptr, bool VariableMask,
|
||||
Align Alignment,
|
||||
virtual InstructionCost
|
||||
getGatherScatterOpCost(unsigned Opcode, Type *DataTy, const Value *Ptr,
|
||||
bool VariableMask, Align Alignment,
|
||||
TTI::TargetCostKind CostKind,
|
||||
const Instruction *I = nullptr) = 0;
|
||||
|
||||
@ -2078,7 +2078,8 @@ public:
|
||||
return Impl.getMaskedMemoryOpCost(Opcode, Src, Alignment, AddressSpace,
|
||||
CostKind);
|
||||
}
|
||||
int getGatherScatterOpCost(unsigned Opcode, Type *DataTy, const Value *Ptr,
|
||||
InstructionCost
|
||||
getGatherScatterOpCost(unsigned Opcode, Type *DataTy, const Value *Ptr,
|
||||
bool VariableMask, Align Alignment,
|
||||
TTI::TargetCostKind CostKind,
|
||||
const Instruction *I = nullptr) override {
|
||||
|
@ -549,9 +549,10 @@ public:
|
||||
return 1;
|
||||
}
|
||||
|
||||
unsigned getGatherScatterOpCost(unsigned Opcode, Type *DataTy,
|
||||
InstructionCost getGatherScatterOpCost(unsigned Opcode, Type *DataTy,
|
||||
const Value *Ptr, bool VariableMask,
|
||||
Align Alignment, TTI::TargetCostKind CostKind,
|
||||
Align Alignment,
|
||||
TTI::TargetCostKind CostKind,
|
||||
const Instruction *I = nullptr) const {
|
||||
return 1;
|
||||
}
|
||||
|
@ -1025,9 +1025,10 @@ public:
|
||||
return Cost;
|
||||
}
|
||||
|
||||
unsigned getGatherScatterOpCost(unsigned Opcode, Type *DataTy,
|
||||
InstructionCost getGatherScatterOpCost(unsigned Opcode, Type *DataTy,
|
||||
const Value *Ptr, bool VariableMask,
|
||||
Align Alignment, TTI::TargetCostKind CostKind,
|
||||
Align Alignment,
|
||||
TTI::TargetCostKind CostKind,
|
||||
const Instruction *I = nullptr) {
|
||||
auto *VT = cast<FixedVectorType>(DataTy);
|
||||
// Assume the target does not have support for gather/scatter operations
|
||||
|
@ -839,11 +839,11 @@ int TargetTransformInfo::getMaskedMemoryOpCost(
|
||||
return Cost;
|
||||
}
|
||||
|
||||
int TargetTransformInfo::getGatherScatterOpCost(
|
||||
InstructionCost TargetTransformInfo::getGatherScatterOpCost(
|
||||
unsigned Opcode, Type *DataTy, const Value *Ptr, bool VariableMask,
|
||||
Align Alignment, TTI::TargetCostKind CostKind, const Instruction *I) const {
|
||||
int Cost = TTIImpl->getGatherScatterOpCost(Opcode, DataTy, Ptr, VariableMask,
|
||||
Alignment, CostKind, I);
|
||||
InstructionCost Cost = TTIImpl->getGatherScatterOpCost(
|
||||
Opcode, DataTy, Ptr, VariableMask, Alignment, CostKind, I);
|
||||
assert(Cost >= 0 && "TTI should not produce negative costs!");
|
||||
return Cost;
|
||||
}
|
||||
|
@ -917,7 +917,7 @@ AArch64TTIImpl::enableMemCmpExpansion(bool OptSize, bool IsZeroCmp) const {
|
||||
return Options;
|
||||
}
|
||||
|
||||
unsigned AArch64TTIImpl::getGatherScatterOpCost(
|
||||
InstructionCost AArch64TTIImpl::getGatherScatterOpCost(
|
||||
unsigned Opcode, Type *DataTy, const Value *Ptr, bool VariableMask,
|
||||
Align Alignment, TTI::TargetCostKind CostKind, const Instruction *I) {
|
||||
|
||||
|
@ -127,9 +127,10 @@ public:
|
||||
|
||||
unsigned getMaxInterleaveFactor(unsigned VF);
|
||||
|
||||
unsigned getGatherScatterOpCost(unsigned Opcode, Type *DataTy,
|
||||
InstructionCost getGatherScatterOpCost(unsigned Opcode, Type *DataTy,
|
||||
const Value *Ptr, bool VariableMask,
|
||||
Align Alignment, TTI::TargetCostKind CostKind,
|
||||
Align Alignment,
|
||||
TTI::TargetCostKind CostKind,
|
||||
const Instruction *I = nullptr);
|
||||
|
||||
InstructionCost getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src,
|
||||
|
@ -1485,11 +1485,9 @@ int ARMTTIImpl::getInterleavedMemoryOpCost(
|
||||
UseMaskForCond, UseMaskForGaps);
|
||||
}
|
||||
|
||||
unsigned ARMTTIImpl::getGatherScatterOpCost(unsigned Opcode, Type *DataTy,
|
||||
const Value *Ptr, bool VariableMask,
|
||||
Align Alignment,
|
||||
TTI::TargetCostKind CostKind,
|
||||
const Instruction *I) {
|
||||
InstructionCost ARMTTIImpl::getGatherScatterOpCost(
|
||||
unsigned Opcode, Type *DataTy, const Value *Ptr, bool VariableMask,
|
||||
Align Alignment, TTI::TargetCostKind CostKind, const Instruction *I) {
|
||||
using namespace PatternMatch;
|
||||
if (!ST->hasMVEIntegerOps() || !EnableMaskedGatherScatters)
|
||||
return BaseT::getGatherScatterOpCost(Opcode, DataTy, Ptr, VariableMask,
|
||||
|
@ -241,9 +241,10 @@ public:
|
||||
TTI::TargetCostKind CostKind = TTI::TCK_SizeAndLatency,
|
||||
bool UseMaskForCond = false, bool UseMaskForGaps = false);
|
||||
|
||||
unsigned getGatherScatterOpCost(unsigned Opcode, Type *DataTy,
|
||||
InstructionCost getGatherScatterOpCost(unsigned Opcode, Type *DataTy,
|
||||
const Value *Ptr, bool VariableMask,
|
||||
Align Alignment, TTI::TargetCostKind CostKind,
|
||||
Align Alignment,
|
||||
TTI::TargetCostKind CostKind,
|
||||
const Instruction *I = nullptr);
|
||||
|
||||
int getArithmeticReductionCost(unsigned Opcode, VectorType *ValTy,
|
||||
|
@ -224,7 +224,7 @@ unsigned HexagonTTIImpl::getShuffleCost(TTI::ShuffleKind Kind, Type *Tp,
|
||||
return 1;
|
||||
}
|
||||
|
||||
unsigned HexagonTTIImpl::getGatherScatterOpCost(
|
||||
InstructionCost HexagonTTIImpl::getGatherScatterOpCost(
|
||||
unsigned Opcode, Type *DataTy, const Value *Ptr, bool VariableMask,
|
||||
Align Alignment, TTI::TargetCostKind CostKind, const Instruction *I) {
|
||||
return BaseT::getGatherScatterOpCost(Opcode, DataTy, Ptr, VariableMask,
|
||||
|
@ -124,9 +124,10 @@ public:
|
||||
TTI::TargetCostKind CostKind = TTI::TCK_SizeAndLatency);
|
||||
unsigned getShuffleCost(TTI::ShuffleKind Kind, Type *Tp, ArrayRef<int> Mask,
|
||||
int Index, Type *SubTp);
|
||||
unsigned getGatherScatterOpCost(unsigned Opcode, Type *DataTy,
|
||||
InstructionCost getGatherScatterOpCost(unsigned Opcode, Type *DataTy,
|
||||
const Value *Ptr, bool VariableMask,
|
||||
Align Alignment, TTI::TargetCostKind CostKind,
|
||||
Align Alignment,
|
||||
TTI::TargetCostKind CostKind,
|
||||
const Instruction *I);
|
||||
unsigned getInterleavedMemoryOpCost(
|
||||
unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef<unsigned> Indices,
|
||||
|
@ -141,7 +141,7 @@ Optional<unsigned> RISCVTTIImpl::getMaxVScale() const {
|
||||
return BaseT::getMaxVScale();
|
||||
}
|
||||
|
||||
unsigned RISCVTTIImpl::getGatherScatterOpCost(
|
||||
InstructionCost RISCVTTIImpl::getGatherScatterOpCost(
|
||||
unsigned Opcode, Type *DataTy, const Value *Ptr, bool VariableMask,
|
||||
Align Alignment, TTI::TargetCostKind CostKind, const Instruction *I) {
|
||||
if (CostKind != TTI::TCK_RecipThroughput)
|
||||
@ -162,7 +162,7 @@ unsigned RISCVTTIImpl::getGatherScatterOpCost(
|
||||
|
||||
auto *VTy = cast<FixedVectorType>(DataTy);
|
||||
unsigned NumLoads = VTy->getNumElements();
|
||||
unsigned MemOpCost =
|
||||
InstructionCost MemOpCost =
|
||||
getMemoryOpCost(Opcode, VTy->getElementType(), Alignment, 0, CostKind, I);
|
||||
return NumLoads * MemOpCost;
|
||||
}
|
||||
|
@ -69,9 +69,10 @@ public:
|
||||
llvm_unreachable("Unsupported register kind");
|
||||
}
|
||||
|
||||
unsigned getGatherScatterOpCost(unsigned Opcode, Type *DataTy,
|
||||
InstructionCost getGatherScatterOpCost(unsigned Opcode, Type *DataTy,
|
||||
const Value *Ptr, bool VariableMask,
|
||||
Align Alignment, TTI::TargetCostKind CostKind,
|
||||
Align Alignment,
|
||||
TTI::TargetCostKind CostKind,
|
||||
const Instruction *I);
|
||||
|
||||
bool isLegalElementTypeForRVV(Type *ScalarTy) {
|
||||
|
@ -4223,10 +4223,9 @@ int X86TTIImpl::getGSScalarCost(unsigned Opcode, Type *SrcVTy,
|
||||
}
|
||||
|
||||
/// Calculate the cost of Gather / Scatter operation
|
||||
int X86TTIImpl::getGatherScatterOpCost(unsigned Opcode, Type *SrcVTy,
|
||||
const Value *Ptr, bool VariableMask,
|
||||
Align Alignment,
|
||||
TTI::TargetCostKind CostKind,
|
||||
InstructionCost X86TTIImpl::getGatherScatterOpCost(
|
||||
unsigned Opcode, Type *SrcVTy, const Value *Ptr, bool VariableMask,
|
||||
Align Alignment, TTI::TargetCostKind CostKind,
|
||||
const Instruction *I = nullptr) {
|
||||
if (CostKind != TTI::TCK_RecipThroughput) {
|
||||
if ((Opcode == Instruction::Load &&
|
||||
|
@ -147,8 +147,9 @@ public:
|
||||
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, Align Alignment,
|
||||
InstructionCost getGatherScatterOpCost(unsigned Opcode, Type *DataTy,
|
||||
const Value *Ptr, bool VariableMask,
|
||||
Align Alignment,
|
||||
TTI::TargetCostKind CostKind,
|
||||
const Instruction *I);
|
||||
int getAddressComputationCost(Type *PtrTy, ScalarEvolution *SE,
|
||||
|
Loading…
Reference in New Issue
Block a user