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"
26#include <cstdint>
27#include <optional>
28
29namespace llvm {
30
31class APInt;
32class Instruction;
33class IntrinsicInst;
34class Loop;
35class SCEV;
36class ScalarEvolution;
37class Type;
38class Value;
39class VectorType;
40
41class AArch64TTIImpl : public BasicTTIImplBase<AArch64TTIImpl> {
44
45 friend BaseT;
46
47 const AArch64Subtarget *ST;
48 const AArch64TargetLowering *TLI;
49
50 const AArch64Subtarget *getST() const { return ST; }
51 const AArch64TargetLowering *getTLI() const { return TLI; }
52
53 enum MemIntrinsicType {
54 VECTOR_LDST_TWO_ELEMENTS,
55 VECTOR_LDST_THREE_ELEMENTS,
56 VECTOR_LDST_FOUR_ELEMENTS
57 };
58
59 bool isWideningInstruction(Type *DstTy, unsigned Opcode,
61 Type *SrcOverrideTy = nullptr);
62
63 // A helper function called by 'getVectorInstrCost'.
64 //
65 // 'Val' and 'Index' are forwarded from 'getVectorInstrCost'; 'HasRealUse'
66 // indicates whether the vector instruction is available in the input IR or
67 // just imaginary in vectorizer passes.
68 /// \param ScalarUserAndIdx encodes the information about extracts from a
69 /// vector with 'Scalar' being the value being extracted,'User' being the user
70 /// of the extract(nullptr if user is not known before vectorization) and
71 /// 'Idx' being the extract lane.
72 InstructionCost getVectorInstrCostHelper(
73 unsigned Opcode, Type *Val, unsigned Index, bool HasRealUse,
74 const Instruction *I = nullptr, Value *Scalar = nullptr,
75 ArrayRef<std::tuple<Value *, User *, int>> ScalarUserAndIdx = {});
76
77public:
78 explicit AArch64TTIImpl(const AArch64TargetMachine *TM, const Function &F)
79 : BaseT(TM, F.getDataLayout()), ST(TM->getSubtargetImpl(F)),
80 TLI(ST->getTargetLowering()) {}
81
82 bool areInlineCompatible(const Function *Caller,
83 const Function *Callee) const;
84
85 bool areTypesABICompatible(const Function *Caller, const Function *Callee,
86 const ArrayRef<Type *> &Types) const;
87
88 unsigned getInlineCallPenalty(const Function *F, const CallBase &Call,
89 unsigned DefaultCallPenalty) const;
90
91 /// \name Scalar TTI Implementations
92 /// @{
93
95 InstructionCost getIntImmCost(int64_t Val);
98 InstructionCost getIntImmCostInst(unsigned Opcode, unsigned Idx,
99 const APInt &Imm, Type *Ty,
101 Instruction *Inst = nullptr);
103 const APInt &Imm, Type *Ty,
106
107 /// @}
108
109 /// \name Vector TTI Implementations
110 /// @{
111
113
114 bool enableMaskedInterleavedAccessVectorization() { return ST->hasSVE(); }
115
116 unsigned getNumberOfRegisters(unsigned ClassID) const {
117 bool Vector = (ClassID == 1);
118 if (Vector) {
119 if (ST->hasNEON())
120 return 32;
121 return 0;
122 }
123 return 31;
124 }
125
128
129 std::optional<Instruction *> instCombineIntrinsic(InstCombiner &IC,
130 IntrinsicInst &II) const;
131
132 std::optional<Value *> simplifyDemandedVectorEltsIntrinsic(
133 InstCombiner &IC, IntrinsicInst &II, APInt DemandedElts, APInt &UndefElts,
134 APInt &UndefElts2, APInt &UndefElts3,
135 std::function<void(Instruction *, unsigned, APInt, APInt &)>
136 SimplifyAndSetOp) const;
137
139
141 return ST->getMinVectorRegisterBitWidth();
142 }
143
144 std::optional<unsigned> getVScaleForTuning() const {
145 return ST->getVScaleForTuning();
146 }
147
148 bool isVScaleKnownToBeAPowerOfTwo() const { return true; }
149
151
152 /// Try to return an estimate cost factor that can be used as a multiplier
153 /// when scalarizing an operation for a vector with ElementCount \p VF.
154 /// For scalable vectors this currently takes the most pessimistic view based
155 /// upon the maximum possible value for vscale.
156 unsigned getMaxNumElements(ElementCount VF) const {
157 if (!VF.isScalable())
158 return VF.getFixedValue();
159
160 return VF.getKnownMinValue() * ST->getVScaleForTuning();
161 }
162
164
165 bool prefersVectorizedAddressing() const;
166
167 InstructionCost getMaskedMemoryOpCost(unsigned Opcode, Type *Src,
168 Align Alignment, unsigned AddressSpace,
170
171 InstructionCost getGatherScatterOpCost(unsigned Opcode, Type *DataTy,
172 const Value *Ptr, bool VariableMask,
173 Align Alignment,
175 const Instruction *I = nullptr);
176
177 bool isExtPartOfAvgExpr(const Instruction *ExtUser, Type *Dst, Type *Src);
178
179 InstructionCost getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src,
182 const Instruction *I = nullptr);
183
184 InstructionCost getExtractWithExtendCost(unsigned Opcode, Type *Dst,
185 VectorType *VecTy, unsigned Index);
186
188 const Instruction *I = nullptr);
189
190 InstructionCost getVectorInstrCost(unsigned Opcode, Type *Val,
192 unsigned Index, Value *Op0, Value *Op1);
193
194 /// \param ScalarUserAndIdx encodes the information about extracts from a
195 /// vector with 'Scalar' being the value being extracted,'User' being the user
196 /// of the extract(nullptr if user is not known before vectorization) and
197 /// 'Idx' being the extract lane.
199 unsigned Opcode, Type *Val, TTI::TargetCostKind CostKind, unsigned Index,
200 Value *Scalar,
201 ArrayRef<std::tuple<Value *, User *, int>> ScalarUserAndIdx);
202
205 unsigned Index);
206
208 FastMathFlags FMF,
210
212 VectorType *ValTy,
214
216
218 unsigned Opcode, Type *Ty, TTI::TargetCostKind CostKind,
220 TTI::OperandValueInfo Op2Info = {TTI::OK_AnyValue, TTI::OP_None},
221 ArrayRef<const Value *> Args = {}, const Instruction *CxtI = nullptr);
222
223 InstructionCost getAddressComputationCost(Type *Ty, ScalarEvolution *SE,
224 const SCEV *Ptr);
225
226 InstructionCost getCmpSelInstrCost(
227 unsigned Opcode, Type *ValTy, Type *CondTy, CmpInst::Predicate VecPred,
229 TTI::OperandValueInfo Op1Info = {TTI::OK_AnyValue, TTI::OP_None},
230 TTI::OperandValueInfo Op2Info = {TTI::OK_AnyValue, TTI::OP_None},
231 const Instruction *I = nullptr);
232
233 TTI::MemCmpExpansionOptions enableMemCmpExpansion(bool OptSize,
234 bool IsZeroCmp) const;
235 bool useNeonVector(const Type *Ty) const;
236
237 InstructionCost
238 getMemoryOpCost(unsigned Opcode, Type *Src, MaybeAlign Alignment,
240 TTI::OperandValueInfo OpInfo = {TTI::OK_AnyValue, TTI::OP_None},
241 const Instruction *I = nullptr);
242
243 InstructionCost getCostOfKeepingLiveOverCall(ArrayRef<Type *> Tys);
244
245 void getUnrollingPreferences(Loop *L, ScalarEvolution &SE,
246 TTI::UnrollingPreferences &UP,
247 OptimizationRemarkEmitter *ORE);
248
249 void getPeelingPreferences(Loop *L, ScalarEvolution &SE,
250 TTI::PeelingPreferences &PP);
251
252 Value *getOrCreateResultFromMemIntrinsic(IntrinsicInst *Inst,
253 Type *ExpectedType);
254
255 bool getTgtMemIntrinsic(IntrinsicInst *Inst, MemIntrinsicInfo &Info);
256
258 if (Ty->isPointerTy())
259 return true;
260
261 if (Ty->isBFloatTy() && ST->hasBF16())
262 return true;
263
264 if (Ty->isHalfTy() || Ty->isFloatTy() || Ty->isDoubleTy())
265 return true;
266
267 if (Ty->isIntegerTy(1) || Ty->isIntegerTy(8) || Ty->isIntegerTy(16) ||
268 Ty->isIntegerTy(32) || Ty->isIntegerTy(64))
269 return true;
270
271 return false;
272 }
273
274 bool isLegalMaskedLoadStore(Type *DataType, Align Alignment) {
275 if (!ST->hasSVE())
276 return false;
277
278 // For fixed vectors, avoid scalarization if using SVE for them.
279 if (isa<FixedVectorType>(DataType) && !ST->useSVEForFixedLengthVectors() &&
280 DataType->getPrimitiveSizeInBits() != 128)
281 return false; // Fall back to scalarization of masked operations.
282
284 }
285
286 bool isLegalMaskedLoad(Type *DataType, Align Alignment) {
287 return isLegalMaskedLoadStore(DataType, Alignment);
288 }
289
290 bool isLegalMaskedStore(Type *DataType, Align Alignment) {
291 return isLegalMaskedLoadStore(DataType, Alignment);
292 }
293
294 bool isLegalMaskedGatherScatter(Type *DataType) const {
295 if (!ST->isSVEAvailable())
296 return false;
297
298 // For fixed vectors, scalarize if not using SVE for them.
299 auto *DataTypeFVTy = dyn_cast<FixedVectorType>(DataType);
300 if (DataTypeFVTy && (!ST->useSVEForFixedLengthVectors() ||
301 DataTypeFVTy->getNumElements() < 2))
302 return false;
303
305 }
306
307 bool isLegalMaskedGather(Type *DataType, Align Alignment) const {
308 return isLegalMaskedGatherScatter(DataType);
309 }
310
311 bool isLegalMaskedScatter(Type *DataType, Align Alignment) const {
312 return isLegalMaskedGatherScatter(DataType);
313 }
314
315 bool isLegalBroadcastLoad(Type *ElementTy, ElementCount NumElements) const {
316 // Return true if we can generate a `ld1r` splat load instruction.
317 if (!ST->hasNEON() || NumElements.isScalable())
318 return false;
319 switch (unsigned ElementBits = ElementTy->getScalarSizeInBits()) {
320 case 8:
321 case 16:
322 case 32:
323 case 64: {
324 // We accept bit-widths >= 64bits and elements {8,16,32,64} bits.
325 unsigned VectorBits = NumElements.getFixedValue() * ElementBits;
326 return VectorBits >= 64;
327 }
328 }
329 return false;
330 }
331
332 bool isLegalNTStoreLoad(Type *DataType, Align Alignment) {
333 // NOTE: The logic below is mostly geared towards LV, which calls it with
334 // vectors with 2 elements. We might want to improve that, if other
335 // users show up.
336 // Nontemporal vector loads/stores can be directly lowered to LDNP/STNP, if
337 // the vector can be halved so that each half fits into a register. That's
338 // the case if the element type fits into a register and the number of
339 // elements is a power of 2 > 1.
340 if (auto *DataTypeTy = dyn_cast<FixedVectorType>(DataType)) {
341 unsigned NumElements = DataTypeTy->getNumElements();
342 unsigned EltSize = DataTypeTy->getElementType()->getScalarSizeInBits();
343 return NumElements > 1 && isPowerOf2_64(NumElements) && EltSize >= 8 &&
344 EltSize <= 128 && isPowerOf2_64(EltSize);
345 }
346 return BaseT::isLegalNTStore(DataType, Alignment);
347 }
348
349 bool isLegalNTStore(Type *DataType, Align Alignment) {
350 return isLegalNTStoreLoad(DataType, Alignment);
351 }
352
353 bool isLegalNTLoad(Type *DataType, Align Alignment) {
354 // Only supports little-endian targets.
355 if (ST->isLittleEndian())
356 return isLegalNTStoreLoad(DataType, Alignment);
357 return BaseT::isLegalNTLoad(DataType, Alignment);
358 }
359
360 bool enableOrderedReductions() const { return true; }
361
363 unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef<unsigned> Indices,
364 Align Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind,
365 bool UseMaskForCond = false, bool UseMaskForGaps = false);
366
367 bool
369 bool &AllowPromotionWithoutCommonHeader);
370
371 bool shouldExpandReduction(const IntrinsicInst *II) const { return false; }
372
373 unsigned getGISelRematGlobalCost() const {
374 return 2;
375 }
376
378 return ST->hasSVE() ? 5 : 0;
379 }
380
381 TailFoldingStyle getPreferredTailFoldingStyle(bool IVUpdateMayOverflow) const {
382 if (ST->hasSVE())
383 return IVUpdateMayOverflow
386
388 }
389
391 return ST->useFixedOverScalableIfEqualCost();
392 }
393
394 unsigned getEpilogueVectorizationMinVF() const;
395
397
399 return ST->isSVEorStreamingSVEAvailable();
400 }
401
402 bool enableScalableVectorization() const;
403
405 ElementCount VF) const;
406
407 bool preferPredicatedReductionSelect(unsigned Opcode, Type *Ty,
408 TTI::ReductionFlags Flags) const {
409 return ST->hasSVE();
410 }
411
413 std::optional<FastMathFlags> FMF,
415
417 ArrayRef<int> Mask,
419 VectorType *SubTp,
420 ArrayRef<const Value *> Args = {},
421 const Instruction *CxtI = nullptr);
422
423 InstructionCost getScalarizationOverhead(VectorType *Ty,
424 const APInt &DemandedElts,
425 bool Insert, bool Extract,
427 ArrayRef<Value *> VL = {});
428
429 /// Return the cost of the scaling factor used in the addressing
430 /// mode represented by AM for this target, for a load/store
431 /// of the specified type.
432 /// If the AM is supported, the return value must be >= 0.
433 /// If the AM is not supported, it returns a negative value.
434 InstructionCost getScalingFactorCost(Type *Ty, GlobalValue *BaseGV,
435 StackOffset BaseOffset, bool HasBaseReg,
436 int64_t Scale, unsigned AddrSpace) const;
437
438 bool enableSelectOptimize() { return ST->enableSelectOptimize(); }
439
441
442 unsigned getStoreMinimumVF(unsigned VF, Type *ScalarMemTy,
443 Type *ScalarValTy) const {
444 // We can vectorize store v4i8.
445 if (ScalarMemTy->isIntegerTy(8) && isPowerOf2_32(VF) && VF >= 4)
446 return 4;
447
448 return BaseT::getStoreMinimumVF(VF, ScalarMemTy, ScalarValTy);
449 }
450
451 std::optional<unsigned> getMinPageSize() const { return 4096; }
452
455
457 SmallVectorImpl<Use *> &Ops) const;
458 /// @}
459};
460
461} // end namespace llvm
462
463#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
#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)
bool preferFixedOverScalableIfEqualCost() const
InstructionCost getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA, TTI::TargetCostKind CostKind)
InstructionCost getArithmeticReductionCost(unsigned Opcode, VectorType *Ty, std::optional< FastMathFlags > FMF, TTI::TargetCostKind CostKind)
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
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)
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:370
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
Definition: InstrTypes.h:1120
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:296
constexpr bool isPowerOf2_32(uint32_t Value)
Return true if the argument is a power of two > 0.
Definition: MathExtras.h:291
@ 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.