clang  16.0.0git
RISCVVIntrinsicUtils.h
Go to the documentation of this file.
1 //===--- RISCVVIntrinsicUtils.h - RISC-V Vector Intrinsic Utils -*- 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 
9 #ifndef CLANG_SUPPORT_RISCVVINTRINSICUTILS_H
10 #define CLANG_SUPPORT_RISCVVINTRINSICUTILS_H
11 
12 #include "llvm/ADT/ArrayRef.h"
13 #include "llvm/ADT/BitmaskEnum.h"
14 #include "llvm/ADT/Optional.h"
15 #include "llvm/ADT/SmallVector.h"
16 #include "llvm/ADT/StringRef.h"
17 #include <cstdint>
18 #include <set>
19 #include <string>
20 #include <unordered_map>
21 #include <vector>
22 
23 namespace llvm {
24 class raw_ostream;
25 } // end namespace llvm
26 
27 namespace clang {
28 namespace RISCV {
29 
31 
32 // Modifier for vector type.
33 enum class VectorTypeModifier : uint8_t {
34  NoModifier,
38  MaskVector,
39  Log2EEW3,
40  Log2EEW4,
41  Log2EEW5,
42  Log2EEW6,
43  FixedSEW8,
44  FixedSEW16,
45  FixedSEW32,
46  FixedSEW64,
61 };
62 
63 // Similar to basic type but used to describe what's kind of type related to
64 // basic vector type, used to compute type info of arguments.
65 enum class BaseTypeModifier : uint8_t {
66  Invalid,
67  Scalar,
68  Vector,
69  Void,
70  SizeT,
71  Ptrdiff,
73  SignedLong,
74 };
75 
76 // Modifier for type, used for both scalar and vector types.
77 enum class TypeModifier : uint8_t {
78  NoModifier = 0,
79  Pointer = 1 << 0,
80  Const = 1 << 1,
81  Immediate = 1 << 2,
82  UnsignedInteger = 1 << 3,
83  SignedInteger = 1 << 4,
84  Float = 1 << 5,
85  // LMUL1 should be kind of VectorTypeModifier, but that might come with
86  // Widening2XVector for widening reduction.
87  // However that might require VectorTypeModifier become bitmask rather than
88  // simple enum, so we decide keek LMUL1 in TypeModifier for code size
89  // optimization of clang binary size.
90  LMUL1 = 1 << 6,
91  MaxOffset = 6,
93 };
94 
95 // The Lowerest two bit equal to policy value.
96 enum Policy : uint8_t {
97  TU = 0, // For unmasked TU, last two bit is TUMU
98  TA = 1, // // For unmasked TA, last two bit is TAMU
99  TUMA = 2,
100  TAMA = 3,
101  TUMU = 4,
102  TAMU = 5,
103  MU = 6, // For masked MU, last two bit is TAMU
104  MA = 7, // For masked MA, last two bit is TAMA
105  TUM = 10, // For masked MA, last two bit is TUMA
106  TAM = 11, // For masked MA, last two bit is TAMA
108 };
109 
110 // PrototypeDescriptor is used to compute type info of arguments or return
111 // value.
113  constexpr PrototypeDescriptor() = default;
118  : PT(static_cast<uint8_t>(PT)), VTM(static_cast<uint8_t>(VTM)),
119  TM(static_cast<uint8_t>(TM)) {}
120  constexpr PrototypeDescriptor(uint8_t PT, uint8_t VTM, uint8_t TM)
121  : PT(PT), VTM(VTM), TM(TM) {}
122 
123  uint8_t PT = static_cast<uint8_t>(BaseTypeModifier::Invalid);
124  uint8_t VTM = static_cast<uint8_t>(VectorTypeModifier::NoModifier);
125  uint8_t TM = static_cast<uint8_t>(TypeModifier::NoModifier);
126 
127  bool operator!=(const PrototypeDescriptor &PD) const {
128  return !(*this == PD);
129  }
130  bool operator==(const PrototypeDescriptor &PD) const {
131  return PD.PT == PT && PD.VTM == VTM && PD.TM == TM;
132  }
133  bool operator<(const PrototypeDescriptor &PD) const {
134  return std::tie(PT, VTM, TM) < std::tie(PD.PT, PD.VTM, PD.TM);
135  }
136  static const PrototypeDescriptor Mask;
138  static const PrototypeDescriptor VL;
140  parsePrototypeDescriptor(llvm::StringRef PrototypeStr);
141 };
142 
144 parsePrototypes(llvm::StringRef Prototypes);
145 
146 // Basic type of vector type.
147 enum class BasicType : uint8_t {
148  Unknown = 0,
149  Int8 = 1 << 0,
150  Int16 = 1 << 1,
151  Int32 = 1 << 2,
152  Int64 = 1 << 3,
153  Float16 = 1 << 4,
154  Float32 = 1 << 5,
155  Float64 = 1 << 6,
156  MaxOffset = 6,
158 };
159 
160 // Type of vector type.
161 enum ScalarTypeKind : uint8_t {
172 };
173 
174 // Exponential LMUL
175 struct LMULType {
176  int Log2LMUL;
177  LMULType(int Log2LMUL);
178  // Return the C/C++ string representation of LMUL
179  std::string str() const;
180  llvm::Optional<unsigned> getScale(unsigned ElementBitwidth) const;
181  void MulLog2LMUL(int Log2LMUL);
182 };
183 
184 class RVVType;
185 using RVVTypePtr = RVVType *;
186 using RVVTypes = std::vector<RVVTypePtr>;
187 class RVVTypeCache;
188 
189 // This class is compact representation of a valid and invalid RVVType.
190 class RVVType {
191  friend class RVVTypeCache;
192 
193  BasicType BT;
194  ScalarTypeKind ScalarType = Invalid;
195  LMULType LMUL;
196  bool IsPointer = false;
197  // IsConstant indices are "int", but have the constant expression.
198  bool IsImmediate = false;
199  // Const qualifier for pointer to const object or object of const type.
200  bool IsConstant = false;
201  unsigned ElementBitwidth = 0;
202  VScaleVal Scale = 0;
203  bool Valid;
204 
205  std::string BuiltinStr;
206  std::string ClangBuiltinStr;
207  std::string Str;
208  std::string ShortStr;
209 
210  enum class FixedLMULType { LargerThan, SmallerThan };
211 
212  RVVType(BasicType BT, int Log2LMUL, const PrototypeDescriptor &Profile);
213 
214 public:
215  // Return the string representation of a type, which is an encoded string for
216  // passing to the BUILTIN() macro in Builtins.def.
217  const std::string &getBuiltinStr() const { return BuiltinStr; }
218 
219  // Return the clang builtin type for RVV vector type which are used in the
220  // riscv_vector.h header file.
221  const std::string &getClangBuiltinStr() const { return ClangBuiltinStr; }
222 
223  // Return the C/C++ string representation of a type for use in the
224  // riscv_vector.h header file.
225  const std::string &getTypeStr() const { return Str; }
226 
227  // Return the short name of a type for C/C++ name suffix.
229  // Not all types are used in short name, so compute the short name by
230  // demanded.
231  if (ShortStr.empty())
232  initShortStr();
233  return ShortStr;
234  }
235 
236  bool isValid() const { return Valid; }
237  bool isScalar() const { return Scale && Scale.value() == 0; }
238  bool isVector() const { return Scale && Scale.value() != 0; }
239  bool isVector(unsigned Width) const {
240  return isVector() && ElementBitwidth == Width;
241  }
242  bool isFloat() const { return ScalarType == ScalarTypeKind::Float; }
243  bool isSignedInteger() const {
244  return ScalarType == ScalarTypeKind::SignedInteger;
245  }
246  bool isFloatVector(unsigned Width) const {
247  return isVector() && isFloat() && ElementBitwidth == Width;
248  }
249  bool isFloat(unsigned Width) const {
250  return isFloat() && ElementBitwidth == Width;
251  }
252  bool isConstant() const { return IsConstant; }
253  bool isPointer() const { return IsPointer; }
254  unsigned getElementBitwidth() const { return ElementBitwidth; }
255 
256  ScalarTypeKind getScalarType() const { return ScalarType; }
257  VScaleVal getScale() const { return Scale; }
258 
259 private:
260  // Verify RVV vector type and set Valid.
261  bool verifyType() const;
262 
263  // Creates a type based on basic types of TypeRange
264  void applyBasicType();
265 
266  // Applies a prototype modifier to the current type. The result maybe an
267  // invalid type.
268  void applyModifier(const PrototypeDescriptor &prototype);
269 
270  void applyLog2EEW(unsigned Log2EEW);
271  void applyFixedSEW(unsigned NewSEW);
272  void applyFixedLog2LMUL(int Log2LMUL, enum FixedLMULType Type);
273 
274  // Compute and record a string for legal type.
275  void initBuiltinStr();
276  // Compute and record a builtin RVV vector type string.
277  void initClangBuiltinStr();
278  // Compute and record a type string for used in the header.
279  void initTypeStr();
280  // Compute and record a short name of a type for C/C++ name suffix.
281  void initShortStr();
282 };
283 
284 // This class is used to manage RVVType, RVVType should only created by this
285 // class, also provided thread-safe cache capability.
287 private:
288  std::unordered_map<uint64_t, RVVType> LegalTypes;
289  std::set<uint64_t> IllegalTypes;
290 
291 public:
292  /// Compute output and input types by applying different config (basic type
293  /// and LMUL with type transformers). It also record result of type in legal
294  /// or illegal set to avoid compute the same config again. The result maybe
295  /// have illegal RVVType.
297  computeTypes(BasicType BT, int Log2LMUL, unsigned NF,
300  PrototypeDescriptor Proto);
301 };
302 
303 enum PolicyScheme : uint8_t {
305  // Passthru operand is at first parameter in C builtin.
308  // Special case for vmerge, the passthru operand is second
309  // parameter in C builtin.
311 };
312 
313 // TODO refactor RVVIntrinsic class design after support all intrinsic
314 // combination. This represents an instantiation of an intrinsic with a
315 // particular type and prototype
317 
318 private:
319  std::string BuiltinName; // Builtin name
320  std::string Name; // C intrinsic name.
321  std::string OverloadedName;
322  std::string IRName;
323  bool IsMasked;
324  bool HasMaskedOffOperand;
325  bool HasVL;
326  PolicyScheme Scheme;
327  bool SupportOverloading;
328  bool HasBuiltinAlias;
329  std::string ManualCodegen;
330  RVVTypePtr OutputType; // Builtin output type
331  RVVTypes InputTypes; // Builtin input types
332  // The types we use to obtain the specific LLVM intrinsic. They are index of
333  // InputTypes. -1 means the return type.
334  std::vector<int64_t> IntrinsicTypes;
335  unsigned NF = 1;
336  Policy DefaultPolicy = Policy::PolicyNone;
337 
338 public:
339  RVVIntrinsic(llvm::StringRef Name, llvm::StringRef Suffix,
340  llvm::StringRef OverloadedName, llvm::StringRef OverloadedSuffix,
341  llvm::StringRef IRName, bool IsMasked, bool HasMaskedOffOperand,
342  bool HasVL, PolicyScheme Scheme, bool SupportOverloading,
343  bool HasBuiltinAlias, llvm::StringRef ManualCodegen,
344  const RVVTypes &Types,
345  const std::vector<int64_t> &IntrinsicTypes,
346  const std::vector<llvm::StringRef> &RequiredFeatures,
347  unsigned NF, Policy DefaultPolicy, bool IsPrototypeDefaultTU);
348  ~RVVIntrinsic() = default;
349 
350  RVVTypePtr getOutputType() const { return OutputType; }
351  const RVVTypes &getInputTypes() const { return InputTypes; }
352  llvm::StringRef getBuiltinName() const { return BuiltinName; }
353  llvm::StringRef getName() const { return Name; }
354  llvm::StringRef getOverloadedName() const { return OverloadedName; }
355  bool hasMaskedOffOperand() const { return HasMaskedOffOperand; }
356  bool hasVL() const { return HasVL; }
357  bool hasPolicy() const { return Scheme != PolicyScheme::SchemeNone; }
358  bool hasPassthruOperand() const {
359  return Scheme == PolicyScheme::HasPassthruOperand;
360  }
361  bool hasPolicyOperand() const {
362  return Scheme == PolicyScheme::HasPolicyOperand;
363  }
364  bool supportOverloading() const { return SupportOverloading; }
365  bool hasBuiltinAlias() const { return HasBuiltinAlias; }
366  bool hasManualCodegen() const { return !ManualCodegen.empty(); }
367  bool isMasked() const { return IsMasked; }
368  llvm::StringRef getIRName() const { return IRName; }
369  llvm::StringRef getManualCodegen() const { return ManualCodegen; }
370  PolicyScheme getPolicyScheme() const { return Scheme; }
371  unsigned getNF() const { return NF; }
372  const std::vector<int64_t> &getIntrinsicTypes() const {
373  return IntrinsicTypes;
374  }
376  assert(DefaultPolicy != Policy::PolicyNone);
377  return DefaultPolicy;
378  }
379  unsigned getDefaultPolicyBits() const {
380  assert(DefaultPolicy != Policy::PolicyNone);
381  return static_cast<unsigned>(DefaultPolicy) & 3;
382  }
383 
384  // Return the type string for a BUILTIN() macro in Builtins.def.
386 
387  static std::string
388  getSuffixStr(RVVTypeCache &TypeCache, BasicType Type, int Log2LMUL,
389  llvm::ArrayRef<PrototypeDescriptor> PrototypeDescriptors);
390 
393  bool IsMasked, bool HasMaskedOffOperand, bool HasVL,
394  unsigned NF, bool IsPrototypeDefaultTU,
395  PolicyScheme DefaultScheme,
396  Policy DefaultPolicy = Policy::PolicyNone);
398  getSupportedMaskedPolicies(bool HasTailPolicy, bool HasMaskPolicy);
399 
400  static void updateNamesAndPolicy(bool IsMasked, bool HasPolicy,
401  bool IsPrototypeDefaultTU, std::string &Name,
402  std::string &BuiltinName,
403  std::string &OverloadedName,
404  Policy &DefaultPolicy);
405 };
406 
407 // RVVRequire should be sync'ed with target features, but only
408 // required features used in riscv_vector.td.
409 enum RVVRequire : uint8_t {
411  RVV_REQ_RV64 = 1 << 0,
413 
415 };
416 
417 // Raw RVV intrinsic info, used to expand later.
418 // This struct is highly compact for minimized code size.
420  // Intrinsic name, e.g. vadd_vv
421  const char *Name;
422 
423  // Overloaded intrinsic name, could be empty if it can be computed from Name.
424  // e.g. vadd
425  const char *OverloadedName;
426 
427  // Prototype for this intrinsic, index of RVVSignatureTable.
428  uint16_t PrototypeIndex;
429 
430  // Suffix of intrinsic name, index of RVVSignatureTable.
431  uint16_t SuffixIndex;
432 
433  // Suffix of overloaded intrinsic name, index of RVVSignatureTable.
435 
436  // Length of the prototype.
438 
439  // Length of intrinsic name suffix.
440  uint8_t SuffixLength;
441 
442  // Length of overloaded intrinsic suffix.
444 
445  // Required target features for this intrinsic.
447 
448  // Supported type, mask of BasicType.
449  uint8_t TypeRangeMask;
450 
451  // Supported LMUL.
452  uint8_t Log2LMULMask;
453 
454  // Number of fields, greater than 1 if it's segment load/store.
455  uint8_t NF;
456 
457  bool HasMasked : 1;
458  bool HasVL : 1;
461  bool HasTailPolicy : 1;
462  bool HasMaskPolicy : 1;
463  uint8_t UnMaskedPolicyScheme : 2;
464  uint8_t MaskedPolicyScheme : 2;
465 };
466 
467 llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
468  const RVVIntrinsicRecord &RVVInstrRecord);
469 
471 } // end namespace RISCV
472 
473 } // end namespace clang
474 
475 #endif // CLANG_SUPPORT_RISCVVINTRINSICUTILS_H
clang::RISCV::TypeModifier::NoModifier
@ NoModifier
clang::RISCV::VectorTypeModifier::SFixedLog2LMUL2
@ SFixedLog2LMUL2
clang::RISCV::PrototypeDescriptor
Definition: RISCVVIntrinsicUtils.h:112
clang::RISCV::Size_t
@ Size_t
Definition: RISCVVIntrinsicUtils.h:163
clang::RISCV::RVVIntrinsic::hasBuiltinAlias
bool hasBuiltinAlias() const
Definition: RISCVVIntrinsicUtils.h:365
clang::RISCV::MA
@ MA
Definition: RISCVVIntrinsicUtils.h:104
llvm
YAML serialization mapping.
Definition: Dominators.h:30
clang::RISCV::TypeModifier::LMUL1
@ LMUL1
clang::RISCV::RVVIntrinsic::isMasked
bool isMasked() const
Definition: RISCVVIntrinsicUtils.h:367
clang::RISCV::LMULType::str
std::string str() const
Definition: RISCVVIntrinsicUtils.cpp:42
clang::RISCV::LMULType
Definition: RISCVVIntrinsicUtils.h:175
clang::RISCV::RVVType::getBuiltinStr
const std::string & getBuiltinStr() const
Definition: RISCVVIntrinsicUtils.h:217
clang::RISCV::RVVIntrinsic::~RVVIntrinsic
~RVVIntrinsic()=default
string
string(SUBSTRING ${CMAKE_CURRENT_BINARY_DIR} 0 ${PATH_LIB_START} PATH_HEAD) string(SUBSTRING $
Definition: CMakeLists.txt:22
clang::RISCV::VectorTypeModifier::FixedSEW64
@ FixedSEW64
clang::RISCV::RVVType::isPointer
bool isPointer() const
Definition: RISCVVIntrinsicUtils.h:253
clang::RISCV::TUMU
@ TUMU
Definition: RISCVVIntrinsicUtils.h:101
clang::RISCV::VectorTypeModifier::SFixedLog2LMULN3
@ SFixedLog2LMULN3
clang::RISCV::TypeModifier::Immediate
@ Immediate
clang::RISCV::RVVIntrinsicRecord::OverloadedSuffixSize
uint8_t OverloadedSuffixSize
Definition: RISCVVIntrinsicUtils.h:443
clang::RISCV::RVVType::getScalarType
ScalarTypeKind getScalarType() const
Definition: RISCVVIntrinsicUtils.h:256
clang::RISCV::Boolean
@ Boolean
Definition: RISCVVIntrinsicUtils.h:167
clang::RISCV::MU
@ MU
Definition: RISCVVIntrinsicUtils.h:103
clang::RISCV::SignedLong
@ SignedLong
Definition: RISCVVIntrinsicUtils.h:166
clang::RISCV::RVVIntrinsicRecord::OverloadedSuffixIndex
uint16_t OverloadedSuffixIndex
Definition: RISCVVIntrinsicUtils.h:434
clang::RISCV::TU
@ TU
Definition: RISCVVIntrinsicUtils.h:97
llvm::SmallVector
Definition: LLVM.h:38
clang::RISCV::VectorTypeModifier::LFixedLog2LMUL1
@ LFixedLog2LMUL1
clang::RISCV::RVVIntrinsicRecord::HasVL
bool HasVL
Definition: RISCVVIntrinsicUtils.h:458
clang::RISCV::UnsignedLong
@ UnsignedLong
clang::RISCV::HasPassthruOperand
@ HasPassthruOperand
Definition: RISCVVIntrinsicUtils.h:306
clang::RISCV::PrototypeDescriptor::VL
static const PrototypeDescriptor VL
Definition: RISCVVIntrinsicUtils.h:138
clang::RISCV::RVVIntrinsicRecord::HasMasked
bool HasMasked
Definition: RISCVVIntrinsicUtils.h:457
clang::RISCV::BasicType::Float16
@ Float16
clang::RISCV::RVVIntrinsicRecord::PrototypeLength
uint8_t PrototypeLength
Definition: RISCVVIntrinsicUtils.h:437
clang::RISCV::RVVIntrinsic::updateNamesAndPolicy
static void updateNamesAndPolicy(bool IsMasked, bool HasPolicy, bool IsPrototypeDefaultTU, std::string &Name, std::string &BuiltinName, std::string &OverloadedName, Policy &DefaultPolicy)
Definition: RISCVVIntrinsicUtils.cpp:1015
clang::RISCV::RVVIntrinsic::getSuffixStr
static std::string getSuffixStr(RVVTypeCache &TypeCache, BasicType Type, int Log2LMUL, llvm::ArrayRef< PrototypeDescriptor > PrototypeDescriptors)
Definition: RISCVVIntrinsicUtils.cpp:898
clang::RISCV::BasicType::Unknown
@ Unknown
clang::RISCV::HasPassthruOperandAtIdx1
@ HasPassthruOperandAtIdx1
Definition: RISCVVIntrinsicUtils.h:310
clang::RISCV::BaseTypeModifier::Ptrdiff
@ Ptrdiff
clang::RISCV::PrototypeDescriptor::Vector
static const PrototypeDescriptor Vector
Definition: RISCVVIntrinsicUtils.h:137
clang::RISCV::PolicyScheme
PolicyScheme
Definition: RISCVVIntrinsicUtils.h:303
clang::RISCV::SignedInteger
@ SignedInteger
Definition: RISCVVIntrinsicUtils.h:168
clang::RISCV::RVVIntrinsic::hasVL
bool hasVL() const
Definition: RISCVVIntrinsicUtils.h:356
clang::RISCV::VectorTypeModifier::SFixedLog2LMULN1
@ SFixedLog2LMULN1
clang::RISCV::ScalarTypeKind
ScalarTypeKind
Definition: RISCVVIntrinsicUtils.h:161
llvm::Optional< unsigned >
clang::RISCV::RVVIntrinsic::getDefaultPolicyBits
unsigned getDefaultPolicyBits() const
Definition: RISCVVIntrinsicUtils.h:379
clang::RISCV::RVVType::isFloat
bool isFloat(unsigned Width) const
Definition: RISCVVIntrinsicUtils.h:249
clang::RISCV::VectorTypeModifier::LFixedLog2LMULN1
@ LFixedLog2LMULN1
clang::RISCV::RVVIntrinsic::getBuiltinTypeStr
std::string getBuiltinTypeStr() const
Definition: RISCVVIntrinsicUtils.cpp:889
clang::RISCV::RVVType::isScalar
bool isScalar() const
Definition: RISCVVIntrinsicUtils.h:237
clang::RISCV::VectorTypeModifier::LFixedLog2LMULN2
@ LFixedLog2LMULN2
clang::RISCV::RVVIntrinsicRecord::SuffixLength
uint8_t SuffixLength
Definition: RISCVVIntrinsicUtils.h:440
clang::RISCV::BasicType::Float32
@ Float32
clang::RISCV::PrototypeDescriptor::operator!=
bool operator!=(const PrototypeDescriptor &PD) const
Definition: RISCVVIntrinsicUtils.h:127
clang::RISCV::VectorTypeModifier::LFixedLog2LMUL2
@ LFixedLog2LMUL2
clang::RISCV::PrototypeDescriptor::PrototypeDescriptor
constexpr PrototypeDescriptor(BaseTypeModifier PT, VectorTypeModifier VTM=VectorTypeModifier::NoModifier, TypeModifier TM=TypeModifier::NoModifier)
Definition: RISCVVIntrinsicUtils.h:114
clang::RISCV::RVVType::getShortStr
const std::string & getShortStr()
Definition: RISCVVIntrinsicUtils.h:228
clang::Type
The base class of the type hierarchy.
Definition: Type.h:1565
clang::RISCV::VectorTypeModifier::Widening8XVector
@ Widening8XVector
clang::RISCV::RVVIntrinsicRecord::SuffixIndex
uint16_t SuffixIndex
Definition: RISCVVIntrinsicUtils.h:431
clang::RISCV::RVVIntrinsic::supportOverloading
bool supportOverloading() const
Definition: RISCVVIntrinsicUtils.h:364
clang::RISCV::RVVType::getElementBitwidth
unsigned getElementBitwidth() const
Definition: RISCVVIntrinsicUtils.h:254
clang::RISCV::RVVIntrinsic::getManualCodegen
llvm::StringRef getManualCodegen() const
Definition: RISCVVIntrinsicUtils.h:369
clang::RISCV::TypeModifier::Const
@ Const
clang::RISCV::BaseTypeModifier::SizeT
@ SizeT
clang::RISCV::RVVIntrinsicRecord::RequiredExtensions
uint8_t RequiredExtensions
Definition: RISCVVIntrinsicUtils.h:446
clang::RISCV::VectorTypeModifier::FixedSEW8
@ FixedSEW8
clang::RISCV::UnsignedLong
@ UnsignedLong
Definition: RISCVVIntrinsicUtils.h:165
clang::RISCV::LMULType::MulLog2LMUL
void MulLog2LMUL(int Log2LMUL)
Definition: RISCVVIntrinsicUtils.cpp:72
clang::RISCV::RVVType::getClangBuiltinStr
const std::string & getClangBuiltinStr() const
Definition: RISCVVIntrinsicUtils.h:221
clang::RISCV::VectorTypeModifier::Widening2XVector
@ Widening2XVector
clang::RISCV::VectorTypeModifier::Log2EEW4
@ Log2EEW4
clang::RISCV::TAM
@ TAM
Definition: RISCVVIntrinsicUtils.h:106
clang::RISCV::RVVIntrinsicRecord::HasMaskPolicy
bool HasMaskPolicy
Definition: RISCVVIntrinsicUtils.h:462
clang::RISCV::Invalid
@ Invalid
clang::RISCV::Ptrdiff_t
@ Ptrdiff_t
Definition: RISCVVIntrinsicUtils.h:164
clang::RISCV::VectorTypeModifier::SFixedLog2LMUL3
@ SFixedLog2LMUL3
clang::RISCV::HasPolicyOperand
@ HasPolicyOperand
Definition: RISCVVIntrinsicUtils.h:307
clang::RISCV::RVVType::isConstant
bool isConstant() const
Definition: RISCVVIntrinsicUtils.h:252
clang::RISCV::RVV_REQ_FullMultiply
@ RVV_REQ_FullMultiply
Definition: RISCVVIntrinsicUtils.h:412
clang::RISCV::Void
@ Void
Definition: RISCVVIntrinsicUtils.h:162
clang::RISCV::RVVIntrinsic::getNF
unsigned getNF() const
Definition: RISCVVIntrinsicUtils.h:371
clang::RISCV::VectorTypeModifier::SFixedLog2LMULN2
@ SFixedLog2LMULN2
clang::RISCV::RVVIntrinsicRecord::NF
uint8_t NF
Definition: RISCVVIntrinsicUtils.h:455
clang::RISCV::VectorTypeModifier::Log2EEW6
@ Log2EEW6
clang::RISCV::PrototypeDescriptor::PT
uint8_t PT
Definition: RISCVVIntrinsicUtils.h:123
clang::RISCV::Policy
Policy
Definition: RISCVVIntrinsicUtils.h:96
clang::RISCV::PolicyNone
@ PolicyNone
Definition: RISCVVIntrinsicUtils.h:107
clang::RISCV::SchemeNone
@ SchemeNone
Definition: RISCVVIntrinsicUtils.h:304
clang::RISCV::LMULType::LMULType
LMULType(int Log2LMUL)
Definition: RISCVVIntrinsicUtils.cpp:36
clang::RISCV::RVVType
Definition: RISCVVIntrinsicUtils.h:190
clang::RISCV::BaseTypeModifier
BaseTypeModifier
Definition: RISCVVIntrinsicUtils.h:65
clang::RISCV::RVVType::isFloat
bool isFloat() const
Definition: RISCVVIntrinsicUtils.h:242
clang::RISCV::BasicType::Int8
@ Int8
clang::RISCV::TypeModifier
TypeModifier
Definition: RISCVVIntrinsicUtils.h:77
clang::RISCV::PrototypeDescriptor::parsePrototypeDescriptor
static llvm::Optional< PrototypeDescriptor > parsePrototypeDescriptor(llvm::StringRef PrototypeStr)
Definition: RISCVVIntrinsicUtils.cpp:365
clang::RISCV::BaseTypeModifier::Scalar
@ Scalar
clang::RISCV::RVVIntrinsic::hasPolicy
bool hasPolicy() const
Definition: RISCVVIntrinsicUtils.h:357
clang::RISCV::PrototypeDescriptor::Mask
static const PrototypeDescriptor Mask
Definition: RISCVVIntrinsicUtils.h:136
clang::RISCV::BaseTypeModifier::Vector
@ Vector
clang::RISCV::PrototypeDescriptor::PrototypeDescriptor
constexpr PrototypeDescriptor()=default
clang::RISCV::SignedLong
@ SignedLong
clang::RISCV::RVVIntrinsic::getInputTypes
const RVVTypes & getInputTypes() const
Definition: RISCVVIntrinsicUtils.h:351
clang::RISCV::PrototypeDescriptor::PrototypeDescriptor
constexpr PrototypeDescriptor(uint8_t PT, uint8_t VTM, uint8_t TM)
Definition: RISCVVIntrinsicUtils.h:120
clang::RISCV::RVVType::isVector
bool isVector(unsigned Width) const
Definition: RISCVVIntrinsicUtils.h:239
clang::RISCV::PrototypeDescriptor::operator<
bool operator<(const PrototypeDescriptor &PD) const
Definition: RISCVVIntrinsicUtils.h:133
clang::RISCV::RVVIntrinsicRecord::MaskedPolicyScheme
uint8_t MaskedPolicyScheme
Definition: RISCVVIntrinsicUtils.h:464
clang::RISCV::PrototypeDescriptor::VTM
uint8_t VTM
Definition: RISCVVIntrinsicUtils.h:124
clang::RISCV::BasicType::LLVM_MARK_AS_BITMASK_ENUM
@ LLVM_MARK_AS_BITMASK_ENUM
clang::RISCV::RVVIntrinsicRecord::TypeRangeMask
uint8_t TypeRangeMask
Definition: RISCVVIntrinsicUtils.h:449
clang::RISCV::operator<<
llvm::raw_ostream & operator<<(llvm::raw_ostream &OS, const RVVIntrinsicRecord &RVVInstrRecord)
clang::RISCV::RVVIntrinsicRecord
Definition: RISCVVIntrinsicUtils.h:419
clang::RISCV::VectorTypeModifier::NoModifier
@ NoModifier
clang::RISCV::TA
@ TA
Definition: RISCVVIntrinsicUtils.h:98
clang::RISCV::RVV_REQ_RV64
@ RVV_REQ_RV64
Definition: RISCVVIntrinsicUtils.h:411
clang::RISCV::RVVTypeCache::computeType
llvm::Optional< RVVTypePtr > computeType(BasicType BT, int Log2LMUL, PrototypeDescriptor Proto)
Definition: RISCVVIntrinsicUtils.cpp:817
clang::RISCV::VectorTypeModifier::Widening4XVector
@ Widening4XVector
clang::RISCV::RVVTypes
std::vector< RVVTypePtr > RVVTypes
Definition: RISCVVIntrinsicUtils.h:186
clang::RISCV::RVVType::isSignedInteger
bool isSignedInteger() const
Definition: RISCVVIntrinsicUtils.h:243
clang::RISCV::RVVIntrinsic::hasMaskedOffOperand
bool hasMaskedOffOperand() const
Definition: RISCVVIntrinsicUtils.h:355
llvm::ArrayRef
Definition: LLVM.h:34
clang::RISCV::PrototypeDescriptor::operator==
bool operator==(const PrototypeDescriptor &PD) const
Definition: RISCVVIntrinsicUtils.h:130
clang::RISCV::RVVIntrinsicRecord::HasMaskedOffOperand
bool HasMaskedOffOperand
Definition: RISCVVIntrinsicUtils.h:459
clang::RISCV::TypeModifier::LLVM_MARK_AS_BITMASK_ENUM
@ LLVM_MARK_AS_BITMASK_ENUM
clang::RISCV::Float
@ Float
Definition: RISCVVIntrinsicUtils.h:170
clang::RISCV::TUMA
@ TUMA
Definition: RISCVVIntrinsicUtils.h:99
clang::RISCV::RVVIntrinsic::getOverloadedName
llvm::StringRef getOverloadedName() const
Definition: RISCVVIntrinsicUtils.h:354
clang::RISCV::BasicType::Int16
@ Int16
clang::RISCV::RVVIntrinsic::getDefaultPolicy
Policy getDefaultPolicy() const
Definition: RISCVVIntrinsicUtils.h:375
clang::RISCV::VectorTypeModifier::SFixedLog2LMUL0
@ SFixedLog2LMUL0
clang::RISCV::RVVTypeCache::computeTypes
llvm::Optional< RVVTypes > computeTypes(BasicType BT, int Log2LMUL, unsigned NF, llvm::ArrayRef< PrototypeDescriptor > Prototype)
Compute output and input types by applying different config (basic type and LMUL with type transforme...
Definition: RISCVVIntrinsicUtils.cpp:787
clang::RISCV::RVVIntrinsic::getName
llvm::StringRef getName() const
Definition: RISCVVIntrinsicUtils.h:353
clang::RISCV::RVVIntrinsic::computeBuiltinTypes
static llvm::SmallVector< PrototypeDescriptor > computeBuiltinTypes(llvm::ArrayRef< PrototypeDescriptor > Prototype, bool IsMasked, bool HasMaskedOffOperand, bool HasVL, unsigned NF, bool IsPrototypeDefaultTU, PolicyScheme DefaultScheme, Policy DefaultPolicy=Policy::PolicyNone)
Definition: RISCVVIntrinsicUtils.cpp:909
clang::RISCV::RVVIntrinsicRecord::Name
const char * Name
Definition: RISCVVIntrinsicUtils.h:421
clang::DeclaratorContext::Prototype
@ Prototype
clang::RISCV::UnsignedInteger
@ UnsignedInteger
Definition: RISCVVIntrinsicUtils.h:169
clang::RISCV::RVVIntrinsic::hasPolicyOperand
bool hasPolicyOperand() const
Definition: RISCVVIntrinsicUtils.h:361
clang::RISCV::VectorTypeModifier::LFixedLog2LMULN3
@ LFixedLog2LMULN3
clang::RISCV::RVVIntrinsicRecord::UnMaskedPolicyScheme
uint8_t UnMaskedPolicyScheme
Definition: RISCVVIntrinsicUtils.h:463
clang::RISCV::RVVType::isValid
bool isValid() const
Definition: RISCVVIntrinsicUtils.h:236
clang::RISCV::TAMA
@ TAMA
Definition: RISCVVIntrinsicUtils.h:100
clang::RISCV::LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE
LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE()
clang::RISCV::RVVTypeCache
Definition: RISCVVIntrinsicUtils.h:286
clang::RISCV::RVVIntrinsic::getSupportedMaskedPolicies
static llvm::SmallVector< Policy > getSupportedMaskedPolicies(bool HasTailPolicy, bool HasMaskPolicy)
Definition: RISCVVIntrinsicUtils.cpp:1006
clang::RISCV::RVVType::getScale
VScaleVal getScale() const
Definition: RISCVVIntrinsicUtils.h:257
clang::RISCV::VectorTypeModifier::LFixedLog2LMUL0
@ LFixedLog2LMUL0
clang::RISCV::BasicType::MaxOffset
@ MaxOffset
clang::RISCV::VectorTypeModifier::Log2EEW3
@ Log2EEW3
clang::RISCV::BasicType::Float64
@ Float64
clang::RISCV::RVVType::isVector
bool isVector() const
Definition: RISCVVIntrinsicUtils.h:238
clang::RISCV::VectorTypeModifier::SFixedLog2LMUL1
@ SFixedLog2LMUL1
clang
Definition: CalledOnceCheck.h:17
clang::RISCV::VectorTypeModifier::LFixedLog2LMUL3
@ LFixedLog2LMUL3
clang::RISCV::TAMU
@ TAMU
Definition: RISCVVIntrinsicUtils.h:102
clang::RISCV::VectorTypeModifier::Log2EEW5
@ Log2EEW5
clang::RISCV::BasicType::Int64
@ Int64
clang::RISCV::RVVIntrinsic::getIRName
llvm::StringRef getIRName() const
Definition: RISCVVIntrinsicUtils.h:368
clang::RISCV::RVVRequire
RVVRequire
Definition: RISCVVIntrinsicUtils.h:409
clang::RISCV::RVVType::isFloatVector
bool isFloatVector(unsigned Width) const
Definition: RISCVVIntrinsicUtils.h:246
clang::RISCV::RVV_REQ_None
@ RVV_REQ_None
Definition: RISCVVIntrinsicUtils.h:410
clang::RISCV::RVVIntrinsic::getBuiltinName
llvm::StringRef getBuiltinName() const
Definition: RISCVVIntrinsicUtils.h:352
clang::RISCV::TUM
@ TUM
Definition: RISCVVIntrinsicUtils.h:105
clang::RISCV::RVVType::getTypeStr
const std::string & getTypeStr() const
Definition: RISCVVIntrinsicUtils.h:225
clang::RISCV::RVVIntrinsic::getPolicyScheme
PolicyScheme getPolicyScheme() const
Definition: RISCVVIntrinsicUtils.h:370
clang::RISCV::RVVIntrinsic::hasPassthruOperand
bool hasPassthruOperand() const
Definition: RISCVVIntrinsicUtils.h:358
clang::RISCV::RVVIntrinsic::RVVIntrinsic
RVVIntrinsic(llvm::StringRef Name, llvm::StringRef Suffix, llvm::StringRef OverloadedName, llvm::StringRef OverloadedSuffix, llvm::StringRef IRName, bool IsMasked, bool HasMaskedOffOperand, bool HasVL, PolicyScheme Scheme, bool SupportOverloading, bool HasBuiltinAlias, llvm::StringRef ManualCodegen, const RVVTypes &Types, const std::vector< int64_t > &IntrinsicTypes, const std::vector< llvm::StringRef > &RequiredFeatures, unsigned NF, Policy DefaultPolicy, bool IsPrototypeDefaultTU)
Definition: RISCVVIntrinsicUtils.cpp:844
clang::RISCV::RVVIntrinsic::hasManualCodegen
bool hasManualCodegen() const
Definition: RISCVVIntrinsicUtils.h:366
clang::RISCV::BasicType
BasicType
Definition: RISCVVIntrinsicUtils.h:147
clang::RISCV::Float
@ Float
clang::RISCV::TypeModifier::Pointer
@ Pointer
clang::RISCV::PrototypeDescriptor::TM
uint8_t TM
Definition: RISCVVIntrinsicUtils.h:125
clang::RISCV::VectorTypeModifier::MaskVector
@ MaskVector
clang::RISCV::parsePrototypes
llvm::SmallVector< PrototypeDescriptor > parsePrototypes(llvm::StringRef Prototypes)
clang::RISCV::RVVIntrinsicRecord::IsPrototypeDefaultTU
bool IsPrototypeDefaultTU
Definition: RISCVVIntrinsicUtils.h:460
clang::RISCV::RVVIntrinsicRecord::Log2LMULMask
uint8_t Log2LMULMask
Definition: RISCVVIntrinsicUtils.h:452
clang::RISCV::VectorTypeModifier
VectorTypeModifier
Definition: RISCVVIntrinsicUtils.h:33
clang::RISCV::RVVIntrinsicRecord::PrototypeIndex
uint16_t PrototypeIndex
Definition: RISCVVIntrinsicUtils.h:428
clang::RISCV::Invalid
@ Invalid
Definition: RISCVVIntrinsicUtils.h:171
clang::RISCV::VectorTypeModifier::FixedSEW32
@ FixedSEW32
clang::RISCV::VectorTypeModifier::FixedSEW16
@ FixedSEW16
clang::RISCV::RVVIntrinsic::getOutputType
RVVTypePtr getOutputType() const
Definition: RISCVVIntrinsicUtils.h:350
clang::RISCV::RVVIntrinsicRecord::HasTailPolicy
bool HasTailPolicy
Definition: RISCVVIntrinsicUtils.h:461
clang::RISCV::LMULType::getScale
llvm::Optional< unsigned > getScale(unsigned ElementBitwidth) const
Definition: RISCVVIntrinsicUtils.cpp:48
clang::RISCV::TypeModifier::MaxOffset
@ MaxOffset
clang::RISCV::LMULType::Log2LMUL
int Log2LMUL
Definition: RISCVVIntrinsicUtils.h:176
clang::RISCV::RVVIntrinsic::getIntrinsicTypes
const std::vector< int64_t > & getIntrinsicTypes() const
Definition: RISCVVIntrinsicUtils.h:372
clang::RISCV::RVVIntrinsic
Definition: RISCVVIntrinsicUtils.h:316
clang::RISCV::BasicType::Int32
@ Int32
clang::RISCV::RVVIntrinsicRecord::OverloadedName
const char * OverloadedName
Definition: RISCVVIntrinsicUtils.h:425