Go to the documentation of this file.
29 #define DEBUG_TYPE "hexagontti"
36 cl::desc(
"Control lookup table emission on Hexagon target"));
46 bool HexagonTTIImpl::useHVX()
const {
50 unsigned HexagonTTIImpl::getTypeNumElements(
Type *Ty)
const {
51 if (
auto *VTy = dyn_cast<FixedVectorType>(Ty))
52 return VTy->getNumElements();
54 "Expecting scalar type");
94 return useHVX() ? 32 : 0;
99 return useHVX() ? 2 : 1;
121 bool IsScalable)
const {
122 assert(!IsScalable &&
"Scalable VFs are not supported for Hexagon");
127 VectorType *Ty,
const APInt &DemandedElts,
bool Insert,
bool Extract) {
146 if (ICA.
getID() == Intrinsic::bswap) {
147 std::pair<InstructionCost, MVT>
LT =
174 if (Src->isVectorTy()) {
181 assert(RegWidth &&
"Non-zero vector register width expected");
183 if (VecWidth % RegWidth == 0)
184 return VecWidth / RegWidth;
186 const Align RegAlign(RegWidth / 8);
187 if (!Alignment || *Alignment > RegAlign)
188 Alignment = RegAlign;
190 unsigned AlignWidth = 8 * Alignment->value();
191 unsigned NumLoads =
alignTo(VecWidth, AlignWidth) / AlignWidth;
202 unsigned AlignWidth = 8 * BoundAlignment.
value();
203 unsigned NumLoads =
alignTo(VecWidth, AlignWidth) / AlignWidth;
204 if (Alignment ==
Align(4) || Alignment ==
Align(8))
205 return Cost * NumLoads;
208 unsigned LogA =
Log2(BoundAlignment);
209 return (3 - LogA) * Cost * NumLoads;
232 unsigned Opcode,
Type *DataTy,
const Value *Ptr,
bool VariableMask,
241 bool UseMaskForCond,
bool UseMaskForGaps) {
242 if (Indices.
size() != Factor || UseMaskForCond || UseMaskForGaps)
246 UseMaskForCond, UseMaskForGaps);
258 if (Opcode == Instruction::FCmp)
273 Opd2Info, Opd1PropInfo,
274 Opd2PropInfo,
Args, CxtI);
278 if (
LT.second.isFloatingPoint())
282 Opd1PropInfo, Opd2PropInfo,
Args, CxtI);
294 std::pair<InstructionCost, MVT> SrcLT =
296 std::pair<InstructionCost, MVT> DstLT =
302 return Cost == 0 ? 0 : 1;
310 Type *ElemTy = Val->
isVectorTy() ? cast<VectorType>(Val)->getElementType()
312 if (Opcode == Instruction::InsertElement) {
314 unsigned Cost = (
Index != 0) ? 2 : 0;
321 if (Opcode == Instruction::ExtractElement)
348 auto isCastFoldedIntoLoad = [
this](
const CastInst *CI) ->
bool {
349 if (!CI->isIntegerCast())
356 if (DBW != 32 || SBW >= DBW)
359 const LoadInst *LI = dyn_cast<const LoadInst>(CI->getOperand(0));
366 if (
const CastInst *CI = dyn_cast<const CastInst>(U))
367 if (isCastFoldedIntoLoad(CI))
unsigned getMinVectorRegisterBitWidth() const
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
unsigned getVectorLength() const
InstructionCost getOperandsScalarizationOverhead(ArrayRef< const Value * > Args, ArrayRef< Type * > Tys)
Estimate the overhead of scalarizing an instructions unique non-constant operands.
This is an optimization pass for GlobalISel generic memory operations.
A parsed version of the target data layout string in and methods for querying it.
bool hasOneUse() const
Return true if there is exactly one use of this value.
Vector Rotate Left Mask Mask Insert
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
ScalarTy getFixedSize() const
Represents a single loop in the control flow graph.
TypeSize getTypeSizeInBits(Type *Ty) const
Size examples:
Type * getReturnType() const
The main scalar evolution driver.
InstructionCost getArithmeticInstrCost(unsigned Opcode, Type *Ty, TTI::TargetCostKind CostKind, TTI::OperandValueKind Opd1Info=TTI::OK_AnyValue, TTI::OperandValueKind Opd2Info=TTI::OK_AnyValue, TTI::OperandValueProperties Opd1PropInfo=TTI::OP_None, TTI::OperandValueProperties Opd2PropInfo=TTI::OP_None, ArrayRef< const Value * > Args=ArrayRef< const Value * >(), const Instruction *CxtI=nullptr)
bool isFPOrFPVectorTy() const
Return true if this is a FP type or a vector of FP.
InstructionCost getMemoryOpCost(unsigned Opcode, Type *Src, MaybeAlign Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind, const Instruction *I=nullptr)
The instances of the Type class are immutable: once they are created, they are never changed.
So we should use XX3Form_Rcr to implement intrinsic Convert DP outs ins xscvdpsp No builtin are required Round &Convert QP DP(dword[1] is set to zero) No builtin are required Round to Quad Precision because you need to assign rounding mode in instruction Provide builtin(set f128:$vT,(int_ppc_vsx_xsrqpi f128:$vB))(set f128 yields< n x< ty > >< result > yields< ty >< result > No builtin are required Load Store Vector
InstructionCost getShuffleCost(TTI::ShuffleKind Kind, Type *Tp, ArrayRef< int > Mask, int Index, Type *SubTp, ArrayRef< const Value * > Args=None)
std::pair< InstructionCost, MVT > getTypeLegalizationCost(const DataLayout &DL, Type *Ty) const
Estimate the cost of type-legalization and the legalized type.
Type * getElementType() const
unsigned getMaxInterleaveFactor(unsigned VF)
Expected< ExpressionValue > max(const ExpressionValue &Lhs, const ExpressionValue &Rhs)
bool isFloatingPointTy() const
Return true if this is one of the six floating-point types.
bool isTypeForHVX(Type *VecTy, bool IncludeBool=false) const
InstructionCost getGatherScatterOpCost(unsigned Opcode, Type *DataTy, const Value *Ptr, bool VariableMask, Align Alignment, TTI::TargetCostKind CostKind, const Instruction *I)
unsigned getL1CacheLineSize() const
constexpr std::underlying_type_t< E > Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
InstructionCost getVectorInstrCost(unsigned Opcode, Type *Val, unsigned Index)
TTI::PopcntSupportKind getPopcntSupport(unsigned IntTyWidthInBit) const
InstructionCost getUserCost(const User *U, ArrayRef< const Value * > Operands, TTI::TargetCostKind CostKind)
unsigned Log2(Align A)
Returns the log2 of the alignment.
bool isVectorTy() const
True if this is an instance of VectorType.
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.
bool shouldBuildLookupTables() const
This struct is a compact representation of a valid (non-zero power of two) alignment.
InstructionCost getCmpSelInstrCost(unsigned Opcode, Type *ValTy, Type *CondTy, CmpInst::Predicate VecPred, TTI::TargetCostKind CostKind, const Instruction *I=nullptr)
static TypeSize getFixed(ScalarTy MinVal)
mir Rename Register Operands
unsigned getL1PrefetchDistance() const
bool isIntegerTy() const
True if this is an instance of IntegerType.
unsigned getSmallConstantTripCount(const Loop *L)
Returns the exact trip count of the loop if we can compute it, and the result is a small constant.
Base class of all SIMD vector types.
This class represents an analyzed expression in the program.
unsigned getSmallConstantMaxTripCount(const Loop *L)
Returns the upper bound of the loop trip count as a normal unsigned value.
initializer< Ty > init(const Ty &Val)
InstructionCost getInterleavedMemoryOpCost(unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef< unsigned > Indices, Align Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind, bool UseMaskForCond=false, bool UseMaskForGaps=false)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
InstructionCost getInterleavedMemoryOpCost(unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef< unsigned > Indices, Align Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind, bool UseMaskForCond=false, bool UseMaskForGaps=false)
bool isLegalMaskedStore(Type *DataType, Align Alignment)
InstructionCost getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src, TTI::CastContextHint CCH, TTI::TargetCostKind CostKind, const Instruction *I=nullptr)
Class for arbitrary precision integers.
InstructionCost getCallInstrCost(Function *F, Type *RetTy, ArrayRef< Type * > Tys, TTI::TargetCostKind CostKind)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Expected< ExpressionValue > min(const ExpressionValue &Lhs, const ExpressionValue &Rhs)
InstructionCost getOperandsScalarizationOverhead(ArrayRef< const Value * > Args, ArrayRef< Type * > Tys)
InstructionCost getScalarizationOverhead(VectorType *InTy, const APInt &DemandedElts, bool Insert, bool Extract)
Estimate the overhead of scalarizing an instruction.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
static cl::opt< TargetTransformInfo::TargetCostKind > CostKind("cost-kind", cl::desc("Target cost kind"), cl::init(TargetTransformInfo::TCK_RecipThroughput), cl::values(clEnumValN(TargetTransformInfo::TCK_RecipThroughput, "throughput", "Reciprocal throughput"), clEnumValN(TargetTransformInfo::TCK_Latency, "latency", "Instruction latency"), clEnumValN(TargetTransformInfo::TCK_CodeSize, "code-size", "Code size"), clEnumValN(TargetTransformInfo::TCK_SizeAndLatency, "size-latency", "Code size and latency")))
TypeSize getRegisterBitWidth(TargetTransformInfo::RegisterKind K) const
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
This is the base class for all instructions that perform data casts.
void getPeelingPreferences(Loop *L, ScalarEvolution &SE, TTI::PeelingPreferences &PP)
An instruction for reading from memory.
InstructionCost getMaskedMemoryOpCost(unsigned Opcode, Type *Src, Align Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind)
bool isInnermost() const
Return true if the loop does not contain any (natural) loops.
void getPeelingPreferences(Loop *L, ScalarEvolution &SE, TTI::PeelingPreferences &PP)
InstructionCost getCallInstrCost(Function *F, Type *RetTy, ArrayRef< Type * > Tys, TTI::TargetCostKind CostKind)
Compute a cost of the given call instruction.
uint64_t value() const
This is a hole in the type system and should not be abused.
InstructionCost getArithmeticInstrCost(unsigned Opcode, Type *Ty, TTI::TargetCostKind CostKind, TTI::OperandValueKind Opd1Info=TTI::OK_AnyValue, TTI::OperandValueKind Opd2Info=TTI::OK_AnyValue, TTI::OperandValueProperties Opd1PropInfo=TTI::OP_None, TTI::OperandValueProperties Opd2PropInfo=TTI::OP_None, ArrayRef< const Value * > Args=ArrayRef< const Value * >(), const Instruction *CxtI=nullptr)
InstructionCost getMaskedMemoryOpCost(unsigned Opcode, Type *DataTy, Align Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind)
static TypeSize getScalable(ScalarTy MinVal)
InstructionCost getAddressComputationCost(Type *Tp, ScalarEvolution *SE, const SCEV *S)
InstructionCost getGatherScatterOpCost(unsigned Opcode, Type *DataTy, const Value *Ptr, bool VariableMask, Align Alignment, TTI::TargetCostKind CostKind, const Instruction *I=nullptr)
Intrinsic::ID getID() const
unsigned getPrefetchDistance() const override
— Vector TTI end —
InstructionCost getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA, TTI::TargetCostKind CostKind)
Get intrinsic cost based on arguments.
InstructionCost getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA, TTI::TargetCostKind CostKind)
TTI::AddressingModeKind getPreferredAddressingMode(const Loop *L, ScalarEvolution *SE) const
Bias LSR towards creating post-increment opportunities.
size_t size() const
size - Get the array size.
InstructionCost getCmpSelInstrCost(unsigned Opcode, Type *ValTy, Type *CondTy, CmpInst::Predicate VecPred, TTI::TargetCostKind CostKind, const Instruction *I=nullptr)
InstructionCost getMemoryOpCost(unsigned Opcode, Type *Src, MaybeAlign Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind, const Instruction *I=nullptr)
unsigned getCacheLineSize() const override
InstructionCost getScalarizationOverhead(VectorType *Ty, const APInt &DemandedElts, bool Insert, bool Extract)
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
bool isLegalMaskedLoad(Type *DataType, Align Alignment)
unsigned getNumberOfRegisters(bool vector) const
— Vector TTI begin —
void getUnrollingPreferences(Loop *L, ScalarEvolution &SE, TTI::UnrollingPreferences &UP, OptimizationRemarkEmitter *ORE)
LLVM Value Representation.
ElementCount getMinimumVF(unsigned ElemWidth, bool IsScalable) const
TypeSize getPrimitiveSizeInBits() const LLVM_READONLY
Return the basic size of this type if it is a primitive type.