17#ifndef LLVM_LIB_TARGET_ARM_ARMTARGETTRANSFORMINFO_H
18#define LLVM_LIB_TARGET_ARM_ARMTARGETTRANSFORMINFO_H
57 TLI(ST->getTargetLowering()) {}
68 return !ST->isTargetDarwin() && !ST->hasMVEFloatOps();
71 std::optional<Instruction *>
77 SimplifyAndSetOp)
const override;
84 Type *Ty)
const override;
101 bool Vector = (ClassID == 1);
105 if (ST->hasMVEIntegerOps())
110 if (ST->isThumb1Only())
123 if (ST->hasMVEIntegerOps())
133 bool HasUnorderedReductions)
const override {
134 return ST->getMaxInterleaveFactor();
152 Align Alignment)
const override {
161 Align Alignment)
const override {
174 return ST->getMaxInlineSizeThreshold();
183 const Instruction *CtxI =
nullptr,
213 unsigned Index,
const Value *Op0,
const Value *Op1,
226 const TargetLibraryInfo *TLibInfo =
nullptr,
243 unsigned Opcode,
Type *VecTy,
unsigned Factor, ArrayRef<unsigned> Indices,
245 bool UseMaskForCond =
false,
bool UseMaskForGaps =
false)
const override;
252 std::optional<FastMathFlags> FMF,
256 VectorType *ValTy, std::optional<FastMathFlags> FMF,
272 unsigned Opcode,
Type *InputTypeA,
Type *InputTypeB,
Type *AccumType,
276 std::optional<FastMathFlags> FMF)
const override {
287 unsigned AddrSpace)
const override;
307 if (ST->isROPI() || ST->isRWPI())
308 return !
C->needsDynamicRelocation();
328 "Only possible block sizes for VREV are: 16, 32, 64");
331 if (EltSz != 8 && EltSz != 16 && EltSz != 32)
334 unsigned BlockElts = M[0] + 1;
342 for (
unsigned i = 0, e = M.size(); i < e; ++i) {
345 if ((
unsigned)M[i] != (i - i % BlockElts) + (BlockElts - 1 - i % BlockElts))
354 if (Mask.size() == Elements * 2)
355 return Index / Elements;
356 return Mask[Index] == 0 ? 0 : 1;
386 if ((M.size() != NumElts && M.size() != NumElts * 2) || NumElts % 2 != 0)
394 for (
unsigned i = 0; i < M.size(); i += NumElts) {
396 for (
unsigned j = 0; j < NumElts; j += 2) {
397 if ((M[i + j] >= 0 && (
unsigned)M[i + j] != j + WhichResult) ||
398 (M[i + j + 1] >= 0 &&
399 (
unsigned)M[i + j + 1] != j + NumElts + WhichResult))
404 if (M.size() == NumElts * 2)
414 unsigned &WhichResult) {
420 if ((M.size() != NumElts && M.size() != NumElts * 2) || NumElts % 2 != 0)
423 for (
unsigned i = 0; i < M.size(); i += NumElts) {
425 for (
unsigned j = 0; j < NumElts; j += 2) {
426 if ((M[i + j] >= 0 && (
unsigned)M[i + j] != j + WhichResult) ||
427 (M[i + j + 1] >= 0 && (
unsigned)M[i + j + 1] != j + WhichResult))
432 if (M.size() == NumElts * 2)
452 if (M.size() != NumElts && M.size() != NumElts * 2)
455 for (
unsigned i = 0; i < M.size(); i += NumElts) {
457 for (
unsigned j = 0; j < NumElts; ++j) {
458 if (M[i + j] >= 0 && (
unsigned)M[i + j] != 2 * j + WhichResult)
463 if (M.size() == NumElts * 2)
477 unsigned &WhichResult) {
483 if (M.size() != NumElts && M.size() != NumElts * 2)
486 unsigned Half = NumElts / 2;
487 for (
unsigned i = 0; i < M.size(); i += NumElts) {
489 for (
unsigned j = 0; j < NumElts; j += Half) {
490 unsigned Idx = WhichResult;
491 for (
unsigned k = 0; k < Half; ++k) {
492 int MIdx = M[i + j + k];
493 if (MIdx >= 0 && (
unsigned)MIdx != Idx)
500 if (M.size() == NumElts * 2)
524 if ((M.size() != NumElts && M.size() != NumElts * 2) || NumElts % 2 != 0)
527 for (
unsigned i = 0; i < M.size(); i += NumElts) {
529 unsigned Idx = WhichResult * NumElts / 2;
530 for (
unsigned j = 0; j < NumElts; j += 2) {
531 if ((M[i + j] >= 0 && (
unsigned)M[i + j] != Idx) ||
532 (M[i + j + 1] >= 0 && (
unsigned)M[i + j + 1] != Idx + NumElts))
538 if (M.size() == NumElts * 2)
552 unsigned &WhichResult) {
558 if ((M.size() != NumElts && M.size() != NumElts * 2) || NumElts % 2 != 0)
561 for (
unsigned i = 0; i < M.size(); i += NumElts) {
563 unsigned Idx = WhichResult * NumElts / 2;
564 for (
unsigned j = 0; j < NumElts; j += 2) {
565 if ((M[i + j] >= 0 && (
unsigned)M[i + j] != Idx) ||
566 (M[i + j + 1] >= 0 && (
unsigned)M[i + j + 1] != Idx))
572 if (M.size() == NumElts * 2)
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 GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
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 getVectorInstrCost(unsigned Opcode, Type *Ty, TTI::TargetCostKind CostKind, unsigned Index, const Value *Op0, const Value *Op1, TTI::VectorInstrContext VIC=TTI::VectorInstrContext::None) 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 shouldConsiderVectorizationRegPressure() const override
bool preferTailFoldingOverEpilogue(TailFoldingInfo *TFI) 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
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 *CtxI=nullptr, const TargetLibraryInfo *TLibInfo=nullptr, ArrayRef< const Value * > Scalars={}) 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 getPartialReductionCost(unsigned Opcode, Type *InputTypeA, Type *InputTypeB, Type *AccumType, ElementCount VF, TTI::PartialReductionExtendKind OpAExtend, TTI::PartialReductionExtendKind OpBExtend, std::optional< unsigned > BinOp, TTI::TargetCostKind CostKind, std::optional< FastMathFlags > FMF) 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
unsigned getMaxInterleaveFactor(ElementCount VF, bool HasUnorderedReductions) 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)
TailFoldingStyle getPreferredTailFoldingStyle() const override
InstructionCost getIntImmCostInst(unsigned Opcode, unsigned Idx, const APInt &Imm, Type *Ty, TTI::TargetCostKind CostKind, Instruction *Inst=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 forceScalarizeMaskedGather(VectorType *VTy, Align Alignment) const override
unsigned getNumberOfRegisters(unsigned ClassID) const override
InstructionCost getMemIntrinsicInstrCost(const MemIntrinsicCostAttributes &MICA, TTI::TargetCostKind CostKind) const override
bool preferPredicatedReductionSelect() const override
bool isLegalMaskedGather(Type *Ty, Align Alignment) const override
InstructionCost getAddressComputationCost(Type *Ty, ScalarEvolution *SE, const SCEV *Ptr, TTI::TargetCostKind CostKind) const override
InstructionCost getShuffleCost(TTI::ShuffleKind Kind, VectorType *DstTy, VectorType *SrcTy, TTI::TargetCostKind CostKind, ArrayRef< int > Mask, int Index, VectorType *SubTp, ArrayRef< const Value * > Args={}, const Instruction *CtxI=nullptr, TTI::VectorInstrContext VIC=TTI::VectorInstrContext::None) 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.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
A cache of @llvm.assume calls within a function.
InstructionCost getVectorInstrCost(unsigned Opcode, Type *Val, TTI::TargetCostKind CostKind, unsigned Index, const Value *Op0, const Value *Op1, TTI::VectorInstrContext VIC=TTI::VectorInstrContext::None) 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.
The core instruction combiner logic.
static InstructionCost getInvalid(CostType Val=0)
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...
StackOffset holds a fixed and a scalable offset in bytes.
Provides information about what library functions are available for the current target.
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.
friend class Instruction
Iterator for Instructions in a `BasicBlock.
This is an optimization pass for GlobalISel generic memory operations.
unsigned SelectPairHalf(unsigned Elements, ArrayRef< int > Mask, unsigned Index)
bool isVTRN_v_undef_Mask(ArrayRef< int > M, EVT VT, unsigned &WhichResult)
isVTRN_v_undef_Mask - Special case of isVTRNMask for canonical form of "vector_shuffle v,...
bool isVZIPMask(ArrayRef< int > M, EVT VT, unsigned &WhichResult)
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Value
bool isVUZPMask(ArrayRef< int > M, EVT VT, unsigned &WhichResult)
bool isVTRNMask(ArrayRef< int > M, EVT VT, unsigned &WhichResult)
bool isVUZP_v_undef_Mask(ArrayRef< int > M, EVT VT, unsigned &WhichResult)
isVUZP_v_undef_Mask - Special case of isVUZPMask for canonical form of "vector_shuffle v,...
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...
bool isVZIP_v_undef_Mask(ArrayRef< int > M, EVT VT, unsigned &WhichResult)
isVZIP_v_undef_Mask - Special case of isVZIPMask for canonical form of "vector_shuffle v,...
This struct is a compact representation of a valid (non-zero power of two) alignment.
uint64_t getScalarSizeInBits() const
unsigned getVectorNumElements() const
Given a vector type, return the number of elements it contains.
bool is64BitVector() const
Return true if this is a 64-bit vector type.
Attributes of a target dependent hardware loop.