LLVM 20.0.0git
AArch64TargetTransformInfo.h
Go to the documentation of this file.
1//===- AArch64TargetTransformInfo.h - AArch64 specific TTI ------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8/// \file
9/// This file a TargetTransformInfo::Concept conforming object specific to the
10/// AArch64 target machine. It uses the target's detailed information to
11/// provide more precise answers to certain TTI queries, while letting the
12/// target independent and default TTI implementations handle the rest.
13///
14//===----------------------------------------------------------------------===//
15
16#ifndef LLVM_LIB_TARGET_AARCH64_AARCH64TARGETTRANSFORMINFO_H
17#define LLVM_LIB_TARGET_AARCH64_AARCH64TARGETTRANSFORMINFO_H
18
19#include "AArch64.h"
20#include "AArch64Subtarget.h"
24#include "llvm/IR/Function.h"
25#include "llvm/IR/Intrinsics.h"
27#include <cstdint>
28#include <optional>
29
30namespace llvm {
31
32class APInt;
33class Instruction;
34class IntrinsicInst;
35class Loop;
36class SCEV;
37class ScalarEvolution;
38class Type;
39class Value;
40class VectorType;
41
42class AArch64TTIImpl : public BasicTTIImplBase<AArch64TTIImpl> {
45
46 friend BaseT;
47
48 const AArch64Subtarget *ST;
49 const AArch64TargetLowering *TLI;
50
51 const AArch64Subtarget *getST() const { return ST; }
52 const AArch64TargetLowering *getTLI() const { return TLI; }
53
54 enum MemIntrinsicType {
55 VECTOR_LDST_TWO_ELEMENTS,
56 VECTOR_LDST_THREE_ELEMENTS,
57 VECTOR_LDST_FOUR_ELEMENTS
58 };
59
60 bool isWideningInstruction(Type *DstTy, unsigned Opcode,
62 Type *SrcOverrideTy = nullptr);
63
64 // A helper function called by 'getVectorInstrCost'.
65 //
66 // 'Val' and 'Index' are forwarded from 'getVectorInstrCost'; 'HasRealUse'
67 // indicates whether the vector instruction is available in the input IR or
68 // just imaginary in vectorizer passes.
69 /// \param ScalarUserAndIdx encodes the information about extracts from a
70 /// vector with 'Scalar' being the value being extracted,'User' being the user
71 /// of the extract(nullptr if user is not known before vectorization) and
72 /// 'Idx' being the extract lane.
73 InstructionCost getVectorInstrCostHelper(
74 unsigned Opcode, Type *Val, unsigned Index, bool HasRealUse,
75 const Instruction *I = nullptr, Value *Scalar = nullptr,
76 ArrayRef<std::tuple<Value *, User *, int>> ScalarUserAndIdx = {});
77
78public:
79 explicit AArch64TTIImpl(const AArch64TargetMachine *TM, const Function &F)
80 : BaseT(TM, F.getDataLayout()), ST(TM->getSubtargetImpl(F)),
81 TLI(ST->getTargetLowering()) {}
82
83 bool areInlineCompatible(const Function *Caller,
84 const Function *Callee) const;
85
86 bool areTypesABICompatible(const Function *Caller, const Function *Callee,
87 const ArrayRef<Type *> &Types) const;
88
89 unsigned getInlineCallPenalty(const Function *F, const CallBase &Call,
90 unsigned DefaultCallPenalty) const;
91
92 uint64_t getFeatureMask(const Function &F) const;
93
94 bool isMultiversionedFunction(const Function &F) const;
95
96 /// \name Scalar TTI Implementations
97 /// @{
98
100 InstructionCost getIntImmCost(int64_t Val);
101 InstructionCost getIntImmCost(const APInt &Imm, Type *Ty,
103 InstructionCost getIntImmCostInst(unsigned Opcode, unsigned Idx,
104 const APInt &Imm, Type *Ty,
106 Instruction *Inst = nullptr);
108 const APInt &Imm, Type *Ty,
111
112 /// @}
113
114 /// \name Vector TTI Implementations
115 /// @{
116
118
119 bool enableMaskedInterleavedAccessVectorization() { return ST->hasSVE(); }
120
121 unsigned getNumberOfRegisters(unsigned ClassID) const {
122 bool Vector = (ClassID == 1);
123 if (Vector) {
124 if (ST->hasNEON())
125 return 32;
126 return 0;
127 }
128 return 31;
129 }
130
133
134 std::optional<Instruction *> instCombineIntrinsic(InstCombiner &IC,
135 IntrinsicInst &II) const;
136
137 std::optional<Value *> simplifyDemandedVectorEltsIntrinsic(
138 InstCombiner &IC, IntrinsicInst &II, APInt DemandedElts, APInt &UndefElts,
139 APInt &UndefElts2, APInt &UndefElts3,
140 std::function<void(Instruction *, unsigned, APInt, APInt &)>
141 SimplifyAndSetOp) const;
142
144
146 return ST->getMinVectorRegisterBitWidth();
147 }
148
149 std::optional<unsigned> getVScaleForTuning() const {
150 return ST->getVScaleForTuning();
151 }
152
153 bool isVScaleKnownToBeAPowerOfTwo() const { return true; }
154
156
157 /// Try to return an estimate cost factor that can be used as a multiplier
158 /// when scalarizing an operation for a vector with ElementCount \p VF.
159 /// For scalable vectors this currently takes the most pessimistic view based
160 /// upon the maximum possible value for vscale.
161 unsigned getMaxNumElements(ElementCount VF) const {
162 if (!VF.isScalable())
163 return VF.getFixedValue();
164
165 return VF.getKnownMinValue() * ST->getVScaleForTuning();
166 }
167
169
170 bool prefersVectorizedAddressing() const;
171
172 InstructionCost getMaskedMemoryOpCost(unsigned Opcode, Type *Src,
173 Align Alignment, unsigned AddressSpace,
175
176 InstructionCost getGatherScatterOpCost(unsigned Opcode, Type *DataTy,
177 const Value *Ptr, bool VariableMask,
178 Align Alignment,
180 const Instruction *I = nullptr);
181
182 bool isExtPartOfAvgExpr(const Instruction *ExtUser, Type *Dst, Type *Src);
183
184 InstructionCost getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src,
187 const Instruction *I = nullptr);
188
189 InstructionCost getExtractWithExtendCost(unsigned Opcode, Type *Dst,
190 VectorType *VecTy, unsigned Index);
191
193 const Instruction *I = nullptr);
194
195 InstructionCost getVectorInstrCost(unsigned Opcode, Type *Val,
197 unsigned Index, Value *Op0, Value *Op1);
198
199 /// \param ScalarUserAndIdx encodes the information about extracts from a
200 /// vector with 'Scalar' being the value being extracted,'User' being the user
201 /// of the extract(nullptr if user is not known before vectorization) and
202 /// 'Idx' being the extract lane.
204 unsigned Opcode, Type *Val, TTI::TargetCostKind CostKind, unsigned Index,
205 Value *Scalar,
206 ArrayRef<std::tuple<Value *, User *, int>> ScalarUserAndIdx);
207
210 unsigned Index);
211
213 FastMathFlags FMF,
215
217 VectorType *ValTy,
219
221
223 unsigned Opcode, Type *Ty, TTI::TargetCostKind CostKind,
225 TTI::OperandValueInfo Op2Info = {TTI::OK_AnyValue, TTI::OP_None},
226 ArrayRef<const Value *> Args = {}, const Instruction *CxtI = nullptr);
227
228 InstructionCost getAddressComputationCost(Type *Ty, ScalarEvolution *SE,
229 const SCEV *Ptr);
230
231 InstructionCost getCmpSelInstrCost(
232 unsigned Opcode, Type *ValTy, Type *CondTy, CmpInst::Predicate VecPred,
234 TTI::OperandValueInfo Op1Info = {TTI::OK_AnyValue, TTI::OP_None},
235 TTI::OperandValueInfo Op2Info = {TTI::OK_AnyValue, TTI::OP_None},
236 const Instruction *I = nullptr);
237
238 TTI::MemCmpExpansionOptions enableMemCmpExpansion(bool OptSize,
239 bool IsZeroCmp) const;
240 bool useNeonVector(const Type *Ty) const;
241
242 InstructionCost
243 getMemoryOpCost(unsigned Opcode, Type *Src, MaybeAlign Alignment,
245 TTI::OperandValueInfo OpInfo = {TTI::OK_AnyValue, TTI::OP_None},
246 const Instruction *I = nullptr);
247
248 InstructionCost getCostOfKeepingLiveOverCall(ArrayRef<Type *> Tys);
249
250 void getUnrollingPreferences(Loop *L, ScalarEvolution &SE,
251 TTI::UnrollingPreferences &UP,
252 OptimizationRemarkEmitter *ORE);
253
254 void getPeelingPreferences(Loop *L, ScalarEvolution &SE,
255 TTI::PeelingPreferences &PP);
256
257 Value *getOrCreateResultFromMemIntrinsic(IntrinsicInst *Inst,
258 Type *ExpectedType);
259
260 bool getTgtMemIntrinsic(IntrinsicInst *Inst, MemIntrinsicInfo &Info);
261
263 if (Ty->isPointerTy())
264 return true;
265
266 if (Ty->isBFloatTy() && ST->hasBF16())
267 return true;
268
269 if (Ty->isHalfTy() || Ty->isFloatTy() || Ty->isDoubleTy())
270 return true;
271
272 if (Ty->isIntegerTy(1) || Ty->isIntegerTy(8) || Ty->isIntegerTy(16) ||
273 Ty->isIntegerTy(32) || Ty->isIntegerTy(64))
274 return true;
275
276 return false;
277 }
278
279 bool isLegalMaskedLoadStore(Type *DataType, Align Alignment) {
280 if (!ST->hasSVE())
281 return false;
282
283 // For fixed vectors, avoid scalarization if using SVE for them.
284 if (isa<FixedVectorType>(DataType) && !ST->useSVEForFixedLengthVectors() &&
285 DataType->getPrimitiveSizeInBits() != 128)
286 return false; // Fall back to scalarization of masked operations.
287
289 }
290
291 bool isLegalMaskedLoad(Type *DataType, Align Alignment) {
292 return isLegalMaskedLoadStore(DataType, Alignment);
293 }
294
295 bool isLegalMaskedStore(Type *DataType, Align Alignment) {
296 return isLegalMaskedLoadStore(DataType, Alignment);
297 }
298
299 bool isLegalMaskedGatherScatter(Type *DataType) const {
300 if (!ST->isSVEAvailable())
301 return false;
302
303 // For fixed vectors, scalarize if not using SVE for them.
304 auto *DataTypeFVTy = dyn_cast<FixedVectorType>(DataType);
305 if (DataTypeFVTy && (!ST->useSVEForFixedLengthVectors() ||
306 DataTypeFVTy->getNumElements() < 2))
307 return false;
308
310 }
311
312 bool isLegalMaskedGather(Type *DataType, Align Alignment) const {
313 return isLegalMaskedGatherScatter(DataType);
314 }
315
316 bool isLegalMaskedScatter(Type *DataType, Align Alignment) const {
317 return isLegalMaskedGatherScatter(DataType);
318 }
319
320 bool isLegalBroadcastLoad(Type *ElementTy, ElementCount NumElements) const {
321 // Return true if we can generate a `ld1r` splat load instruction.
322 if (!ST->hasNEON() || NumElements.isScalable())
323 return false;
324 switch (unsigned ElementBits = ElementTy->getScalarSizeInBits()) {
325 case 8:
326 case 16:
327 case 32:
328 case 64: {
329 // We accept bit-widths >= 64bits and elements {8,16,32,64} bits.
330 unsigned VectorBits = NumElements.getFixedValue() * ElementBits;
331 return VectorBits >= 64;
332 }
333 }
334 return false;
335 }
336
337 bool isLegalNTStoreLoad(Type *DataType, Align Alignment) {
338 // NOTE: The logic below is mostly geared towards LV, which calls it with
339 // vectors with 2 elements. We might want to improve that, if other
340 // users show up.
341 // Nontemporal vector loads/stores can be directly lowered to LDNP/STNP, if
342 // the vector can be halved so that each half fits into a register. That's
343 // the case if the element type fits into a register and the number of
344 // elements is a power of 2 > 1.
345 if (auto *DataTypeTy = dyn_cast<FixedVectorType>(DataType)) {
346 unsigned NumElements = DataTypeTy->getNumElements();
347 unsigned EltSize = DataTypeTy->getElementType()->getScalarSizeInBits();
348 return NumElements > 1 && isPowerOf2_64(NumElements) && EltSize >= 8 &&
349 EltSize <= 128 && isPowerOf2_64(EltSize);
350 }
351 return BaseT::isLegalNTStore(DataType, Alignment);
352 }
353
354 bool isLegalNTStore(Type *DataType, Align Alignment) {
355 return isLegalNTStoreLoad(DataType, Alignment);
356 }
357
358 bool isLegalNTLoad(Type *DataType, Align Alignment) {
359 // Only supports little-endian targets.
360 if (ST->isLittleEndian())
361 return isLegalNTStoreLoad(DataType, Alignment);
362 return BaseT::isLegalNTLoad(DataType, Alignment);
363 }
364
366 getPartialReductionCost(unsigned Opcode, Type *InputTypeA, Type *InputTypeB,
367 Type *AccumType, ElementCount VF,
370 std::optional<unsigned> BinOp) const;
371
372 bool enableOrderedReductions() const { return true; }
373
375 unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef<unsigned> Indices,
376 Align Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind,
377 bool UseMaskForCond = false, bool UseMaskForGaps = false);
378
379 bool
381 bool &AllowPromotionWithoutCommonHeader);
382
383 bool shouldExpandReduction(const IntrinsicInst *II) const { return false; }
384
385 unsigned getGISelRematGlobalCost() const {
386 return 2;
387 }
388
390 return ST->hasSVE() ? 5 : 0;
391 }
392
393 TailFoldingStyle getPreferredTailFoldingStyle(bool IVUpdateMayOverflow) const {
394 if (ST->hasSVE())
395 return IVUpdateMayOverflow
398
400 }
401
403
404 unsigned getEpilogueVectorizationMinVF() const;
405
407
409 return ST->isSVEorStreamingSVEAvailable();
410 }
411
412 bool enableScalableVectorization() const;
413
415 ElementCount VF) const;
416
417 bool preferPredicatedReductionSelect(unsigned Opcode, Type *Ty,
418 TTI::ReductionFlags Flags) const {
419 return ST->hasSVE();
420 }
421
423 std::optional<FastMathFlags> FMF,
425
427 ArrayRef<int> Mask,
429 VectorType *SubTp,
430 ArrayRef<const Value *> Args = {},
431 const Instruction *CxtI = nullptr);
432
433 InstructionCost getScalarizationOverhead(VectorType *Ty,
434 const APInt &DemandedElts,
435 bool Insert, bool Extract,
437 ArrayRef<Value *> VL = {});
438
439 /// Return the cost of the scaling factor used in the addressing
440 /// mode represented by AM for this target, for a load/store
441 /// of the specified type.
442 /// If the AM is supported, the return value must be >= 0.
443 /// If the AM is not supported, it returns a negative value.
444 InstructionCost getScalingFactorCost(Type *Ty, GlobalValue *BaseGV,
445 StackOffset BaseOffset, bool HasBaseReg,
446 int64_t Scale, unsigned AddrSpace) const;
447
448 bool enableSelectOptimize() { return ST->enableSelectOptimize(); }
449
451
452 unsigned getStoreMinimumVF(unsigned VF, Type *ScalarMemTy,
453 Type *ScalarValTy) const {
454 // We can vectorize store v4i8.
455 if (ScalarMemTy->isIntegerTy(8) && isPowerOf2_32(VF) && VF >= 4)
456 return 4;
457
458 return BaseT::getStoreMinimumVF(VF, ScalarMemTy, ScalarValTy);
459 }
460
461 std::optional<unsigned> getMinPageSize() const { return 4096; }
462
465
467 SmallVectorImpl<Use *> &Ops) const;
468 /// @}
469};
470
471} // end namespace llvm
472
473#endif // LLVM_LIB_TARGET_AARCH64_AARCH64TARGETTRANSFORMINFO_H
This file provides a helper that implements much of the TTI interface in terms of the target-independ...
RelocType Type
Definition: COFFYAML.cpp:410
Analysis containing CSE Info
Definition: CSEInfo.cpp:27
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")))
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
uint32_t Index
This file defines an InstructionCost class that is used when calculating the cost of an instruction,...
#define F(x, y, z)
Definition: MD5.cpp:55
#define I(x, y, z)
Definition: MD5.cpp:58
uint64_t IntrinsicInst * II
This pass exposes codegen information to IR-level passes.
InstructionCost getSpliceCost(VectorType *Tp, int Index)
InstructionCost getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src, TTI::CastContextHint CCH, TTI::TargetCostKind CostKind, const Instruction *I=nullptr)
InstructionCost getIntImmCostInst(unsigned Opcode, unsigned Idx, const APInt &Imm, Type *Ty, TTI::TargetCostKind CostKind, Instruction *Inst=nullptr)
InstructionCost getScalingFactorCost(Type *Ty, GlobalValue *BaseGV, StackOffset BaseOffset, bool HasBaseReg, int64_t Scale, unsigned AddrSpace) const
Return the cost of the scaling factor used in the addressing mode represented by AM for this target,...
InstructionCost getMaskedMemoryOpCost(unsigned Opcode, Type *Src, Align Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind)
unsigned getMinTripCountTailFoldingThreshold() const
bool isLegalNTStoreLoad(Type *DataType, Align Alignment)
unsigned getGISelRematGlobalCost() const
bool shouldTreatInstructionLikeSelect(const Instruction *I)
bool preferPredicatedReductionSelect(unsigned Opcode, Type *Ty, TTI::ReductionFlags Flags) const
std::optional< unsigned > getVScaleForTuning() const
InstructionCost getAddressComputationCost(Type *Ty, ScalarEvolution *SE, const SCEV *Ptr)
InstructionCost getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA, TTI::TargetCostKind CostKind)
InstructionCost getArithmeticReductionCost(unsigned Opcode, VectorType *Ty, std::optional< FastMathFlags > FMF, TTI::TargetCostKind CostKind)
InstructionCost getPartialReductionCost(unsigned Opcode, Type *InputTypeA, Type *InputTypeB, Type *AccumType, ElementCount VF, TTI::PartialReductionExtendKind OpAExtend, TTI::PartialReductionExtendKind OpBExtend, std::optional< unsigned > BinOp) const
InstructionCost getExtractWithExtendCost(unsigned Opcode, Type *Dst, VectorType *VecTy, unsigned Index)
bool isProfitableToSinkOperands(Instruction *I, SmallVectorImpl< Use * > &Ops) const
Check if sinking I's operands to I's basic block is profitable, because the operands can be folded in...
bool isLegalMaskedStore(Type *DataType, Align Alignment)
unsigned getInlineCallPenalty(const Function *F, const CallBase &Call, unsigned DefaultCallPenalty) const
bool isLegalToVectorizeReduction(const RecurrenceDescriptor &RdxDesc, ElementCount VF) const
unsigned getEpilogueVectorizationMinVF() const
Value * getOrCreateResultFromMemIntrinsic(IntrinsicInst *Inst, Type *ExpectedType)
bool isLegalBroadcastLoad(Type *ElementTy, ElementCount NumElements) const
bool shouldConsiderAddressTypePromotion(const Instruction &I, bool &AllowPromotionWithoutCommonHeader)
See if I should be considered for address type promotion.
InstructionCost getArithmeticReductionCostSVE(unsigned Opcode, VectorType *ValTy, TTI::TargetCostKind CostKind)
std::optional< unsigned > getMinPageSize() const
InstructionCost getInterleavedMemoryOpCost(unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef< unsigned > Indices, Align Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind, bool UseMaskForCond=false, bool UseMaskForGaps=false)
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)
bool shouldExpandReduction(const IntrinsicInst *II) const
uint64_t getFeatureMask(const Function &F) const
unsigned getStoreMinimumVF(unsigned VF, Type *ScalarMemTy, Type *ScalarValTy) const
unsigned getMinVectorRegisterBitWidth() const
std::optional< Instruction * > instCombineIntrinsic(InstCombiner &IC, IntrinsicInst &II) const
bool shouldMaximizeVectorBandwidth(TargetTransformInfo::RegisterKind K) const
bool isLSRCostLess(const TargetTransformInfo::LSRCost &C1, const TargetTransformInfo::LSRCost &C2)
InstructionCost getMemoryOpCost(unsigned Opcode, Type *Src, MaybeAlign Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind, TTI::OperandValueInfo OpInfo={TTI::OK_AnyValue, TTI::OP_None}, const Instruction *I=nullptr)
bool isElementTypeLegalForScalableVector(Type *Ty) const
InstructionCost getCostOfKeepingLiveOverCall(ArrayRef< Type * > Tys)
bool isLegalMaskedLoadStore(Type *DataType, Align Alignment)
bool areInlineCompatible(const Function *Caller, const Function *Callee) const
bool useNeonVector(const Type *Ty) const
InstructionCost getVectorInstrCost(unsigned Opcode, Type *Val, TTI::TargetCostKind CostKind, unsigned Index, Value *Op0, Value *Op1)
TTI::PopcntSupportKind getPopcntSupport(unsigned TyWidth)
bool areTypesABICompatible(const Function *Caller, const Function *Callee, const ArrayRef< Type * > &Types) const
TypeSize getRegisterBitWidth(TargetTransformInfo::RegisterKind K) const
InstructionCost getGatherScatterOpCost(unsigned Opcode, Type *DataTy, const Value *Ptr, bool VariableMask, Align Alignment, TTI::TargetCostKind CostKind, const Instruction *I=nullptr)
bool isLegalMaskedLoad(Type *DataType, Align Alignment)
bool isMultiversionedFunction(const Function &F) const
AArch64TTIImpl(const AArch64TargetMachine *TM, const Function &F)
unsigned getMaxNumElements(ElementCount VF) const
Try to return an estimate cost factor that can be used as a multiplier when scalarizing an operation ...
InstructionCost getScalarizationOverhead(VectorType *Ty, const APInt &DemandedElts, bool Insert, bool Extract, TTI::TargetCostKind CostKind, ArrayRef< Value * > VL={})
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)
bool isLegalNTLoad(Type *DataType, Align Alignment)
bool preferPredicateOverEpilogue(TailFoldingInfo *TFI)
TailFoldingStyle getPreferredTailFoldingStyle(bool IVUpdateMayOverflow) const
bool isLegalMaskedGatherScatter(Type *DataType) const
unsigned getMaxInterleaveFactor(ElementCount VF)
bool isLegalMaskedScatter(Type *DataType, Align Alignment) const
InstructionCost getShuffleCost(TTI::ShuffleKind Kind, VectorType *Tp, ArrayRef< int > Mask, TTI::TargetCostKind CostKind, int Index, VectorType *SubTp, ArrayRef< const Value * > Args={}, const Instruction *CxtI=nullptr)
void getPeelingPreferences(Loop *L, ScalarEvolution &SE, TTI::PeelingPreferences &PP)
InstructionCost getCFInstrCost(unsigned Opcode, TTI::TargetCostKind CostKind, const Instruction *I=nullptr)
InstructionCost getIntImmCost(int64_t Val)
Calculate the cost of materializing a 64-bit value.
unsigned getNumberOfRegisters(unsigned ClassID) const
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
void getUnrollingPreferences(Loop *L, ScalarEvolution &SE, TTI::UnrollingPreferences &UP, OptimizationRemarkEmitter *ORE)
bool isLegalMaskedGather(Type *DataType, Align Alignment) const
bool getTgtMemIntrinsic(IntrinsicInst *Inst, MemIntrinsicInfo &Info)
TTI::MemCmpExpansionOptions enableMemCmpExpansion(bool OptSize, bool IsZeroCmp) const
InstructionCost getMinMaxReductionCost(Intrinsic::ID IID, VectorType *Ty, FastMathFlags FMF, TTI::TargetCostKind CostKind)
bool isLegalNTStore(Type *DataType, Align Alignment)
bool isExtPartOfAvgExpr(const Instruction *ExtUser, Type *Dst, Type *Src)
InstructionCost getIntImmCostIntrin(Intrinsic::ID IID, unsigned Idx, const APInt &Imm, Type *Ty, TTI::TargetCostKind CostKind)
Class for arbitrary precision integers.
Definition: APInt.h:78
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
Base class which can be used to help build a TTI implementation.
Definition: BasicTTIImpl.h:80
unsigned getStoreMinimumVF(unsigned VF, Type *ScalarMemTy, Type *ScalarValTy) const
Definition: BasicTTIImpl.h:396
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
Definition: InstrTypes.h:1112
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
Definition: InstrTypes.h:673
Convenience struct for specifying and reasoning about fast-math flags.
Definition: FMF.h:20
The core instruction combiner logic.
Definition: InstCombiner.h:48
A wrapper class for inspecting calls to intrinsic functions.
Definition: IntrinsicInst.h:48
The RecurrenceDescriptor is used to identify recurrences variables in a loop.
Definition: IVDescriptors.h:77
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: SmallVector.h:573
const DataLayout & getDataLayout() const
bool isLegalNTStore(Type *DataType, Align Alignment) const
InstructionCost getIntImmCost(const APInt &Imm, Type *Ty, TTI::TargetCostKind CostKind) const
bool isLegalNTLoad(Type *DataType, Align Alignment) const
This pass provides access to the codegen interfaces that are needed for IR-level transformations.
TargetCostKind
The kind of cost model.
PopcntSupportKind
Flags indicating the kind of support for population count.
ShuffleKind
The various kinds of shuffle patterns for vector queries.
CastContextHint
Represents a hint about the context in which a cast is used.
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
bool isPointerTy() const
True if this is an instance of PointerType.
Definition: Type.h:264
bool isFloatTy() const
Return true if this is 'float', a 32-bit IEEE fp type.
Definition: Type.h:153
bool isBFloatTy() const
Return true if this is 'bfloat', a 16-bit bfloat type.
Definition: Type.h:145
unsigned getScalarSizeInBits() const LLVM_READONLY
If this is a vector type, return the getPrimitiveSizeInBits value for the element type.
bool isHalfTy() const
Return true if this is 'half', a 16-bit IEEE fp type.
Definition: Type.h:142
bool isDoubleTy() const
Return true if this is 'double', a 64-bit IEEE fp type.
Definition: Type.h:156
bool isIntegerTy() const
True if this is an instance of IntegerType.
Definition: Type.h:237
TypeSize getPrimitiveSizeInBits() const LLVM_READONLY
Return the basic size of this type if it is a primitive type.
Type * getScalarType() const
If this is a vector type, return the element type, otherwise return 'this'.
Definition: Type.h:355
LLVM Value Representation.
Definition: Value.h:74
Base class of all SIMD vector types.
Definition: DerivedTypes.h:427
constexpr ScalarTy getFixedValue() const
Definition: TypeSize.h:202
constexpr bool isScalable() const
Returns whether the quantity is scaled by a runtime quantity (vscale).
Definition: TypeSize.h:171
constexpr ScalarTy getKnownMinValue() const
Returns the minimum value this quantity can represent.
Definition: TypeSize.h:168
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
constexpr bool isPowerOf2_64(uint64_t Value)
Return true if the argument is a power of two > 0 (64 bit edition.)
Definition: MathExtras.h:298
constexpr bool isPowerOf2_32(uint32_t Value)
Return true if the argument is a power of two > 0.
Definition: MathExtras.h:293
@ DataAndControlFlowWithoutRuntimeCheck
Use predicate to control both data and control flow, but modify the trip count so that a runtime over...
@ DataAndControlFlow
Use predicate to control both data and control flow.
@ DataWithoutLaneMask
Same as Data, but avoids using the get.active.lane.mask intrinsic to calculate the mask and instead i...
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition: Alignment.h:39
Flags describing the kind of vector reduction.