17#ifndef LLVM_LIB_TARGET_ARM_ARMTARGETTRANSFORMINFO_H
18#define LLVM_LIB_TARGET_ARM_ARMTARGETTRANSFORMINFO_H
72 const FeatureBitset InlineFeaturesAllowed = {ARM::Feature8MSecExt,
75 ARM::FeatureAcquireRelease,
76 ARM::FeatureAvoidMOVsShOp,
77 ARM::FeatureAvoidMULS,
78 ARM::FeatureAvoidPartialCPSR,
81 ARM::FeatureCheapPredicableCPSR,
82 ARM::FeatureCheckVLDnAlign,
88 ARM::FeatureDontWidenVMOVS,
90 ARM::FeatureExecuteOnly,
91 ARM::FeatureExpandMLx,
97 ARM::FeatureFPARMv8_D16,
98 ARM::FeatureFPARMv8_D16_SP,
99 ARM::FeatureFPARMv8_SP,
101 ARM::FeatureFPRegs16,
102 ARM::FeatureFPRegs64,
103 ARM::FeatureFullFP16,
105 ARM::FeatureFuseLiterals,
106 ARM::FeatureHWDivARM,
107 ARM::FeatureHWDivThumb,
108 ARM::FeatureHasNoBranchPredictor,
109 ARM::FeatureHasRetAddrStack,
110 ARM::FeatureHasSlowFPVFMx,
111 ARM::FeatureHasSlowFPVMLx,
112 ARM::FeatureHasVMLxHazards,
114 ARM::FeatureLongCalls,
117 ARM::FeatureMVEVectorCostFactor1,
118 ARM::FeatureMVEVectorCostFactor2,
119 ARM::FeatureMVEVectorCostFactor4,
120 ARM::FeatureMatMulInt8,
121 ARM::FeatureMuxedUnits,
123 ARM::FeatureNEONForFP,
124 ARM::FeatureNEONForFPMovs,
126 ARM::FeatureNoNegativeImmediates,
127 ARM::FeatureNoPostRASched,
129 ARM::FeaturePref32BitThumb,
130 ARM::FeaturePrefISHSTBarrier,
131 ARM::FeaturePreferBranchAlign32,
132 ARM::FeaturePreferBranchAlign64,
133 ARM::FeaturePreferVMOVSR,
134 ARM::FeatureProfUnpredicate,
137 ARM::FeatureReserveR9,
140 ARM::FeatureSlowFPBrcc,
141 ARM::FeatureSlowLoadDSubreg,
142 ARM::FeatureSlowOddRegister,
143 ARM::FeatureSlowVDUP32,
144 ARM::FeatureSlowVGETLNi32,
145 ARM::FeatureSplatVFPToNeon,
146 ARM::FeatureStrictAlign,
148 ARM::FeatureTrustZone,
149 ARM::FeatureUseMIPipeliner,
150 ARM::FeatureUseMISched,
151 ARM::FeatureUseWideStrideVFP,
156 ARM::FeatureVFP3_D16,
157 ARM::FeatureVFP3_D16_SP,
160 ARM::FeatureVFP4_D16,
161 ARM::FeatureVFP4_D16_SP,
163 ARM::FeatureVMLxForwarding,
164 ARM::FeatureVirtualization,
165 ARM::FeatureZCZeroing,
167 ARM::HasMVEIntegerOps,
175 ARM::HasV8MBaselineOps,
176 ARM::HasV8MMainlineOps,
178 ARM::HasV8_1MMainlineOps,
203 TLI(ST->getTargetLowering()) {}
206 const Function *Callee)
const override;
217 return !ST->isTargetDarwin() && !ST->hasMVEFloatOps();
220 std::optional<Instruction *>
226 SimplifyAndSetOp)
const override;
233 Type *Ty)
const override;
250 bool Vector = (ClassID == 1);
254 if (ST->hasMVEIntegerOps())
259 if (ST->isThumb1Only())
272 if (ST->hasMVEIntegerOps())
282 return ST->getMaxInterleaveFactor();
300 Align Alignment)
const override {
309 Align Alignment)
const override {
322 return ST->getMaxInlineSizeThreshold();
331 const Instruction *CxtI =
nullptr)
const override;
359 unsigned Index,
const Value *Op0,
360 const Value *Op1)
const override;
387 unsigned Opcode,
Type *VecTy,
unsigned Factor, ArrayRef<unsigned> Indices,
389 bool UseMaskForCond =
false,
bool UseMaskForGaps =
false)
const override;
396 std::optional<FastMathFlags> FMF,
400 VectorType *ValTy, std::optional<FastMathFlags> FMF,
420 StackOffset BaseOffset,
bool HasBaseReg,
422 unsigned AddrSpace)
const override;
427 AssumptionCache &AC, TargetLibraryInfo *LibInfo,
428 HardwareLoopInfo &HWLoopInfo)
const override;
432 OptimizationRemarkEmitter *ORE)
const override;
443 if (ST->isROPI() || ST->isRWPI())
444 return !
C->needsDynamicRelocation();
465 "Only possible block sizes for VREV are: 16, 32, 64");
468 if (EltSz != 8 && EltSz != 16 && EltSz != 32)
471 unsigned BlockElts = M[0] + 1;
479 for (
unsigned i = 0, e = M.size(); i < e; ++i) {
482 if ((
unsigned)M[i] != (i - i % BlockElts) + (BlockElts - 1 - i % BlockElts))
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file provides a helper that implements much of the TTI interface in terms of the target-independ...
static cl::opt< OutputCostKind > CostKind("cost-kind", cl::desc("Target cost kind"), cl::init(OutputCostKind::RecipThroughput), cl::values(clEnumValN(OutputCostKind::RecipThroughput, "throughput", "Reciprocal throughput"), clEnumValN(OutputCostKind::Latency, "latency", "Instruction latency"), clEnumValN(OutputCostKind::CodeSize, "code-size", "Code size"), clEnumValN(OutputCostKind::SizeAndLatency, "size-latency", "Code size and latency"), clEnumValN(OutputCostKind::All, "all", "Print all cost kinds")))
const AbstractManglingParser< Derived, Alloc >::OperatorInfo AbstractManglingParser< Derived, Alloc >::Ops[]
uint64_t IntrinsicInst * II
static const int BlockSize
Class for arbitrary precision integers.
InstructionCost getGatherScatterOpCost(const MemIntrinsicCostAttributes &MICA, TTI::TargetCostKind CostKind) const
TypeSize getRegisterBitWidth(TargetTransformInfo::RegisterKind K) const override
InstructionCost getAddressComputationCost(Type *Val, ScalarEvolution *SE, const SCEV *Ptr, TTI::TargetCostKind CostKind) const override
TailFoldingStyle getPreferredTailFoldingStyle(bool IVUpdateMayOverflow=true) const override
bool isFPVectorizationPotentiallyUnsafe() const override
Floating-point computation using ARMv8 AArch32 Advanced SIMD instructions remains unchanged from ARMv...
InstructionCost getMaskedMemoryOpCost(const MemIntrinsicCostAttributes &MICA, TTI::TargetCostKind CostKind) const
InstructionCost getMemoryOpCost(unsigned Opcode, Type *Src, Align Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind, TTI::OperandValueInfo OpInfo={TTI::OK_AnyValue, TTI::OP_None}, const Instruction *I=nullptr) const override
InstructionCost getMemcpyCost(const Instruction *I) const override
bool isLegalMaskedScatter(Type *Ty, Align Alignment) const override
bool maybeLoweredToCall(Instruction &I) const
bool preferInLoopReduction(RecurKind Kind, Type *Ty) const override
InstructionCost getCmpSelInstrCost(unsigned Opcode, Type *ValTy, Type *CondTy, CmpInst::Predicate VecPred, TTI::TargetCostKind CostKind, TTI::OperandValueInfo Op1Info={TTI::OK_AnyValue, TTI::OP_None}, TTI::OperandValueInfo Op2Info={TTI::OK_AnyValue, TTI::OP_None}, const Instruction *I=nullptr) const override
InstructionCost getMulAccReductionCost(bool IsUnsigned, unsigned RedOpcode, Type *ResTy, VectorType *ValTy, TTI::TargetCostKind CostKind) const override
InstructionCost getInterleavedMemoryOpCost(unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef< unsigned > Indices, Align Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind, bool UseMaskForCond=false, bool UseMaskForGaps=false) const override
InstructionCost getIntImmCost(const APInt &Imm, Type *Ty, TTI::TargetCostKind CostKind) const override
bool hasArmWideBranch(bool Thumb) const override
bool shouldExpandReduction(const IntrinsicInst *II) const override
bool shouldBuildLookupTablesForConstant(Constant *C) const override
InstructionCost getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src, TTI::CastContextHint CCH, TTI::TargetCostKind CostKind, const Instruction *I=nullptr) const override
int getNumMemOps(const IntrinsicInst *I) const
Given a memcpy/memset/memmove instruction, return the number of memory operations performed,...
InstructionCost getCFInstrCost(unsigned Opcode, TTI::TargetCostKind CostKind, const Instruction *I=nullptr) const override
InstructionCost getIntImmCodeSizeCost(unsigned Opcode, unsigned Idx, const APInt &Imm, Type *Ty) const override
bool isLoweredToCall(const Function *F) const override
InstructionCost getExtendedReductionCost(unsigned Opcode, bool IsUnsigned, Type *ResTy, VectorType *ValTy, std::optional< FastMathFlags > FMF, TTI::TargetCostKind CostKind) const override
bool isProfitableToSinkOperands(Instruction *I, SmallVectorImpl< Use * > &Ops) const override
Check if sinking I's operands to I's basic block is profitable, because the operands can be folded in...
uint64_t getMaxMemIntrinsicInlineSizeThreshold() const override
bool isLegalMaskedStore(Type *DataTy, Align Alignment, unsigned AddressSpace, TTI::MaskKind MaskKind=TTI::MaskKind::VariableOrConstantMask) const override
bool forceScalarizeMaskedScatter(VectorType *VTy, Align Alignment) const override
InstructionCost getVectorInstrCost(unsigned Opcode, Type *Val, TTI::TargetCostKind CostKind, unsigned Index, const Value *Op0, const Value *Op1) const override
InstructionCost getArithmeticReductionCost(unsigned Opcode, VectorType *ValTy, std::optional< FastMathFlags > FMF, TTI::TargetCostKind CostKind) const override
std::optional< Value * > simplifyDemandedVectorEltsIntrinsic(InstCombiner &IC, IntrinsicInst &II, APInt DemandedElts, APInt &UndefElts, APInt &UndefElts2, APInt &UndefElts3, std::function< void(Instruction *, unsigned, APInt, APInt &)> SimplifyAndSetOp) const override
bool isLegalMaskedLoad(Type *DataTy, Align Alignment, unsigned AddressSpace, TTI::MaskKind MaskKind=TTI::MaskKind::VariableOrConstantMask) const override
ARMTTIImpl(const ARMBaseTargetMachine *TM, const Function &F)
InstructionCost getIntImmCostInst(unsigned Opcode, unsigned Idx, const APInt &Imm, Type *Ty, TTI::TargetCostKind CostKind, Instruction *Inst=nullptr) const override
InstructionCost getArithmeticInstrCost(unsigned Opcode, Type *Ty, TTI::TargetCostKind CostKind, TTI::OperandValueInfo Op1Info={TTI::OK_AnyValue, TTI::OP_None}, TTI::OperandValueInfo Op2Info={TTI::OK_AnyValue, TTI::OP_None}, ArrayRef< const Value * > Args={}, const Instruction *CxtI=nullptr) const override
InstructionCost getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA, TTI::TargetCostKind CostKind) const override
std::optional< Instruction * > instCombineIntrinsic(InstCombiner &IC, IntrinsicInst &II) const override
void getPeelingPreferences(Loop *L, ScalarEvolution &SE, TTI::PeelingPreferences &PP) const override
InstructionCost getMinMaxReductionCost(Intrinsic::ID IID, VectorType *Ty, FastMathFlags FMF, TTI::TargetCostKind CostKind) const override
TTI::AddressingModeKind getPreferredAddressingMode(const Loop *L, ScalarEvolution *SE) const override
bool preferPredicateOverEpilogue(TailFoldingInfo *TFI) const override
bool forceScalarizeMaskedGather(VectorType *VTy, Align Alignment) const override
unsigned getNumberOfRegisters(unsigned ClassID) const override
InstructionCost getShuffleCost(TTI::ShuffleKind Kind, VectorType *DstTy, VectorType *SrcTy, ArrayRef< int > Mask, TTI::TargetCostKind CostKind, int Index, VectorType *SubTp, ArrayRef< const Value * > Args={}, const Instruction *CxtI=nullptr) const override
bool areInlineCompatible(const Function *Caller, const Function *Callee) const override
InstructionCost getMemIntrinsicInstrCost(const MemIntrinsicCostAttributes &MICA, TTI::TargetCostKind CostKind) const override
bool preferPredicatedReductionSelect() const override
bool isLegalMaskedGather(Type *Ty, Align Alignment) const override
unsigned getMaxInterleaveFactor(ElementCount VF) const override
unsigned getNumBytesToPadGlobalArray(unsigned Size, Type *ArrayType) const override
bool isProfitableLSRChainElement(Instruction *I) const override
bool isHardwareLoopProfitable(Loop *L, ScalarEvolution &SE, AssumptionCache &AC, TargetLibraryInfo *LibInfo, HardwareLoopInfo &HWLoopInfo) const override
void getUnrollingPreferences(Loop *L, ScalarEvolution &SE, TTI::UnrollingPreferences &UP, OptimizationRemarkEmitter *ORE) const override
bool enableInterleavedAccessVectorization() const override
InstructionCost getScalingFactorCost(Type *Ty, GlobalValue *BaseGV, StackOffset BaseOffset, bool HasBaseReg, int64_t Scale, unsigned AddrSpace) const override
getScalingFactorCost - Return the cost of the scaling used in addressing mode represented by AM.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Class to represent array types.
InstructionCost getVectorInstrCost(unsigned Opcode, Type *Val, TTI::TargetCostKind CostKind, unsigned Index, const Value *Op0, const Value *Op1) const override
BasicTTIImplBase(const TargetMachine *TM, const DataLayout &DL)
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
This is an important base class in LLVM.
Container class for subtarget features.
The core instruction combiner logic.
A wrapper class for inspecting calls to intrinsic functions.
Represents a single loop in the control flow graph.
This class represents an analyzed expression in the program.
The main scalar evolution driver.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
static constexpr TypeSize getFixed(ScalarTy ExactSize)
static constexpr TypeSize getScalable(ScalarTy MinimumSize)
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM Value Representation.
Base class of all SIMD vector types.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
@ C
The default llvm calling convention, compatible with C.
@ ForceEnabledNoReductions
friend class Instruction
Iterator for Instructions in a `BasicBlock.
This is an optimization pass for GlobalISel generic memory operations.
FunctionAddr VTableAddr Value
ArrayRef(const T &OneElt) -> ArrayRef< T >
bool isVREVMask(ArrayRef< int > M, EVT VT, unsigned BlockSize)
isVREVMask - Check if a vector shuffle corresponds to a VREV instruction with the specified blocksize...
This struct is a compact representation of a valid (non-zero power of two) alignment.
uint64_t getScalarSizeInBits() const