LLVM  16.0.0git
RISCVTargetTransformInfo.h
Go to the documentation of this file.
1 //===- RISCVTargetTransformInfo.h - RISC-V 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 defines a TargetTransformInfo::Concept conforming object specific
10 /// to the RISC-V 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_RISCV_RISCVTARGETTRANSFORMINFO_H
17 #define LLVM_LIB_TARGET_RISCV_RISCVTARGETTRANSFORMINFO_H
18 
19 #include "RISCVSubtarget.h"
20 #include "RISCVTargetMachine.h"
24 #include "llvm/IR/Function.h"
25 #include <optional>
26 
27 namespace llvm {
28 
29 class RISCVTTIImpl : public BasicTTIImplBase<RISCVTTIImpl> {
31  using TTI = TargetTransformInfo;
32 
33  friend BaseT;
34 
35  const RISCVSubtarget *ST;
36  const RISCVTargetLowering *TLI;
37 
38  const RISCVSubtarget *getST() const { return ST; }
39  const RISCVTargetLowering *getTLI() const { return TLI; }
40 
41  /// This function returns an estimate for VL to be used in VL based terms
42  /// of the cost model. For fixed length vectors, this is simply the
43  /// vector length. For scalable vectors, we return results consistent
44  /// with getVScaleForTuning under the assumption that clients are also
45  /// using that when comparing costs between scalar and vector representation.
46  /// This does unfortunately mean that we can both undershoot and overshot
47  /// the true cost significantly if getVScaleForTuning is wildly off for the
48  /// actual target hardware.
49  unsigned getEstimatedVLFor(VectorType *Ty);
50 
51  /// Return the cost of LMUL. The larger the LMUL, the higher the cost.
52  InstructionCost getLMULCost(MVT VT);
53 
54 public:
55  explicit RISCVTTIImpl(const RISCVTargetMachine *TM, const Function &F)
56  : BaseT(TM, F.getParent()->getDataLayout()), ST(TM->getSubtargetImpl(F)),
57  TLI(ST->getTargetLowering()) {}
58 
59  /// Return the cost of materializing an immediate for a value operand of
60  /// a store instruction.
63 
66  InstructionCost getIntImmCostInst(unsigned Opcode, unsigned Idx,
67  const APInt &Imm, Type *Ty,
69  Instruction *Inst = nullptr);
71  const APInt &Imm, Type *Ty,
73 
75 
76  bool shouldExpandReduction(const IntrinsicInst *II) const;
77  bool supportsScalableVectors() const { return ST->hasVInstructions(); }
78  bool enableScalableVectorization() const { return ST->hasVInstructions(); }
80  return ST->hasVInstructions() ? PredicationStyle::Data
82  }
83  std::optional<unsigned> getMaxVScale() const;
84  std::optional<unsigned> getVScaleForTuning() const;
85 
87 
88  unsigned getRegUsageForType(Type *Ty);
89 
90  unsigned getMaximumVF(unsigned ElemWidth, unsigned Opcode) const;
91 
93  // Epilogue vectorization is usually unprofitable - tail folding or
94  // a smaller VF would have been better. This a blunt hammer - we
95  // should re-examine this once vectorization is better tuned.
96  return false;
97  }
98 
99  InstructionCost getMaskedMemoryOpCost(unsigned Opcode, Type *Src,
100  Align Alignment, unsigned AddressSpace,
102 
106 
109 
110  unsigned getMinVectorRegisterBitWidth() const {
111  return ST->useRVVForFixedLengthVectors() ? 16 : 0;
112  }
113 
118  VectorType *SubTp,
119  ArrayRef<const Value *> Args = std::nullopt);
120 
123 
124  InstructionCost getGatherScatterOpCost(unsigned Opcode, Type *DataTy,
125  const Value *Ptr, bool VariableMask,
126  Align Alignment,
128  const Instruction *I);
129 
130  InstructionCost getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src,
133  const Instruction *I = nullptr);
134 
136  bool IsUnsigned,
138 
140  std::optional<FastMathFlags> FMF,
142 
143  InstructionCost getExtendedReductionCost(unsigned Opcode, bool IsUnsigned,
144  Type *ResTy, VectorType *ValTy,
145  std::optional<FastMathFlags> FMF,
147 
149  getMemoryOpCost(unsigned Opcode, Type *Src, MaybeAlign Alignment,
152  const Instruction *I = nullptr);
153 
154  InstructionCost getCmpSelInstrCost(unsigned Opcode, Type *ValTy, Type *CondTy,
155  CmpInst::Predicate VecPred,
157  const Instruction *I = nullptr);
158 
160  InstructionCost getVectorInstrCost(unsigned Opcode, Type *Val,
161  unsigned Index);
162 
163  InstructionCost getArithmeticInstrCost(
164  unsigned Opcode, Type *Ty, TTI::TargetCostKind CostKind,
165  TTI::OperandValueInfo Op1Info = {TTI::OK_AnyValue, TTI::OP_None},
166  TTI::OperandValueInfo Op2Info = {TTI::OK_AnyValue, TTI::OP_None},
167  ArrayRef<const Value *> Args = ArrayRef<const Value *>(),
168  const Instruction *CxtI = nullptr);
169 
171  return TLI->isLegalElementTypeForRVV(Ty);
172  }
173 
174  bool isLegalMaskedLoadStore(Type *DataType, Align Alignment) {
175  if (!ST->hasVInstructions())
176  return false;
177 
178  // Only support fixed vectors if we know the minimum vector size.
179  if (isa<FixedVectorType>(DataType) && !ST->useRVVForFixedLengthVectors())
180  return false;
181 
182  // Don't allow elements larger than the ELEN.
183  // FIXME: How to limit for scalable vectors?
184  if (isa<FixedVectorType>(DataType) &&
185  DataType->getScalarSizeInBits() > ST->getELEN())
186  return false;
187 
188  if (Alignment <
190  return false;
191 
192  return TLI->isLegalElementTypeForRVV(DataType->getScalarType());
193  }
194 
195  bool isLegalMaskedLoad(Type *DataType, Align Alignment) {
196  return isLegalMaskedLoadStore(DataType, Alignment);
197  }
198  bool isLegalMaskedStore(Type *DataType, Align Alignment) {
199  return isLegalMaskedLoadStore(DataType, Alignment);
200  }
201 
202  bool isLegalMaskedGatherScatter(Type *DataType, Align Alignment) {
203  if (!ST->hasVInstructions())
204  return false;
205 
206  // Only support fixed vectors if we know the minimum vector size.
207  if (isa<FixedVectorType>(DataType) && !ST->useRVVForFixedLengthVectors())
208  return false;
209 
210  // Don't allow elements larger than the ELEN.
211  // FIXME: How to limit for scalable vectors?
212  if (isa<FixedVectorType>(DataType) &&
213  DataType->getScalarSizeInBits() > ST->getELEN())
214  return false;
215 
216  if (Alignment <
218  return false;
219 
220  return TLI->isLegalElementTypeForRVV(DataType->getScalarType());
221  }
222 
223  bool isLegalMaskedGather(Type *DataType, Align Alignment) {
224  return isLegalMaskedGatherScatter(DataType, Alignment);
225  }
226  bool isLegalMaskedScatter(Type *DataType, Align Alignment) {
227  return isLegalMaskedGatherScatter(DataType, Alignment);
228  }
229 
231  // Scalarize masked gather for RV64 if EEW=64 indices aren't supported.
232  return ST->is64Bit() && !ST->hasVInstructionsI64();
233  }
234 
236  // Scalarize masked scatter for RV64 if EEW=64 indices aren't supported.
237  return ST->is64Bit() && !ST->hasVInstructionsI64();
238  }
239 
240  /// \returns How the target needs this vector-predicated operation to be
241  /// transformed.
246  }
247 
249  ElementCount VF) const {
250  if (!VF.isScalable())
251  return true;
252 
253  Type *Ty = RdxDesc.getRecurrenceType();
254  if (!TLI->isLegalElementTypeForRVV(Ty))
255  return false;
256 
257  switch (RdxDesc.getRecurrenceKind()) {
258  case RecurKind::Add:
259  case RecurKind::FAdd:
260  case RecurKind::And:
261  case RecurKind::Or:
262  case RecurKind::Xor:
263  case RecurKind::SMin:
264  case RecurKind::SMax:
265  case RecurKind::UMin:
266  case RecurKind::UMax:
267  case RecurKind::FMin:
268  case RecurKind::FMax:
271  case RecurKind::FMulAdd:
272  return true;
273  default:
274  return false;
275  }
276  }
277 
278  unsigned getMaxInterleaveFactor(unsigned VF) {
279  // If the loop will not be vectorized, don't interleave the loop.
280  // Let regular unroll to unroll the loop.
281  return VF == 1 ? 1 : ST->getMaxInterleaveFactor();
282  }
283 
285  unsigned getNumberOfRegisters(unsigned ClassID) const {
286  switch (ClassID) {
287  case RISCVRegisterClass::GPRRC:
288  // 31 = 32 GPR - x0 (zero register)
289  // FIXME: Should we exclude fixed registers like SP, TP or GP?
290  return 31;
291  case RISCVRegisterClass::FPRRC:
292  if (ST->hasStdExtF())
293  return 32;
294  return 0;
295  case RISCVRegisterClass::VRRC:
296  // Although there are 32 vector registers, v0 is special in that it is the
297  // only register that can be used to hold a mask.
298  // FIXME: Should we conservatively return 31 as the number of usable
299  // vector registers?
300  return ST->hasVInstructions() ? 32 : 0;
301  }
302  llvm_unreachable("unknown register class");
303  }
304 
305  unsigned getRegisterClassForType(bool Vector, Type *Ty = nullptr) const {
306  if (Vector)
307  return RISCVRegisterClass::VRRC;
308  if (!Ty)
309  return RISCVRegisterClass::GPRRC;
310 
311  Type *ScalarTy = Ty->getScalarType();
312  if ((ScalarTy->isHalfTy() && ST->hasStdExtZfhOrZfhmin()) ||
313  (ScalarTy->isFloatTy() && ST->hasStdExtF()) ||
314  (ScalarTy->isDoubleTy() && ST->hasStdExtD())) {
315  return RISCVRegisterClass::FPRRC;
316  }
317 
318  return RISCVRegisterClass::GPRRC;
319  }
320 
321  const char *getRegisterClassName(unsigned ClassID) const {
322  switch (ClassID) {
323  case RISCVRegisterClass::GPRRC:
324  return "RISCV::GPRRC";
325  case RISCVRegisterClass::FPRRC:
326  return "RISCV::FPRRC";
327  case RISCVRegisterClass::VRRC:
328  return "RISCV::VRRC";
329  }
330  llvm_unreachable("unknown register class");
331  }
332 };
333 
334 } // end namespace llvm
335 
336 #endif // LLVM_LIB_TARGET_RISCV_RISCVTARGETTRANSFORMINFO_H
llvm::RISCVTTIImpl::getRegUsageForType
unsigned getRegUsageForType(Type *Ty)
Definition: RISCVTargetTransformInfo.cpp:1316
llvm::InstructionCost
Definition: InstructionCost.h:29
llvm::BasicTTIImplBase< RISCVTTIImpl >::DL
const DataLayout & DL
Definition: TargetTransformInfoImpl.h:38
llvm::TargetTransformInfo::TargetCostKind
TargetCostKind
The kind of cost model.
Definition: TargetTransformInfo.h:218
llvm::RISCVTTIImpl::shouldExpandReduction
bool shouldExpandReduction(const IntrinsicInst *II) const
Definition: RISCVTargetTransformInfo.cpp:186
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::RISCVTTIImpl::getIntrinsicInstrCost
InstructionCost getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA, TTI::TargetCostKind CostKind)
Definition: RISCVTargetTransformInfo.cpp:693
llvm::RISCVTTIImpl::getIntImmCostIntrin
InstructionCost getIntImmCostIntrin(Intrinsic::ID IID, unsigned Idx, const APInt &Imm, Type *Ty, TTI::TargetCostKind CostKind)
Definition: RISCVTargetTransformInfo.cpp:173
llvm::RISCVTTIImpl::getPopcntSupport
TargetTransformInfo::PopcntSupportKind getPopcntSupport(unsigned TyWidth)
Definition: RISCVTargetTransformInfo.cpp:181
llvm::RecurKind::Or
@ Or
Bitwise or logical OR of integers.
llvm::RISCVTTIImpl::getMinMaxReductionCost
InstructionCost getMinMaxReductionCost(VectorType *Ty, VectorType *CondTy, bool IsUnsigned, TTI::TargetCostKind CostKind)
Definition: RISCVTargetTransformInfo.cpp:864
llvm::RISCVTTIImpl
Definition: RISCVTargetTransformInfo.h:29
llvm::RISCVTTIImpl::getArithmeticInstrCost
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=ArrayRef< const Value * >(), const Instruction *CxtI=nullptr)
Definition: RISCVTargetTransformInfo.cpp:1156
llvm::CmpInst::Predicate
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
Definition: InstrTypes.h:719
llvm::RISCVTTIImpl::RISCVTTIImpl
RISCVTTIImpl(const RISCVTargetMachine *TM, const Function &F)
Definition: RISCVTargetTransformInfo.h:55
llvm::ElementCount
Definition: TypeSize.h:404
llvm::TypeSize::getFixedSize
ScalarTy getFixedSize() const
Definition: TypeSize.h:444
llvm::Function
Definition: Function.h:60
llvm::Loop
Represents a single loop in the control flow graph.
Definition: LoopInfo.h:547
llvm::RISCVTTIImpl::getMaskedMemoryOpCost
InstructionCost getMaskedMemoryOpCost(unsigned Opcode, Type *Src, Align Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind)
Definition: RISCVTargetTransformInfo.cpp:321
llvm::TargetTransformInfo::PopcntSupportKind
PopcntSupportKind
Flags indicating the kind of support for population count.
Definition: TargetTransformInfo.h:585
llvm::Type::getScalarType
Type * getScalarType() const
If this is a vector type, return the element type, otherwise return 'this'.
Definition: Type.h:328
llvm::DataLayout::getTypeStoreSize
TypeSize getTypeStoreSize(Type *Ty) const
Returns the maximum number of bytes that may be overwritten by storing the specified type.
Definition: DataLayout.h:474
llvm::TargetTransformInfo
This pass provides access to the codegen interfaces that are needed for IR-level transformations.
Definition: TargetTransformInfo.h:173
llvm::ScalarEvolution
The main scalar evolution driver.
Definition: ScalarEvolution.h:449
llvm::RISCVTTIImpl::getShuffleCost
InstructionCost getShuffleCost(TTI::ShuffleKind Kind, VectorType *Tp, ArrayRef< int > Mask, TTI::TargetCostKind CostKind, int Index, VectorType *SubTp, ArrayRef< const Value * > Args=std::nullopt)
Definition: RISCVTargetTransformInfo.cpp:244
llvm::RISCVTTIImpl::getVectorInstrCost
InstructionCost getVectorInstrCost(unsigned Opcode, Type *Val, unsigned Index)
Definition: RISCVTargetTransformInfo.cpp:1063
llvm::RISCVTTIImpl::isLegalMaskedScatter
bool isLegalMaskedScatter(Type *DataType, Align Alignment)
Definition: RISCVTargetTransformInfo.h:226
llvm::RISCVTargetMachine
Definition: RISCVTargetMachine.h:24
llvm::TargetTransformInfo::VPLegalization
Definition: TargetTransformInfo.h:1515
llvm::RISCVTTIImpl::getArithmeticReductionCost
InstructionCost getArithmeticReductionCost(unsigned Opcode, VectorType *Ty, std::optional< FastMathFlags > FMF, TTI::TargetCostKind CostKind)
Definition: RISCVTargetTransformInfo.cpp:887
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
llvm::TargetTransformInfo::PeelingPreferences
Definition: TargetTransformInfo.h:529
llvm::RISCVTTIImpl::isLegalMaskedGather
bool isLegalMaskedGather(Type *DataType, Align Alignment)
Definition: RISCVTargetTransformInfo.h:223
llvm::RISCVTTIImpl::getNumberOfRegisters
unsigned getNumberOfRegisters(unsigned ClassID) const
Definition: RISCVTargetTransformInfo.h:285
Vector
So we should use XX3Form_Rcr to implement intrinsic Convert DP outs ins xscvdpsp No builtin are required Round &Convert QP DP(dword[1] is set to zero) No builtin are required Round to Quad Precision because you need to assign rounding mode in instruction Provide builtin(set f128:$vT,(int_ppc_vsx_xsrqpi f128:$vB))(set f128 yields< n x< ty > >< result > yields< ty >< result > No builtin are required Load Store Vector
Definition: README_P9.txt:497
llvm::RecurKind::SelectFCmp
@ SelectFCmp
Integer select(fcmp(),x,y) where one of (x,y) is loop invariant.
llvm::RISCVTTIImpl::isElementTypeLegalForScalableVector
bool isElementTypeLegalForScalableVector(Type *Ty) const
Definition: RISCVTargetTransformInfo.h:170
llvm::RISCVTTIImpl::getIntImmCost
InstructionCost getIntImmCost(const APInt &Imm, Type *Ty, TTI::TargetCostKind CostKind)
Definition: RISCVTargetTransformInfo.cpp:56
llvm::RecurKind::SMin
@ SMin
Signed integer min implemented in terms of select(cmp()).
llvm::TargetTransformInfo::OperandValueInfo
Definition: TargetTransformInfo.h:926
llvm::RISCVTTIImpl::getMemoryOpCost
InstructionCost getMemoryOpCost(unsigned Opcode, Type *Src, MaybeAlign Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind, TTI::OperandValueInfo OpdInfo={TTI::OK_AnyValue, TTI::OP_None}, const Instruction *I=nullptr)
Definition: RISCVTargetTransformInfo.cpp:967
llvm::RISCVTTIImpl::getMinVectorRegisterBitWidth
unsigned getMinVectorRegisterBitWidth() const
Definition: RISCVTargetTransformInfo.h:110
llvm::LinearPolySize::isScalable
bool isScalable() const
Returns whether the size is scaled by a runtime quantity (vscale).
Definition: TypeSize.h:298
F
#define F(x, y, z)
Definition: MD5.cpp:55
llvm::RISCVTTIImpl::preferEpilogueVectorization
bool preferEpilogueVectorization() const
Definition: RISCVTargetTransformInfo.h:92
llvm::TargetTransformInfoImplBase::getDataLayout
const DataLayout & getDataLayout() const
Definition: TargetTransformInfoImpl.h:47
llvm::BitmaskEnumDetail::Mask
constexpr std::underlying_type_t< E > Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
Definition: BitmaskEnum.h:80
llvm::RISCVTTIImpl::getPeelingPreferences
void getPeelingPreferences(Loop *L, ScalarEvolution &SE, TTI::PeelingPreferences &PP)
Definition: RISCVTargetTransformInfo.cpp:1311
llvm::RISCVTargetLowering::isLegalElementTypeForRVV
bool isLegalElementTypeForRVV(Type *ScalarTy) const
Definition: RISCVISelLowering.cpp:1707
llvm::RecurKind::And
@ And
Bitwise or logical AND of integers.
llvm::RISCVTTIImpl::getRegisterBitWidth
TypeSize getRegisterBitWidth(TargetTransformInfo::RegisterKind K) const
Definition: RISCVTargetTransformInfo.cpp:215
llvm::BasicTTIImplBase< RISCVTTIImpl >::getVectorInstrCost
InstructionCost getVectorInstrCost(unsigned Opcode, Type *Val, unsigned Index)
Definition: BasicTTIImpl.h:1187
llvm::TargetTransformInfo::OP_None
@ OP_None
Definition: TargetTransformInfo.h:918
llvm::TargetTransformInfo::ShuffleKind
ShuffleKind
The various kinds of shuffle patterns for vector queries.
Definition: TargetTransformInfo.h:889
llvm::TargetTransformInfo::CastContextHint
CastContextHint
Represents a hint about the context in which a cast is used.
Definition: TargetTransformInfo.h:1142
llvm::RISCVTTIImpl::getSpliceCost
InstructionCost getSpliceCost(VectorType *Tp, int Index)
Definition: RISCVTargetTransformInfo.cpp:235
llvm::RecurrenceDescriptor::getRecurrenceType
Type * getRecurrenceType() const
Returns the type of the recurrence.
Definition: IVDescriptors.h:245
llvm::RISCVTTIImpl::supportsScalableVectors
bool supportsScalableVectors() const
Definition: RISCVTargetTransformInfo.h:77
llvm::dwarf::Index
Index
Definition: Dwarf.h:490
llvm::MaybeAlign
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.
Definition: Alignment.h:117
llvm::Instruction
Definition: Instruction.h:42
llvm::Type::getScalarSizeInBits
unsigned getScalarSizeInBits() const LLVM_READONLY
If this is a vector type, return the getPrimitiveSizeInBits value for the element type.
Definition: Type.cpp:188
llvm::RecurrenceDescriptor::getRecurrenceKind
RecurKind getRecurrenceKind() const
Definition: IVDescriptors.h:198
llvm::RISCVTTIImpl::getMaxInterleaveFactor
unsigned getMaxInterleaveFactor(unsigned VF)
Definition: RISCVTargetTransformInfo.h:278
llvm::Align
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition: Alignment.h:39
llvm::AddressSpace
AddressSpace
Definition: NVPTXBaseInfo.h:21
IVDescriptors.h
llvm::RISCVTTIImpl::isLegalMaskedStore
bool isLegalMaskedStore(Type *DataType, Align Alignment)
Definition: RISCVTargetTransformInfo.h:198
llvm::IntrinsicCostAttributes
Definition: TargetTransformInfo.h:120
llvm::RecurKind::UMin
@ UMin
Unisgned integer min implemented in terms of select(cmp()).
llvm::RISCVTTIImpl::getGatherScatterOpCost
InstructionCost getGatherScatterOpCost(unsigned Opcode, Type *DataTy, const Value *Ptr, bool VariableMask, Align Alignment, TTI::TargetCostKind CostKind, const Instruction *I)
Definition: RISCVTargetTransformInfo.cpp:332
llvm::VectorType
Base class of all SIMD vector types.
Definition: DerivedTypes.h:389
llvm::RISCVTTIImpl::forceScalarizeMaskedGather
bool forceScalarizeMaskedGather(VectorType *VTy, Align Alignment)
Definition: RISCVTargetTransformInfo.h:230
Index
uint32_t Index
Definition: ELFObjHandler.cpp:83
llvm::RISCVTTIImpl::isLegalToVectorizeReduction
bool isLegalToVectorizeReduction(const RecurrenceDescriptor &RdxDesc, ElementCount VF) const
Definition: RISCVTargetTransformInfo.h:248
llvm::RISCVTTIImpl::getVScaleForTuning
std::optional< unsigned > getVScaleForTuning() const
Definition: RISCVTargetTransformInfo.cpp:206
llvm::TargetTransformInfo::UnrollingPreferences
Parameters that control the generic loop unrolling transformation.
Definition: TargetTransformInfo.h:417
I
#define I(x, y, z)
Definition: MD5.cpp:58
llvm::RecurKind::Add
@ Add
Sum of integers.
llvm::RISCVTTIImpl::getRegisterClassName
const char * getRegisterClassName(unsigned ClassID) const
Definition: RISCVTargetTransformInfo.h:321
llvm::BasicTTIImplBase
Base class which can be used to help build a TTI implementation.
Definition: BasicTTIImpl.h:79
llvm::RISCVTTIImpl::isLegalMaskedLoadStore
bool isLegalMaskedLoadStore(Type *DataType, Align Alignment)
Definition: RISCVTargetTransformInfo.h:174
llvm::RISCVTTIImpl::getVPLegalizationStrategy
TargetTransformInfo::VPLegalization getVPLegalizationStrategy(const VPIntrinsic &PI) const
Definition: RISCVTargetTransformInfo.h:243
llvm::Type::isHalfTy
bool isHalfTy() const
Return true if this is 'half', a 16-bit IEEE fp type.
Definition: Type.h:142
llvm::RISCVSubtarget
Definition: RISCVSubtarget.h:35
llvm::RISCVTTIImpl::getUnrollingPreferences
void getUnrollingPreferences(Loop *L, ScalarEvolution &SE, TTI::UnrollingPreferences &UP, OptimizationRemarkEmitter *ORE)
Definition: RISCVTargetTransformInfo.cpp:1233
llvm::RISCVTTIImpl::getCastInstrCost
InstructionCost getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src, TTI::CastContextHint CCH, TTI::TargetCostKind CostKind, const Instruction *I=nullptr)
Definition: RISCVTargetTransformInfo.cpp:776
llvm::RISCVTTIImpl::emitGetActiveLaneMask
PredicationStyle emitGetActiveLaneMask() const
Definition: RISCVTargetTransformInfo.h:79
Ptr
@ Ptr
Definition: TargetLibraryInfo.cpp:60
llvm::MVT
Machine Value Type.
Definition: MachineValueType.h:31
llvm::RISCVTTIImpl::isLegalMaskedGatherScatter
bool isLegalMaskedGatherScatter(Type *DataType, Align Alignment)
Definition: RISCVTargetTransformInfo.h:202
llvm::APInt
Class for arbitrary precision integers.
Definition: APInt.h:76
llvm::RecurKind::UMax
@ UMax
Unsigned integer max implemented in terms of select(cmp()).
llvm::RISCVTTIImpl::getCmpSelInstrCost
InstructionCost getCmpSelInstrCost(unsigned Opcode, Type *ValTy, Type *CondTy, CmpInst::Predicate VecPred, TTI::TargetCostKind CostKind, const Instruction *I=nullptr)
Definition: RISCVTargetTransformInfo.cpp:980
llvm::ArrayRef< int >
llvm::OptimizationRemarkEmitter
The optimization diagnostic interface.
Definition: OptimizationRemarkEmitter.h:33
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:143
CostKind
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")))
getParent
static const Function * getParent(const Value *V)
Definition: BasicAliasAnalysis.cpp:805
llvm::RISCVTTIImpl::RISCVRegisterClass
RISCVRegisterClass
Definition: RISCVTargetTransformInfo.h:284
llvm::RecurKind::FMax
@ FMax
FP max implemented in terms of select(cmp()).
llvm::TargetTransformInfo::OK_AnyValue
@ OK_AnyValue
Definition: TargetTransformInfo.h:910
llvm::RISCVTTIImpl::VRRC
@ VRRC
Definition: RISCVTargetTransformInfo.h:284
llvm::RISCVTTIImpl::getRegisterClassForType
unsigned getRegisterClassForType(bool Vector, Type *Ty=nullptr) const
Definition: RISCVTargetTransformInfo.h:305
llvm::RecurKind::FMulAdd
@ FMulAdd
Fused multiply-add of floats (a * b + c).
llvm::Type::isFloatTy
bool isFloatTy() const
Return true if this is 'float', a 32-bit IEEE fp type.
Definition: Type.h:153
llvm::VPIntrinsic
This is the common base class for vector predication intrinsics.
Definition: IntrinsicInst.h:476
VPLegalization
TargetTransformInfo::VPLegalization VPLegalization
Definition: ExpandVectorPredication.cpp:36
llvm::TypeSize
Definition: TypeSize.h:435
Function.h
llvm::Type::isDoubleTy
bool isDoubleTy() const
Return true if this is 'double', a 64-bit IEEE fp type.
Definition: Type.h:156
llvm::RISCVTTIImpl::enableScalableVectorization
bool enableScalableVectorization() const
Definition: RISCVTargetTransformInfo.h:78
llvm::RISCVTargetLowering
Definition: RISCVISelLowering.h:335
llvm::PredicationStyle
PredicationStyle
Definition: TargetTransformInfo.h:166
llvm::RISCVTTIImpl::isLegalMaskedLoad
bool isLegalMaskedLoad(Type *DataType, Align Alignment)
Definition: RISCVTargetTransformInfo.h:195
llvm::IntrinsicInst
A wrapper class for inspecting calls to intrinsic functions.
Definition: IntrinsicInst.h:47
llvm::RISCVMatInt::Imm
@ Imm
Definition: RISCVMatInt.h:23
RISCVSubtarget.h
llvm::RecurrenceDescriptor
The RecurrenceDescriptor is used to identify recurrences variables in a loop.
Definition: IVDescriptors.h:69
llvm::RISCVTTIImpl::getStoreImmCost
InstructionCost getStoreImmCost(Type *VecTy, TTI::OperandValueInfo OpInfo, TTI::TargetCostKind CostKind)
Return the cost of materializing an immediate for a value operand of a store instruction.
Definition: RISCVTargetTransformInfo.cpp:943
llvm::RecurKind::SelectICmp
@ SelectICmp
Integer select(icmp(),x,y) where one of (x,y) is loop invariant.
llvm::RecurKind::FAdd
@ FAdd
Sum of floats.
llvm::TargetTransformInfo::RegisterKind
RegisterKind
Definition: TargetTransformInfo.h:967
llvm::TargetTransformInfo::VPLegalization::Legal
@ Legal
Definition: TargetTransformInfo.h:1518
TargetTransformInfo.h
llvm::RISCVTTIImpl::GPRRC
@ GPRRC
Definition: RISCVTargetTransformInfo.h:284
llvm::RISCVTTIImpl::getMaxVScale
std::optional< unsigned > getMaxVScale() const
Definition: RISCVTargetTransformInfo.cpp:200
TM
const char LLVMTargetMachineRef TM
Definition: PassBuilderBindings.cpp:47
llvm::RecurKind::FMin
@ FMin
FP min implemented in terms of select(cmp()).
llvm::RISCVTTIImpl::forceScalarizeMaskedScatter
bool forceScalarizeMaskedScatter(VectorType *VTy, Align Alignment)
Definition: RISCVTargetTransformInfo.h:235
llvm::AMDGPU::HSAMD::Kernel::Key::Args
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
Definition: AMDGPUMetadata.h:394
BasicTTIImpl.h
llvm::RISCVTTIImpl::getMaximumVF
unsigned getMaximumVF(unsigned ElemWidth, unsigned Opcode) const
Definition: RISCVTargetTransformInfo.cpp:1329
llvm::RISCVTTIImpl::getExtendedReductionCost
InstructionCost getExtendedReductionCost(unsigned Opcode, bool IsUnsigned, Type *ResTy, VectorType *ValTy, std::optional< FastMathFlags > FMF, TTI::TargetCostKind CostKind)
Definition: RISCVTargetTransformInfo.cpp:917
llvm::RecurKind::SMax
@ SMax
Signed integer max implemented in terms of select(cmp()).
llvm::PredicationStyle::None
@ None
llvm::Value
LLVM Value Representation.
Definition: Value.h:74
llvm::RISCVTTIImpl::FPRRC
@ FPRRC
Definition: RISCVTargetTransformInfo.h:284
llvm::Data
@ Data
llvm::RISCVTTIImpl::getIntImmCostInst
InstructionCost getIntImmCostInst(unsigned Opcode, unsigned Idx, const APInt &Imm, Type *Ty, TTI::TargetCostKind CostKind, Instruction *Inst=nullptr)
Definition: RISCVTargetTransformInfo.cpp:98
llvm::RecurKind::Xor
@ Xor
Bitwise or logical XOR of integers.
llvm::Intrinsic::ID
unsigned ID
Definition: TargetTransformInfo.h:39
RISCVTargetMachine.h