AMDGPU: Mark test as XFAIL in expensive_checks builds
[llvm-project.git] / llvm / lib / Target / SystemZ / SystemZTargetTransformInfo.h
blob512fcc854d532d15d5185cd889739a09e7ef7236
1 //===-- SystemZTargetTransformInfo.h - SystemZ-specific TTI ---------------===//
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 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZTARGETTRANSFORMINFO_H
10 #define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZTARGETTRANSFORMINFO_H
12 #include "SystemZTargetMachine.h"
13 #include "llvm/Analysis/TargetTransformInfo.h"
14 #include "llvm/CodeGen/BasicTTIImpl.h"
16 namespace llvm {
18 class SystemZTTIImpl : public BasicTTIImplBase<SystemZTTIImpl> {
19 typedef BasicTTIImplBase<SystemZTTIImpl> BaseT;
20 typedef TargetTransformInfo TTI;
21 friend BaseT;
23 const SystemZSubtarget *ST;
24 const SystemZTargetLowering *TLI;
26 const SystemZSubtarget *getST() const { return ST; }
27 const SystemZTargetLowering *getTLI() const { return TLI; }
29 unsigned const LIBCALL_COST = 30;
31 bool isInt128InVR(Type *Ty) { return Ty->isIntegerTy(128) && ST->hasVector(); }
33 public:
34 explicit SystemZTTIImpl(const SystemZTargetMachine *TM, const Function &F)
35 : BaseT(TM, F.getDataLayout()), ST(TM->getSubtargetImpl(F)),
36 TLI(ST->getTargetLowering()) {}
38 /// \name Scalar TTI Implementations
39 /// @{
41 unsigned adjustInliningThreshold(const CallBase *CB) const;
43 InstructionCost getIntImmCost(const APInt &Imm, Type *Ty,
44 TTI::TargetCostKind CostKind);
46 InstructionCost getIntImmCostInst(unsigned Opcode, unsigned Idx,
47 const APInt &Imm, Type *Ty,
48 TTI::TargetCostKind CostKind,
49 Instruction *Inst = nullptr);
50 InstructionCost getIntImmCostIntrin(Intrinsic::ID IID, unsigned Idx,
51 const APInt &Imm, Type *Ty,
52 TTI::TargetCostKind CostKind);
54 TTI::PopcntSupportKind getPopcntSupport(unsigned TyWidth);
56 void getUnrollingPreferences(Loop *L, ScalarEvolution &SE,
57 TTI::UnrollingPreferences &UP,
58 OptimizationRemarkEmitter *ORE);
60 void getPeelingPreferences(Loop *L, ScalarEvolution &SE,
61 TTI::PeelingPreferences &PP);
63 bool isLSRCostLess(const TargetTransformInfo::LSRCost &C1,
64 const TargetTransformInfo::LSRCost &C2);
65 /// @}
67 /// \name Vector TTI Implementations
68 /// @{
70 unsigned getNumberOfRegisters(unsigned ClassID) const;
71 TypeSize getRegisterBitWidth(TargetTransformInfo::RegisterKind K) const;
73 unsigned getCacheLineSize() const override { return 256; }
74 unsigned getPrefetchDistance() const override { return 4500; }
75 unsigned getMinPrefetchStride(unsigned NumMemAccesses,
76 unsigned NumStridedMemAccesses,
77 unsigned NumPrefetches,
78 bool HasCall) const override;
79 bool enableWritePrefetching() const override { return true; }
81 bool hasDivRemOp(Type *DataType, bool IsSigned);
82 bool prefersVectorizedAddressing() { return false; }
83 bool LSRWithInstrQueries() { return true; }
84 InstructionCost getScalarizationOverhead(VectorType *Ty,
85 const APInt &DemandedElts,
86 bool Insert, bool Extract,
87 TTI::TargetCostKind CostKind,
88 ArrayRef<Value *> VL = {});
89 bool supportsEfficientVectorElementLoadStore() { return true; }
90 bool enableInterleavedAccessVectorization() { return true; }
92 InstructionCost getArithmeticInstrCost(
93 unsigned Opcode, Type *Ty, TTI::TargetCostKind CostKind,
94 TTI::OperandValueInfo Op1Info = {TTI::OK_AnyValue, TTI::OP_None},
95 TTI::OperandValueInfo Op2Info = {TTI::OK_AnyValue, TTI::OP_None},
96 ArrayRef<const Value *> Args = {}, const Instruction *CxtI = nullptr);
97 InstructionCost getShuffleCost(TTI::ShuffleKind Kind, VectorType *Tp,
98 ArrayRef<int> Mask,
99 TTI::TargetCostKind CostKind, int Index,
100 VectorType *SubTp,
101 ArrayRef<const Value *> Args = {},
102 const Instruction *CxtI = nullptr);
103 unsigned getVectorTruncCost(Type *SrcTy, Type *DstTy);
104 unsigned getVectorBitmaskConversionCost(Type *SrcTy, Type *DstTy);
105 unsigned getBoolVecToIntConversionCost(unsigned Opcode, Type *Dst,
106 const Instruction *I);
107 InstructionCost getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src,
108 TTI::CastContextHint CCH,
109 TTI::TargetCostKind CostKind,
110 const Instruction *I = nullptr);
111 InstructionCost getCmpSelInstrCost(
112 unsigned Opcode, Type *ValTy, Type *CondTy, CmpInst::Predicate VecPred,
113 TTI::TargetCostKind CostKind,
114 TTI::OperandValueInfo Op1Info = {TTI::OK_AnyValue, TTI::OP_None},
115 TTI::OperandValueInfo Op2Info = {TTI::OK_AnyValue, TTI::OP_None},
116 const Instruction *I = nullptr);
117 using BaseT::getVectorInstrCost;
118 InstructionCost getVectorInstrCost(unsigned Opcode, Type *Val,
119 TTI::TargetCostKind CostKind,
120 unsigned Index, Value *Op0, Value *Op1);
121 bool isFoldableLoad(const LoadInst *Ld, const Instruction *&FoldedValue);
122 InstructionCost
123 getMemoryOpCost(unsigned Opcode, Type *Src, MaybeAlign Alignment,
124 unsigned AddressSpace, TTI::TargetCostKind CostKind,
125 TTI::OperandValueInfo OpInfo = {TTI::OK_AnyValue, TTI::OP_None},
126 const Instruction *I = nullptr);
128 InstructionCost getInterleavedMemoryOpCost(
129 unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef<unsigned> Indices,
130 Align Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind,
131 bool UseMaskForCond = false, bool UseMaskForGaps = false);
133 InstructionCost getArithmeticReductionCost(unsigned Opcode, VectorType *Ty,
134 std::optional<FastMathFlags> FMF,
135 TTI::TargetCostKind CostKind);
136 InstructionCost getMinMaxReductionCost(Intrinsic::ID IID, VectorType *Ty,
137 FastMathFlags FMF,
138 TTI::TargetCostKind CostKind);
140 InstructionCost getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
141 TTI::TargetCostKind CostKind);
143 bool shouldExpandReduction(const IntrinsicInst *II) const;
144 /// @}
147 } // end namespace llvm
149 #endif