LLVM 22.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 TargetTransformInfoImplBase 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 final : public BasicTTIImplBase<AArch64TTIImpl> {
44 using TTI = TargetTransformInfo;
45
46 friend BaseT;
47
48 const AArch64Subtarget *ST;
49 const AArch64TargetLowering *TLI;
50
51 static const FeatureBitset InlineInverseFeatures;
52
53 const AArch64Subtarget *getST() const { return ST; }
54 const AArch64TargetLowering *getTLI() const { return TLI; }
55
56 enum MemIntrinsicType {
57 VECTOR_LDST_TWO_ELEMENTS,
58 VECTOR_LDST_THREE_ELEMENTS,
59 VECTOR_LDST_FOUR_ELEMENTS
60 };
61
62 /// Given a add/sub/mul operation, detect a widening addl/subl/mull pattern
63 /// where both operands can be treated like extends. Returns the minimal type
64 /// needed to compute the operation.
65 Type *isBinExtWideningInstruction(unsigned Opcode, Type *DstTy,
67 Type *SrcOverrideTy = nullptr) const;
68 /// Given a add/sub operation with a single extend operand, detect a
69 /// widening addw/subw pattern.
70 bool isSingleExtWideningInstruction(unsigned Opcode, Type *DstTy,
72 Type *SrcOverrideTy = nullptr) const;
73
74 // A helper function called by 'getVectorInstrCost'.
75 //
76 // 'Val' and 'Index' are forwarded from 'getVectorInstrCost';
77 // \param ScalarUserAndIdx encodes the information about extracts from a
78 /// vector with 'Scalar' being the value being extracted,'User' being the user
79 /// of the extract(nullptr if user is not known before vectorization) and
80 /// 'Idx' being the extract lane.
81 InstructionCost getVectorInstrCostHelper(
82 unsigned Opcode, Type *Val, TTI::TargetCostKind CostKind, unsigned Index,
83 const Instruction *I = nullptr, Value *Scalar = nullptr,
84 ArrayRef<std::tuple<Value *, User *, int>> ScalarUserAndIdx = {}) const;
85
86public:
87 explicit AArch64TTIImpl(const AArch64TargetMachine *TM, const Function &F)
88 : BaseT(TM, F.getDataLayout()), ST(TM->getSubtargetImpl(F)),
89 TLI(ST->getTargetLowering()) {}
90
91 bool areInlineCompatible(const Function *Caller,
92 const Function *Callee) const override;
93
94 bool areTypesABICompatible(const Function *Caller, const Function *Callee,
95 ArrayRef<Type *> Types) const override;
96
97 unsigned getInlineCallPenalty(const Function *F, const CallBase &Call,
98 unsigned DefaultCallPenalty) const override;
99
100 APInt getFeatureMask(const Function &F) const override;
101
102 bool isMultiversionedFunction(const Function &F) const override;
103
104 /// \name Scalar TTI Implementations
105 /// @{
106
108 InstructionCost getIntImmCost(int64_t Val) const;
109 InstructionCost getIntImmCost(const APInt &Imm, Type *Ty,
110 TTI::TargetCostKind CostKind) const override;
111 InstructionCost getIntImmCostInst(unsigned Opcode, unsigned Idx,
112 const APInt &Imm, Type *Ty,
114 Instruction *Inst = nullptr) const override;
116 getIntImmCostIntrin(Intrinsic::ID IID, unsigned Idx, const APInt &Imm,
117 Type *Ty, TTI::TargetCostKind CostKind) const override;
118 TTI::PopcntSupportKind getPopcntSupport(unsigned TyWidth) const override;
119
120 /// @}
121
122 /// \name Vector TTI Implementations
123 /// @{
124
125 bool enableInterleavedAccessVectorization() const override { return true; }
126
128 return ST->hasSVE();
129 }
130
131 unsigned getNumberOfRegisters(unsigned ClassID) const override {
132 bool Vector = (ClassID == 1);
133 if (Vector) {
134 if (ST->hasNEON())
135 return 32;
136 return 0;
137 }
138 return 31;
139 }
140
143 TTI::TargetCostKind CostKind) const override;
144
145 std::optional<Instruction *>
147
148 std::optional<Value *> simplifyDemandedVectorEltsIntrinsic(
149 InstCombiner &IC, IntrinsicInst &II, APInt DemandedElts, APInt &UndefElts,
150 APInt &UndefElts2, APInt &UndefElts3,
151 std::function<void(Instruction *, unsigned, APInt, APInt &)>
152 SimplifyAndSetOp) const override;
153
156
157 unsigned getMinVectorRegisterBitWidth() const override {
158 return ST->getMinVectorRegisterBitWidth();
159 }
160
161 std::optional<unsigned> getVScaleForTuning() const override {
162 return ST->getVScaleForTuning();
163 }
164
165 bool isVScaleKnownToBeAPowerOfTwo() const override { return true; }
166
168 TargetTransformInfo::RegisterKind K) const override;
169
170 /// Try to return an estimate cost factor that can be used as a multiplier
171 /// when scalarizing an operation for a vector with ElementCount \p VF.
172 /// For scalable vectors this currently takes the most pessimistic view based
173 /// upon the maximum possible value for vscale.
174 unsigned getMaxNumElements(ElementCount VF) const {
175 if (!VF.isScalable())
176 return VF.getFixedValue();
177
178 return VF.getKnownMinValue() * ST->getVScaleForTuning();
179 }
180
181 unsigned getMaxInterleaveFactor(ElementCount VF) const override;
182
183 bool prefersVectorizedAddressing() const override;
184
185 /// Check whether Opcode1 has less throughput according to the scheduling
186 /// model than Opcode2.
187 bool hasKnownLowerThroughputFromSchedulingModel(unsigned Opcode1,
188 unsigned Opcode2) const;
189
192 TTI::TargetCostKind CostKind) const override;
193
195 getGatherScatterOpCost(unsigned Opcode, Type *DataTy, const Value *Ptr,
196 bool VariableMask, Align Alignment,
198 const Instruction *I = nullptr) const override;
199
200 bool isExtPartOfAvgExpr(const Instruction *ExtUser, Type *Dst,
201 Type *Src) const;
202
204 getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src,
206 const Instruction *I = nullptr) const override;
207
209 getExtractWithExtendCost(unsigned Opcode, Type *Dst, VectorType *VecTy,
210 unsigned Index,
211 TTI::TargetCostKind CostKind) const override;
212
214 const Instruction *I = nullptr) const override;
215
216 InstructionCost getVectorInstrCost(unsigned Opcode, Type *Val,
218 unsigned Index, const Value *Op0,
219 const Value *Op1) const override;
220
221 /// \param ScalarUserAndIdx encodes the information about extracts from a
222 /// vector with 'Scalar' being the value being extracted,'User' being the user
223 /// of the extract(nullptr if user is not known before vectorization) and
224 /// 'Idx' being the extract lane.
225 InstructionCost getVectorInstrCost(unsigned Opcode, Type *Val,
227 unsigned Index, Value *Scalar,
228 ArrayRef<std::tuple<Value *, User *, int>>
229 ScalarUserAndIdx) const override;
230
233 unsigned Index) const override;
234
236 getIndexedVectorInstrCostFromEnd(unsigned Opcode, Type *Val,
238 unsigned Index) const override;
239
242 TTI::TargetCostKind CostKind) const override;
243
245 getArithmeticReductionCostSVE(unsigned Opcode, VectorType *ValTy,
247
250
252 unsigned Opcode, Type *Ty, TTI::TargetCostKind CostKind,
256 const Instruction *CxtI = nullptr) const override;
257
259 getAddressComputationCost(Type *PtrTy, ScalarEvolution *SE, const SCEV *Ptr,
260 TTI::TargetCostKind CostKind) const override;
261
263 unsigned Opcode, Type *ValTy, Type *CondTy, CmpInst::Predicate VecPred,
267 const Instruction *I = nullptr) const override;
268
270 enableMemCmpExpansion(bool OptSize, bool IsZeroCmp) const override;
271 bool useNeonVector(const Type *Ty) const;
272
274 unsigned Opcode, Type *Src, Align Alignment, unsigned AddressSpace,
277 const Instruction *I = nullptr) const override;
278
281
282 void getUnrollingPreferences(Loop *L, ScalarEvolution &SE,
284 OptimizationRemarkEmitter *ORE) const override;
285
286 void getPeelingPreferences(Loop *L, ScalarEvolution &SE,
287 TTI::PeelingPreferences &PP) const override;
288
289 Value *
290 getOrCreateResultFromMemIntrinsic(IntrinsicInst *Inst, Type *ExpectedType,
291 bool CanCreate = true) const override;
292
293 bool getTgtMemIntrinsic(IntrinsicInst *Inst,
294 MemIntrinsicInfo &Info) const override;
295
296 bool isElementTypeLegalForScalableVector(Type *Ty) const override {
297 if (Ty->isPointerTy())
298 return true;
299
300 if (Ty->isBFloatTy() && ST->hasBF16())
301 return true;
302
303 if (Ty->isHalfTy() || Ty->isFloatTy() || Ty->isDoubleTy())
304 return true;
305
306 if (Ty->isIntegerTy(1) || Ty->isIntegerTy(8) || Ty->isIntegerTy(16) ||
307 Ty->isIntegerTy(32) || Ty->isIntegerTy(64))
308 return true;
309
310 return false;
311 }
312
313 bool isLegalMaskedLoadStore(Type *DataType, Align Alignment) const {
314 if (!ST->isSVEorStreamingSVEAvailable())
315 return false;
316
317 // For fixed vectors, avoid scalarization if using SVE for them.
318 if (isa<FixedVectorType>(DataType) && !ST->useSVEForFixedLengthVectors() &&
319 DataType->getPrimitiveSizeInBits() != 128)
320 return false; // Fall back to scalarization of masked operations.
321
322 return isElementTypeLegalForScalableVector(DataType->getScalarType());
323 }
324
325 bool isLegalMaskedLoad(Type *DataType, Align Alignment,
326 unsigned /*AddressSpace*/,
327 TTI::MaskKind /*MaskKind*/) const override {
328 return isLegalMaskedLoadStore(DataType, Alignment);
329 }
330
331 bool isLegalMaskedStore(Type *DataType, Align Alignment,
332 unsigned /*AddressSpace*/,
333 TTI::MaskKind /*MaskKind*/) const override {
334 return isLegalMaskedLoadStore(DataType, Alignment);
335 }
336
338 return Ty->isFloatTy() || Ty->isDoubleTy() || Ty->isIntegerTy(32) ||
339 Ty->isIntegerTy(64);
340 }
341
343 Align Alignment) const override {
344 if (!ST->isSVEAvailable())
345 return false;
346
347 if (isa<FixedVectorType>(DataType) &&
348 DataType->getPrimitiveSizeInBits() < 128)
349 return false;
350
351 return isElementTypeLegalForCompressStore(DataType->getScalarType());
352 }
353
354 bool isLegalMaskedGatherScatter(Type *DataType) const {
355 if (!ST->isSVEAvailable())
356 return false;
357
358 // For fixed vectors, scalarize if not using SVE for them.
359 auto *DataTypeFVTy = dyn_cast<FixedVectorType>(DataType);
360 if (DataTypeFVTy && (!ST->useSVEForFixedLengthVectors() ||
361 DataTypeFVTy->getNumElements() < 2))
362 return false;
363
364 return isElementTypeLegalForScalableVector(DataType->getScalarType());
365 }
366
367 bool isLegalMaskedGather(Type *DataType, Align Alignment) const override {
368 return isLegalMaskedGatherScatter(DataType);
369 }
370
371 bool isLegalMaskedScatter(Type *DataType, Align Alignment) const override {
372 return isLegalMaskedGatherScatter(DataType);
373 }
374
375 bool isLegalBroadcastLoad(Type *ElementTy,
376 ElementCount NumElements) const override {
377 // Return true if we can generate a `ld1r` splat load instruction.
378 if (!ST->hasNEON() || NumElements.isScalable())
379 return false;
380 switch (unsigned ElementBits = ElementTy->getScalarSizeInBits()) {
381 case 8:
382 case 16:
383 case 32:
384 case 64: {
385 // We accept bit-widths >= 64bits and elements {8,16,32,64} bits.
386 unsigned VectorBits = NumElements.getFixedValue() * ElementBits;
387 return VectorBits >= 64;
388 }
389 }
390 return false;
391 }
392
393 bool isLegalNTStoreLoad(Type *DataType, Align Alignment) const {
394 // NOTE: The logic below is mostly geared towards LV, which calls it with
395 // vectors with 2 elements. We might want to improve that, if other
396 // users show up.
397 // Nontemporal vector loads/stores can be directly lowered to LDNP/STNP, if
398 // the vector can be halved so that each half fits into a register. That's
399 // the case if the element type fits into a register and the number of
400 // elements is a power of 2 > 1.
401 if (auto *DataTypeTy = dyn_cast<FixedVectorType>(DataType)) {
402 unsigned NumElements = DataTypeTy->getNumElements();
403 unsigned EltSize = DataTypeTy->getElementType()->getScalarSizeInBits();
404 return NumElements > 1 && isPowerOf2_64(NumElements) && EltSize >= 8 &&
405 EltSize <= 128 && isPowerOf2_64(EltSize);
406 }
407 return BaseT::isLegalNTStore(DataType, Alignment);
408 }
409
410 bool isLegalNTStore(Type *DataType, Align Alignment) const override {
411 return isLegalNTStoreLoad(DataType, Alignment);
412 }
413
414 bool isLegalNTLoad(Type *DataType, Align Alignment) const override {
415 // Only supports little-endian targets.
416 if (ST->isLittleEndian())
417 return isLegalNTStoreLoad(DataType, Alignment);
418 return BaseT::isLegalNTLoad(DataType, Alignment);
419 }
420
422 unsigned Opcode, Type *InputTypeA, Type *InputTypeB, Type *AccumType,
424 TTI::PartialReductionExtendKind OpBExtend, std::optional<unsigned> BinOp,
425 TTI::TargetCostKind CostKind) const override;
426
427 bool enableOrderedReductions() const override { return true; }
428
430 unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef<unsigned> Indices,
431 Align Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind,
432 bool UseMaskForCond = false, bool UseMaskForGaps = false) const override;
433
435 const Instruction &I,
436 bool &AllowPromotionWithoutCommonHeader) const override;
437
438 bool shouldExpandReduction(const IntrinsicInst *II) const override {
439 return false;
440 }
441
442 unsigned getGISelRematGlobalCost() const override { return 2; }
443
444 unsigned getMinTripCountTailFoldingThreshold() const override {
445 return ST->hasSVE() ? 5 : 0;
446 }
447
449 getPreferredTailFoldingStyle(bool IVUpdateMayOverflow) const override {
450 if (ST->hasSVE())
451 return IVUpdateMayOverflow
454
456 }
457
458 bool preferFixedOverScalableIfEqualCost(bool IsEpilogue) const override;
459
460 unsigned getEpilogueVectorizationMinVF() const override;
461
462 bool preferPredicateOverEpilogue(TailFoldingInfo *TFI) const override;
463
464 bool supportsScalableVectors() const override {
465 return ST->isSVEorStreamingSVEAvailable();
466 }
467
468 bool enableScalableVectorization() const override;
469
471 ElementCount VF) const override;
472
473 bool preferPredicatedReductionSelect() const override { return ST->hasSVE(); }
474
475 /// FP16 and BF16 operations are lowered to fptrunc(op(fpext, fpext) if the
476 /// architecture features are not present.
477 std::optional<InstructionCost> getFP16BF16PromoteCost(
479 TTI::OperandValueInfo Op2Info, bool IncludeTrunc, bool CanUseSVE,
480 std::function<InstructionCost(Type *)> InstCost) const;
481
483 getArithmeticReductionCost(unsigned Opcode, VectorType *Ty,
484 std::optional<FastMathFlags> FMF,
485 TTI::TargetCostKind CostKind) const override;
486
488 getExtendedReductionCost(unsigned Opcode, bool IsUnsigned, Type *ResTy,
489 VectorType *ValTy, std::optional<FastMathFlags> FMF,
490 TTI::TargetCostKind CostKind) const override;
491
493 bool IsUnsigned, unsigned RedOpcode, Type *ResTy, VectorType *Ty,
495
499 VectorType *SubTp, ArrayRef<const Value *> Args = {},
500 const Instruction *CxtI = nullptr) const override;
501
503 VectorType *Ty, const APInt &DemandedElts, bool Insert, bool Extract,
504 TTI::TargetCostKind CostKind, bool ForPoisonSrc = true,
505 ArrayRef<Value *> VL = {}) const override;
506
507 /// Return the cost of the scaling factor used in the addressing
508 /// mode represented by AM for this target, for a load/store
509 /// of the specified type.
510 /// If the AM is supported, the return value must be >= 0.
511 /// If the AM is not supported, it returns an invalid cost.
512 InstructionCost getScalingFactorCost(Type *Ty, GlobalValue *BaseGV,
513 StackOffset BaseOffset, bool HasBaseReg,
514 int64_t Scale,
515 unsigned AddrSpace) const override;
516
517 bool enableSelectOptimize() const override {
518 return ST->enableSelectOptimize();
519 }
520
521 bool shouldTreatInstructionLikeSelect(const Instruction *I) const override;
522
523 unsigned getStoreMinimumVF(unsigned VF, Type *ScalarMemTy,
524 Type *ScalarValTy) const override {
525 // We can vectorize store v4i8.
526 if (ScalarMemTy->isIntegerTy(8) && isPowerOf2_32(VF) && VF >= 4)
527 return 4;
528
529 return BaseT::getStoreMinimumVF(VF, ScalarMemTy, ScalarValTy);
530 }
531
532 std::optional<unsigned> getMinPageSize() const override { return 4096; }
533
535 const TargetTransformInfo::LSRCost &C2) const override;
536
538 SmallVectorImpl<Use *> &Ops) const override;
539 /// @}
540};
541
542} // end namespace llvm
543
544#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...
Analysis containing CSE Info
Definition CSEInfo.cpp:27
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")))
This file defines an InstructionCost class that is used when calculating the cost of an instruction,...
const AbstractManglingParser< Derived, Alloc >::OperatorInfo AbstractManglingParser< Derived, Alloc >::Ops[]
#define F(x, y, z)
Definition MD5.cpp:54
#define I(x, y, z)
Definition MD5.cpp:57
uint64_t IntrinsicInst * II
This pass exposes codegen information to IR-level passes.
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) const override
InstructionCost getArithmeticReductionCost(unsigned Opcode, VectorType *Ty, std::optional< FastMathFlags > FMF, TTI::TargetCostKind CostKind) const override
bool isLegalNTLoad(Type *DataType, Align Alignment) 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 getCostOfKeepingLiveOverCall(ArrayRef< Type * > Tys) const override
unsigned getMaxInterleaveFactor(ElementCount VF) const override
TailFoldingStyle getPreferredTailFoldingStyle(bool IVUpdateMayOverflow) const override
bool isVScaleKnownToBeAPowerOfTwo() const override
bool isLegalNTStoreLoad(Type *DataType, Align Alignment) const
bool isLegalBroadcastLoad(Type *ElementTy, ElementCount NumElements) const override
InstructionCost getAddressComputationCost(Type *PtrTy, ScalarEvolution *SE, const SCEV *Ptr, TTI::TargetCostKind CostKind) const override
bool isExtPartOfAvgExpr(const Instruction *ExtUser, Type *Dst, Type *Src) const
InstructionCost getIntImmCost(int64_t Val) const
Calculate the cost of materializing a 64-bit value.
std::optional< InstructionCost > getFP16BF16PromoteCost(Type *Ty, TTI::TargetCostKind CostKind, TTI::OperandValueInfo Op1Info, TTI::OperandValueInfo Op2Info, bool IncludeTrunc, bool CanUseSVE, std::function< InstructionCost(Type *)> InstCost) const
FP16 and BF16 operations are lowered to fptrunc(op(fpext, fpext) if the architecture features are not...
bool prefersVectorizedAddressing() const override
unsigned getMinTripCountTailFoldingThreshold() const override
std::optional< unsigned > getVScaleForTuning() const override
InstructionCost getIndexedVectorInstrCostFromEnd(unsigned Opcode, Type *Val, TTI::TargetCostKind CostKind, unsigned Index) const override
InstructionCost getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA, TTI::TargetCostKind CostKind) const override
bool isLegalMaskedScatter(Type *DataType, Align Alignment) const override
InstructionCost getMulAccReductionCost(bool IsUnsigned, unsigned RedOpcode, Type *ResTy, VectorType *Ty, TTI::TargetCostKind CostKind=TTI::TCK_RecipThroughput) const override
bool isLegalMaskedStore(Type *DataType, Align Alignment, unsigned, TTI::MaskKind) const override
bool supportsScalableVectors() const override
InstructionCost getVectorInstrCost(unsigned Opcode, Type *Val, TTI::TargetCostKind CostKind, unsigned Index, const Value *Op0, const Value *Op1) const override
bool enableSelectOptimize() const override
InstructionCost getIntImmCostInst(unsigned Opcode, unsigned Idx, const APInt &Imm, Type *Ty, TTI::TargetCostKind CostKind, Instruction *Inst=nullptr) const override
bool isElementTypeLegalForScalableVector(Type *Ty) const override
bool preferPredicatedReductionSelect() const override
void getPeelingPreferences(Loop *L, ScalarEvolution &SE, TTI::PeelingPreferences &PP) const override
InstructionCost getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src, TTI::CastContextHint CCH, TTI::TargetCostKind CostKind, const Instruction *I=nullptr) const override
unsigned getNumberOfRegisters(unsigned ClassID) const override
bool isLegalMaskedLoad(Type *DataType, Align Alignment, unsigned, TTI::MaskKind) const override
void getUnrollingPreferences(Loop *L, ScalarEvolution &SE, TTI::UnrollingPreferences &UP, OptimizationRemarkEmitter *ORE) const override
bool getTgtMemIntrinsic(IntrinsicInst *Inst, MemIntrinsicInfo &Info) const override
InstructionCost getMinMaxReductionCost(Intrinsic::ID IID, VectorType *Ty, FastMathFlags FMF, TTI::TargetCostKind CostKind) const override
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
bool shouldMaximizeVectorBandwidth(TargetTransformInfo::RegisterKind K) const override
bool isLSRCostLess(const TargetTransformInfo::LSRCost &C1, const TargetTransformInfo::LSRCost &C2) const override
InstructionCost getScalarizationOverhead(VectorType *Ty, const APInt &DemandedElts, bool Insert, bool Extract, TTI::TargetCostKind CostKind, bool ForPoisonSrc=true, ArrayRef< Value * > VL={}) const override
InstructionCost getCFInstrCost(unsigned Opcode, TTI::TargetCostKind CostKind, const Instruction *I=nullptr) 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...
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 isLegalNTStore(Type *DataType, Align Alignment) const override
bool useNeonVector(const Type *Ty) const
std::optional< Instruction * > instCombineIntrinsic(InstCombiner &IC, IntrinsicInst &II) 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 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
std::optional< unsigned > getMinPageSize() const override
bool preferPredicateOverEpilogue(TailFoldingInfo *TFI) const override
InstructionCost getExtendedReductionCost(unsigned Opcode, bool IsUnsigned, Type *ResTy, VectorType *ValTy, std::optional< FastMathFlags > FMF, TTI::TargetCostKind CostKind) const override
bool isLegalMaskedLoadStore(Type *DataType, Align Alignment) const
unsigned getMinVectorRegisterBitWidth() const override
TTI::PopcntSupportKind getPopcntSupport(unsigned TyWidth) const override
bool isElementTypeLegalForCompressStore(Type *Ty) const
InstructionCost getExtractWithExtendCost(unsigned Opcode, Type *Dst, VectorType *VecTy, unsigned Index, TTI::TargetCostKind CostKind) const override
AArch64TTIImpl(const AArch64TargetMachine *TM, const Function &F)
unsigned getInlineCallPenalty(const Function *F, const CallBase &Call, unsigned DefaultCallPenalty) const override
bool areInlineCompatible(const Function *Caller, const Function *Callee) const override
unsigned getMaxNumElements(ElementCount VF) const
Try to return an estimate cost factor that can be used as a multiplier when scalarizing an operation ...
bool shouldTreatInstructionLikeSelect(const Instruction *I) const override
InstructionCost getMaskedMemoryOpCost(const MemIntrinsicCostAttributes &MICA, TTI::TargetCostKind CostKind) const override
bool enableOrderedReductions() const override
bool isMultiversionedFunction(const Function &F) const override
TypeSize getRegisterBitWidth(TargetTransformInfo::RegisterKind K) const override
bool isLegalToVectorizeReduction(const RecurrenceDescriptor &RdxDesc, ElementCount VF) const override
TTI::MemCmpExpansionOptions enableMemCmpExpansion(bool OptSize, bool IsZeroCmp) const override
bool enableInterleavedAccessVectorization() const override
InstructionCost getIntImmCostIntrin(Intrinsic::ID IID, unsigned Idx, const APInt &Imm, Type *Ty, TTI::TargetCostKind CostKind) const override
bool isLegalMaskedGatherScatter(Type *DataType) const
unsigned getGISelRematGlobalCost() const override
bool shouldConsiderAddressTypePromotion(const Instruction &I, bool &AllowPromotionWithoutCommonHeader) const override
See if I should be considered for address type promotion.
APInt getFeatureMask(const Function &F) const override
InstructionCost getGatherScatterOpCost(unsigned Opcode, Type *DataTy, const Value *Ptr, bool VariableMask, Align Alignment, TTI::TargetCostKind CostKind, const Instruction *I=nullptr) 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
bool areTypesABICompatible(const Function *Caller, const Function *Callee, ArrayRef< Type * > Types) const override
bool enableScalableVectorization() const override
bool shouldExpandReduction(const IntrinsicInst *II) const override
Value * getOrCreateResultFromMemIntrinsic(IntrinsicInst *Inst, Type *ExpectedType, bool CanCreate=true) const override
bool isLegalMaskedGather(Type *DataType, Align Alignment) const override
bool hasKnownLowerThroughputFromSchedulingModel(unsigned Opcode1, unsigned Opcode2) const
Check whether Opcode1 has less throughput according to the scheduling model than Opcode2.
bool enableMaskedInterleavedAccessVectorization() const override
unsigned getEpilogueVectorizationMinVF() const override
InstructionCost getSpliceCost(VectorType *Tp, int Index, TTI::TargetCostKind CostKind) const
InstructionCost getArithmeticReductionCostSVE(unsigned Opcode, VectorType *ValTy, TTI::TargetCostKind CostKind) const
InstructionCost getScalingFactorCost(Type *Ty, GlobalValue *BaseGV, StackOffset BaseOffset, bool HasBaseReg, int64_t Scale, unsigned AddrSpace) const override
Return the cost of the scaling factor used in the addressing mode represented by AM for this target,...
bool isLegalMaskedCompressStore(Type *DataType, Align Alignment) const override
bool preferFixedOverScalableIfEqualCost(bool IsEpilogue) const override
unsigned getStoreMinimumVF(unsigned VF, Type *ScalarMemTy, Type *ScalarValTy) const override
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:40
unsigned getStoreMinimumVF(unsigned VF, Type *ScalarMemTy, Type *ScalarValTy) const override
BasicTTIImplBase(const TargetMachine *TM, const DataLayout &DL)
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
Definition InstrTypes.h:676
Convenience struct for specifying and reasoning about fast-math flags.
Definition FMF.h:22
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.
Definition LoopInfo.h:40
Information for memory intrinsic cost model.
The RecurrenceDescriptor is used to identify recurrences variables in a loop.
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...
virtual const DataLayout & getDataLayout() const
virtual InstructionCost getIntImmCost(const APInt &Imm, Type *Ty, TTI::TargetCostKind CostKind) const
virtual bool isLegalNTStore(Type *DataType, Align Alignment) const
virtual bool isLegalNTLoad(Type *DataType, Align Alignment) const
This pass provides access to the codegen interfaces that are needed for IR-level transformations.
MaskKind
Some targets only support masked load/store with a constant mask.
TargetCostKind
The kind of cost model.
@ TCK_RecipThroughput
Reciprocal throughput.
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
LLVM_ABI unsigned getScalarSizeInBits() const LLVM_READONLY
If this is a vector type, return the getPrimitiveSizeInBits value for the element type.
Definition Type.cpp:230
bool isIntegerTy() const
True if this is an instance of IntegerType.
Definition Type.h:240
LLVM Value Representation.
Definition Value.h:75
Base class of all SIMD vector types.
constexpr ScalarTy getFixedValue() const
Definition TypeSize.h:200
constexpr bool isScalable() const
Returns whether the quantity is scaled by a runtime quantity (vscale).
Definition TypeSize.h:168
constexpr ScalarTy getKnownMinValue() const
Returns the minimum value this quantity can represent.
Definition TypeSize.h:165
CallInst * Call
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
friend class Instruction
Iterator for Instructions in a `BasicBlock.
Definition BasicBlock.h:73
This is an optimization pass for GlobalISel generic memory operations.
FunctionAddr VTableAddr Value
Definition InstrProf.h:137
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:643
constexpr bool isPowerOf2_64(uint64_t Value)
Return true if the argument is a power of two > 0 (64 bit edition.)
Definition MathExtras.h:284
constexpr bool isPowerOf2_32(uint32_t Value)
Return true if the argument is a power of two > 0.
Definition MathExtras.h:279
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
Definition Casting.h:547
ArrayRef(const T &OneElt) -> ArrayRef< T >
@ 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
Returns options for expansion of memcmp. IsZeroCmp is.
Parameters that control the generic loop unrolling transformation.