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"
21#include "AArch64TargetMachine.h"
22#include "llvm/Analysis/TargetTransformInfo.h"
23#include "llvm/CodeGen/BasicTTIImpl.h"
24#include "llvm/IR/FMF.h"
25#include "llvm/IR/Function.h"
26#include "llvm/IR/Intrinsics.h"
27#include "llvm/Support/InstructionCost.h"
28#include <cstdint>
29#include <optional>
30
31namespace llvm {
32
33class APInt;
34class Instruction;
35class IntrinsicInst;
36class Loop;
37class LoopInfo;
38class SCEV;
39class ScalarEvolution;
40class Type;
41class Value;
42class VectorType;
43
44class AArch64TTIImpl final : public BasicTTIImplBase<AArch64TTIImpl> {
45 using BaseT = BasicTTIImplBase<AArch64TTIImpl>;
46 using TTI = TargetTransformInfo;
47
48 friend BaseT;
49
50 const AArch64Subtarget *ST;
51 const AArch64TargetLowering *TLI;
52
53 const AArch64Subtarget *getST() const { return ST; }
54 const AArch64TargetLowering *getTLI() const { return TLI; }
55
56 /// Given a add/sub/mul operation, detect a widening addl/subl/mull pattern
57 /// where both operands can be treated like extends. Returns the minimal type
58 /// needed to compute the operation.
59 Type *isBinExtWideningInstruction(unsigned Opcode, Type *DstTy,
60 ArrayRef<const Value *> Args,
61 Type *SrcOverrideTy = nullptr) const;
62 /// Given a add/sub operation with a single extend operand, detect a
63 /// widening addw/subw pattern.
64 bool isSingleExtWideningInstruction(unsigned Opcode, Type *DstTy,
65 ArrayRef<const Value *> Args,
66 Type *SrcOverrideTy = nullptr) const;
67
68 // A helper function called by 'getVectorInstrCost'.
69 //
70 // 'Val' and 'Index' are forwarded from 'getVectorInstrCost';
71 // \param ScalarUserAndIdx encodes the information about extracts from a
72 /// vector with 'Scalar' being the value being extracted,'User' being the user
73 /// of the extract(nullptr if user is not known before vectorization) and
74 /// 'Idx' being the extract lane.
75 InstructionCost getVectorInstrCostHelper(
76 unsigned Opcode, Type *Ty, TTI::TargetCostKind CostKind, unsigned Index,
77 const Instruction *I = nullptr, Value *Scalar = nullptr,
78 ArrayRef<std::tuple<Value *, User *, int>> ScalarUserAndIdx = {},
79 TTI::VectorInstrContext VIC = TTI::VectorInstrContext::None) const;
80
81public:
82 explicit AArch64TTIImpl(const AArch64TargetMachine *TM, const Function &F)
83 : BaseT(TM, F.getDataLayout()), ST(TM->getSubtargetImpl(F)),
84 TLI(ST->getTargetLowering()) {}
85
86 bool areInlineCompatible(const Function *Caller,
87 const Function *Callee) const override;
88
89 bool areTypesABICompatible(const Function *Caller, const Function *Callee,
90 ArrayRef<Type *> Types) const override;
91
92 unsigned getInlineCallPenalty(const Function *F, const CallBase &Call,
93 unsigned DefaultCallPenalty) const override;
94
95 APInt getFeatureMask(const Function &F) const override;
96 APInt getPriorityMask(const Function &F) const override;
97
98 bool isMultiversionedFunction(const Function &F) const override;
99
100 /// \name Scalar TTI Implementations
101 /// @{
102
103 using BaseT::getIntImmCost;
104 InstructionCost getIntImmCost(int64_t Val) const;
105 InstructionCost getIntImmCost(const APInt &Imm, Type *Ty,
106 TTI::TargetCostKind CostKind) const override;
107 InstructionCost getIntImmCostInst(unsigned Opcode, unsigned Idx,
108 const APInt &Imm, Type *Ty,
109 TTI::TargetCostKind CostKind,
110 Instruction *Inst = nullptr) const override;
111 InstructionCost
112 getIntImmCostIntrin(Intrinsic::ID IID, unsigned Idx, const APInt &Imm,
113 Type *Ty, TTI::TargetCostKind CostKind) const override;
114 TTI::PopcntSupportKind getPopcntSupport(unsigned TyWidth) const override;
115
116 /// @}
117
118 /// \name Vector TTI Implementations
119 /// @{
120
121 bool enableInterleavedAccessVectorization() const override { return true; }
122
123 bool enableMaskedInterleavedAccessVectorization() const override {
124 return ST->hasSVE();
125 }
126
127 unsigned getNumberOfRegisters(unsigned ClassID) const override {
128 bool Vector = (ClassID == 1);
129 if (Vector) {
130 if (ST->hasNEON())
131 return 32;
132 return 0;
133 }
134 return 31;
135 }
136
137 InstructionCost
138 getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
139 TTI::TargetCostKind CostKind) const override;
140
141 std::optional<Instruction *>
142 instCombineIntrinsic(InstCombiner &IC, IntrinsicInst &II) const override;
143
144 std::optional<Value *> simplifyDemandedVectorEltsIntrinsic(
145 InstCombiner &IC, IntrinsicInst &II, APInt DemandedElts, APInt &UndefElts,
146 APInt &UndefElts2, APInt &UndefElts3,
147 std::function<void(Instruction *, unsigned, APInt, APInt &)>
148 SimplifyAndSetOp) const override;
149
150 TypeSize
151 getRegisterBitWidth(TargetTransformInfo::RegisterKind K) const override;
152
153 unsigned getMinVectorRegisterBitWidth() const override {
154 return ST->getMinVectorRegisterBitWidth();
155 }
156
157 std::optional<unsigned> getVScaleForTuning() const override {
158 return ST->getVScaleForTuning();
159 }
160
161 bool shouldMaximizeVectorBandwidth(TargetTransformInfo::VectorKind K,
162 Type *ElementTy) const override;
163
164 /// Try to return an estimate cost factor that can be used as a multiplier
165 /// when scalarizing an operation for a vector with ElementCount \p VF.
166 /// For scalable vectors this currently takes the most pessimistic view based
167 /// upon the maximum possible value for vscale.
168 unsigned getMaxNumElements(ElementCount VF) const {
169 if (!VF.isScalable())
170 return VF.getFixedValue();
171
172 return VF.getKnownMinValue() * ST->getVScaleForTuning();
173 }
174
175 unsigned getMaxInterleaveFactor(ElementCount VF,
176 bool HasUnorderedReductions) const override;
177
178 bool prefersVectorizedAddressing() const override;
179
180 /// Check whether Opcode1 has less throughput according to the scheduling
181 /// model than Opcode2. For variant scheduling classes, the lowest throughput
182 /// of Opcode1 and the highest throughput of Opcode2 are compared among all
183 /// the scheduling classes they may be resolved to.
184 bool hasKnownLowerThroughputFromSchedulingModel(unsigned Opcode1,
185 unsigned Opcode2) const;
186
187 InstructionCost
188 getMemIntrinsicInstrCost(const MemIntrinsicCostAttributes &MICA,
189 TTI::TargetCostKind CostKind) const override;
190
191 InstructionCost getMaskedMemoryOpCost(const MemIntrinsicCostAttributes &MICA,
192 TTI::TargetCostKind CostKind) const;
193
194 InstructionCost getGatherScatterOpCost(const MemIntrinsicCostAttributes &MICA,
195 TTI::TargetCostKind CostKind) const;
196
197 bool isExtPartOfAvgExpr(const Instruction *ExtUser, Type *Dst,
198 Type *Src) const;
199
200 InstructionCost
201 getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src,
202 TTI::CastContextHint CCH, TTI::TargetCostKind CostKind,
203 const Instruction *I = nullptr) const override;
204
205 InstructionCost
206 getExtractWithExtendCost(unsigned Opcode, Type *Dst, VectorType *VecTy,
207 unsigned Index,
208 TTI::TargetCostKind CostKind) const override;
209
210 InstructionCost getCFInstrCost(unsigned Opcode, TTI::TargetCostKind CostKind,
211 const Instruction *I = nullptr) const override;
212
213 InstructionCost
214 getVectorInstrCost(unsigned Opcode, Type *Ty, TTI::TargetCostKind CostKind,
215 unsigned Index, const Value *Op0, const Value *Op1,
216 TTI::VectorInstrContext VIC =
217 TTI::VectorInstrContext::None) const override;
218
219 /// \param ScalarUserAndIdx encodes the information about extracts from a
220 /// vector with 'Scalar' being the value being extracted,'User' being the user
221 /// of the extract(nullptr if user is not known before vectorization) and
222 /// 'Idx' being the extract lane.
223 InstructionCost getVectorInstrCost(
224 unsigned Opcode, Type *Ty, TTI::TargetCostKind CostKind, unsigned Index,
225 Value *Scalar,
226 ArrayRef<std::tuple<Value *, User *, int>> ScalarUserAndIdx,
227 TTI::VectorInstrContext VIC =
228 TTI::VectorInstrContext::None) const override;
229
230 InstructionCost
231 getVectorInstrCost(const Instruction &I, Type *Ty,
232 TTI::TargetCostKind CostKind, unsigned Index,
233 TTI::VectorInstrContext VIC =
234 TTI::VectorInstrContext::None) const override;
235
236 InstructionCost
237 getIndexedVectorInstrCostFromEnd(unsigned Opcode, Type *Ty,
238 TTI::TargetCostKind CostKind,
239 unsigned Index) const override;
240
241 InstructionCost
242 getMinMaxReductionCost(Intrinsic::ID IID, VectorType *Ty, FastMathFlags FMF,
243 TTI::TargetCostKind CostKind) const override;
244
245 InstructionCost
246 getArithmeticReductionCostSVE(unsigned Opcode, VectorType *ValTy,
247 TTI::TargetCostKind CostKind) const;
248
249 InstructionCost getSpliceCost(VectorType *Tp, int Index,
250 TTI::TargetCostKind CostKind) const;
251
252 InstructionCost getArithmeticInstrCost(
253 unsigned Opcode, Type *Ty, TTI::TargetCostKind CostKind,
254 TTI::OperandValueInfo Op1Info = {.Kind: TTI::OK_AnyValue, .Properties: TTI::OP_None},
255 TTI::OperandValueInfo Op2Info = {.Kind: TTI::OK_AnyValue, .Properties: TTI::OP_None},
256 ArrayRef<const Value *> Args = {},
257 const Instruction *CtxI = nullptr) const override;
258
259 InstructionCost
260 getAddressComputationCost(Type *PtrTy, ScalarEvolution *SE, const SCEV *Ptr,
261 TTI::TargetCostKind CostKind) const override;
262
263 InstructionCost getCmpSelInstrCost(
264 unsigned Opcode, Type *ValTy, Type *CondTy, CmpInst::Predicate VecPred,
265 TTI::TargetCostKind CostKind,
266 TTI::OperandValueInfo Op1Info = {.Kind: TTI::OK_AnyValue, .Properties: TTI::OP_None},
267 TTI::OperandValueInfo Op2Info = {.Kind: TTI::OK_AnyValue, .Properties: TTI::OP_None},
268 const Instruction *I = nullptr) const override;
269
270 TTI::MemCmpExpansionOptions
271 enableMemCmpExpansion(bool OptSize, bool IsZeroCmp) const override;
272 bool useNeonVector(const Type *Ty) const;
273
274 // The expansion uses overlapping unaligned accesses, which are split up under
275 // strict alignment, and MOPS has its own variable-length lowering.
276 uint64_t getMaxBoundedMemSetInlineSize() const override {
277 return ST->requiresStrictAlign() || ST->hasMOPS() ? 0 : 64;
278 }
279
280 InstructionCost getMemoryOpCost(
281 unsigned Opcode, Type *Src, Align Alignment, unsigned AddressSpace,
282 TTI::TargetCostKind CostKind,
283 TTI::OperandValueInfo OpInfo = {.Kind: TTI::OK_AnyValue, .Properties: TTI::OP_None},
284 const Instruction *I = nullptr) const override;
285
286 InstructionCost
287 getCostOfKeepingLiveOverCall(ArrayRef<Type *> Tys) const override;
288
289 bool isLegalMaskedExpandLoad(Type *DataTy, Align Alignment) const override;
290
291 bool isLegalSpeculativeLoad(Type *DataType,
292 unsigned AddressSpace) const override;
293
294 bool hasMultiVectorLoadStore(
295 unsigned NumVectors, TTI::MaskSource Mask, VectorType *VectorTy,
296 bool IsStore,
297 std::optional<Instruction::CastOps> CastHint) const override;
298
299 void getUnrollingPreferences(Loop *L, ScalarEvolution &SE,
300 TTI::UnrollingPreferences &UP,
301 OptimizationRemarkEmitter *ORE) const override;
302
303 void getPeelingPreferences(Loop *L, ScalarEvolution &SE,
304 TTI::PeelingPreferences &PP) const override;
305
306 Value *
307 getOrCreateResultFromMemIntrinsic(IntrinsicInst *Inst, Type *ExpectedType,
308 bool CanCreate = true) const override;
309
310 bool getTgtMemIntrinsic(IntrinsicInst *Inst,
311 MemIntrinsicInfo &Info) const override;
312
313 bool isElementTypeLegalForScalableVector(Type *Ty) const override {
314 if (Ty->isPointerTy())
315 return true;
316
317 if (Ty->isBFloatTy() || Ty->isHalfTy() || Ty->isFloatTy() ||
318 Ty->isDoubleTy())
319 return true;
320
321 if (Ty->isIntegerTy(BitWidth: 1) || Ty->isIntegerTy(BitWidth: 8) || Ty->isIntegerTy(BitWidth: 16) ||
322 Ty->isIntegerTy(BitWidth: 32) || Ty->isIntegerTy(BitWidth: 64))
323 return true;
324
325 return false;
326 }
327
328 bool isLegalMaskedLoadStore(Type *DataType, Align Alignment) const {
329 if (!ST->isSVEorStreamingSVEAvailable())
330 return false;
331
332 // Type legalization cannot scalarize the data of a masked load/store.
333 // Reject types that would be legalized to a scalar (e.g. <1 x half>).
334 if (isa<FixedVectorType>(Val: DataType) &&
335 !getTypeLegalizationCost(Ty: DataType).second.isVector())
336 return false;
337
338 return isElementTypeLegalForScalableVector(Ty: DataType->getScalarType());
339 }
340
341 bool isLegalMaskedLoad(Type *DataType, Align Alignment,
342 unsigned /*AddressSpace*/,
343 TTI::MaskKind /*MaskKind*/) const override {
344 return isLegalMaskedLoadStore(DataType, Alignment);
345 }
346
347 bool isLegalMaskedStore(Type *DataType, Align Alignment,
348 unsigned /*AddressSpace*/,
349 TTI::MaskKind /*MaskKind*/) const override {
350 return isLegalMaskedLoadStore(DataType, Alignment);
351 }
352
353 bool isElementTypeLegalForCompressStore(Type *Ty) const {
354 assert(Ty->isIntegerTy() || Ty->isFloatingPointTy());
355 // 32-bit and 64-bit element types are legal if we have SVE.
356 if (is_contained(Set: {32u, 64u}, Element: Ty->getScalarSizeInBits()))
357 return true;
358
359 // 8-bit and 16-bit types require +sve2p2 or +sme2p2.
360 if (is_contained(Set: {8u, 16u}, Element: Ty->getScalarSizeInBits()))
361 return ST->hasSVE2p2() || ST->hasSME2p2();
362
363 return false;
364 }
365
366 bool isLegalMaskedCompressStore(Type *DataType,
367 Align Alignment) const override;
368
369 bool isLegalMaskedGatherScatter(Type *DataType) const {
370 if (!ST->isSVEAvailable())
371 return false;
372
373 auto *DataTypeFVTy = dyn_cast<FixedVectorType>(Val: DataType);
374 if (DataTypeFVTy && (DataTypeFVTy->getNumElements() < 2 ||
375 DataType->getScalarType()->isIntegerTy(BitWidth: 1)))
376 return false;
377
378 return isElementTypeLegalForScalableVector(Ty: DataType->getScalarType());
379 }
380
381 bool isLegalMaskedGather(Type *DataType, Align Alignment) const override {
382 return isLegalMaskedGatherScatter(DataType);
383 }
384
385 bool isLegalMaskedScatter(Type *DataType, Align Alignment) const override {
386 return isLegalMaskedGatherScatter(DataType);
387 }
388
389 bool isLegalBroadcastLoad(Type *ElementTy,
390 ElementCount NumElements) const override {
391 // Return true if we can generate a `ld1r` splat load instruction.
392 if (!ST->hasNEON() || NumElements.isScalable())
393 return false;
394 switch (unsigned ElementBits = ElementTy->getScalarSizeInBits()) {
395 case 8:
396 case 16:
397 case 32:
398 case 64: {
399 // We accept bit-widths >= 64bits and elements {8,16,32,64} bits.
400 unsigned VectorBits = NumElements.getFixedValue() * ElementBits;
401 return VectorBits >= 64;
402 }
403 }
404 return false;
405 }
406
407 std::optional<bool> isLegalNTStoreLoad(Type *DataType,
408 Align Alignment) const {
409 // Currently we only support NT load and store lowering for little-endian
410 // targets.
411 //
412 // Coordinated with LDNP and STNP constraints in
413 // `llvm/lib/Target/AArch64/AArch64InstrInfo.td` and
414 // `AArch64ISelLowering.cpp`
415 if (!ST->isLittleEndian())
416 return false;
417
418 // NOTE: The logic below is mostly geared towards LV, which calls it with
419 // vectors with 2 elements. We might want to improve that, if other
420 // users show up.
421 // Nontemporal vector loads/stores can be directly lowered to LDNP/STNP, if
422 // the vector can be halved so that each half fits into a register. That's
423 // the case if the element type fits into a register and the number of
424 // elements is a power of 2 > 1.
425 if (auto *DataTypeTy = dyn_cast<FixedVectorType>(Val: DataType)) {
426 unsigned NumElements = DataTypeTy->getNumElements();
427 unsigned EltSize = DataTypeTy->getElementType()->getScalarSizeInBits();
428 return NumElements > 1 && isPowerOf2_64(Value: NumElements) && EltSize >= 8 &&
429 EltSize <= 128 && isPowerOf2_64(Value: EltSize);
430 }
431 return std::nullopt;
432 }
433
434 bool isLegalNTStore(Type *DataType, Align Alignment) const override {
435 if (auto Result = isLegalNTStoreLoad(DataType, Alignment))
436 return *Result;
437 // Fallback to target independent logic
438 return BaseT::isLegalNTStore(DataType, Alignment);
439 }
440
441 bool isLegalNTLoad(Type *DataType, Align Alignment) const override {
442 if (auto Result = isLegalNTStoreLoad(DataType, Alignment))
443 return *Result;
444 // Fallback to target independent logic
445 return BaseT::isLegalNTLoad(DataType, Alignment);
446 }
447
448 InstructionCost getPartialReductionCost(
449 unsigned Opcode, Type *InputTypeA, Type *InputTypeB, Type *AccumType,
450 ElementCount VF, TTI::PartialReductionExtendKind OpAExtend,
451 TTI::PartialReductionExtendKind OpBExtend, std::optional<unsigned> BinOp,
452 TTI::TargetCostKind CostKind,
453 std::optional<FastMathFlags> FMF) const override;
454
455 bool enableOrderedReductions() const override { return true; }
456
457 InstructionCost getInterleavedMemoryOpCost(
458 unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef<unsigned> Indices,
459 Align Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind,
460 bool UseMaskForCond = false, bool UseMaskForGaps = false) const override;
461
462 bool shouldConsiderAddressTypePromotion(
463 const Instruction &I,
464 bool &AllowPromotionWithoutCommonHeader) const override;
465
466 bool shouldExpandReduction(const IntrinsicInst *II) const override {
467 return false;
468 }
469
470 unsigned getGISelRematGlobalCost() const override { return 2; }
471
472 InstructionCost getBranchMispredictPenalty() const override;
473
474 unsigned getMinTripCountTailFoldingThreshold() const override {
475 return ST->hasSVE() ? 5 : 0;
476 }
477
478 TailFoldingStyle getPreferredTailFoldingStyle() const override {
479 return ST->hasSVE() ? TailFoldingStyle::DataAndControlFlow
480 : TailFoldingStyle::DataWithoutLaneMask;
481 }
482
483 bool preferFixedOverScalableIfEqualCost() const override;
484
485 unsigned getEpilogueVectorizationMinVF() const override;
486
487 bool preferTailFoldingOverEpilogue(TailFoldingInfo *TFI) const override;
488
489 bool supportsScalableVectors() const override {
490 return ST->isSVEorStreamingSVEAvailable();
491 }
492
493 bool enableScalableVectorization() const override;
494
495 bool isLegalToVectorizeReduction(const RecurrenceDescriptor &RdxDesc,
496 ElementCount VF) const override;
497
498 bool preferPredicatedReductionSelect() const override { return ST->hasSVE(); }
499
500 /// FP16 and BF16 operations are lowered to fptrunc(op(fpext, fpext) if the
501 /// architecture features are not present.
502 std::optional<InstructionCost> getFP16BF16PromoteCost(
503 Type *Ty, TTI::TargetCostKind CostKind, TTI::OperandValueInfo Op1Info,
504 TTI::OperandValueInfo Op2Info, bool IncludeTrunc, bool CanUseSVE,
505 std::function<InstructionCost(Type *)> InstCost) const;
506
507 InstructionCost
508 getArithmeticReductionCost(unsigned Opcode, VectorType *Ty,
509 std::optional<FastMathFlags> FMF,
510 TTI::TargetCostKind CostKind) const override;
511
512 InstructionCost
513 getExtendedReductionCost(unsigned Opcode, bool IsUnsigned, Type *ResTy,
514 VectorType *ValTy, std::optional<FastMathFlags> FMF,
515 TTI::TargetCostKind CostKind) const override;
516
517 InstructionCost getMulAccReductionCost(
518 bool IsUnsigned, unsigned RedOpcode, Type *ResTy, VectorType *Ty,
519 TTI::TargetCostKind CostKind = TTI::TCK_RecipThroughput) const override;
520
521 InstructionCost
522 getShuffleCost(TTI::ShuffleKind Kind, VectorType *DstTy, VectorType *SrcTy,
523 TTI::TargetCostKind CostKind, ArrayRef<int> Mask, int Index,
524 VectorType *SubTp, ArrayRef<const Value *> Args = {},
525 const Instruction *CtxI = nullptr,
526 TTI::VectorInstrContext VIC =
527 TTI::VectorInstrContext::None) const override;
528
529 InstructionCost
530 getScalarizationOverhead(VectorType *Ty, const APInt &DemandedElts,
531 bool Insert, bool Extract,
532 TTI::TargetCostKind CostKind,
533 bool ForPoisonSrc = true, ArrayRef<Value *> VL = {},
534 TTI::VectorInstrContext VIC =
535 TTI::VectorInstrContext::None) const override;
536
537 /// Return the cost of the scaling factor used in the addressing
538 /// mode represented by AM for this target, for a load/store
539 /// of the specified type.
540 /// If the AM is supported, the return value must be >= 0.
541 /// If the AM is not supported, it returns an invalid cost.
542 InstructionCost getScalingFactorCost(Type *Ty, GlobalValue *BaseGV,
543 StackOffset BaseOffset, bool HasBaseReg,
544 int64_t Scale,
545 unsigned AddrSpace) const override;
546
547 bool LSRWithInstrQueries() const override { return true; }
548
549 bool enableSelectOptimize() const override {
550 return ST->enableSelectOptimize();
551 }
552
553 bool shouldTreatInstructionLikeSelect(const Instruction *I) const override;
554
555 unsigned getStoreMinimumVF(unsigned VF, Type *ScalarMemTy, Type *ScalarValTy,
556 Align Alignment,
557 unsigned AddrSpace) const override {
558 // We can vectorize store v4i8.
559 if (ScalarMemTy->isIntegerTy(BitWidth: 8) && isPowerOf2_32(Value: VF) && VF >= 4)
560 return 4;
561
562 return BaseT::getStoreMinimumVF(VF, ScalarMemTy, ScalarValTy, Alignment,
563 AddrSpace);
564 }
565
566 std::optional<unsigned> getMinPageSize() const override { return 4096; }
567
568 bool isLSRCostLess(const TargetTransformInfo::LSRCost &C1,
569 const TargetTransformInfo::LSRCost &C2) const override;
570
571 bool isProfitableToSinkOperands(Instruction *I, SmallVectorImpl<Use *> &Ops,
572 const LoopInfo *LI) const override;
573
574 bool enableAggressiveInterleaving(bool) const override {
575 return ST->enableAggressiveInterleaving();
576 }
577 /// @}
578
579 bool hasPossibleIncompatibleOps(const Function *F, bool ConsiderZA,
580 bool ConsiderZT, bool ConsiderSM) const;
581};
582
583} // end namespace llvm
584
585#endif // LLVM_LIB_TARGET_AARCH64_AARCH64TARGETTRANSFORMINFO_H
586