16#ifndef LLVM_CODEGEN_MACHINEVALUETYPE_H
17#define LLVM_CODEGEN_MACHINEVALUETYPE_H
42#define GET_VT_ATTR(Ty, n, sz, Any, Int, FP, Vec, Sc, Tup, NF, NElem, EltTy) \
45#include "llvm/CodeGen/GenVT.inc"
52 static_assert(FIRST_VALUETYPE > 0);
53 static_assert(LAST_VALUETYPE < token);
57 constexpr MVT() =
default;
75 return (
SimpleTy >= MVT::FIRST_VALUETYPE &&
81 return ((
SimpleTy >= MVT::FIRST_FP_VALUETYPE &&
82 SimpleTy <= MVT::LAST_FP_VALUETYPE) ||
83 (
SimpleTy >= MVT::FIRST_FP_FIXEDLEN_VECTOR_VALUETYPE &&
84 SimpleTy <= MVT::LAST_FP_FIXEDLEN_VECTOR_VALUETYPE) ||
85 (
SimpleTy >= MVT::FIRST_FP_SCALABLE_VECTOR_VALUETYPE &&
86 SimpleTy <= MVT::LAST_FP_SCALABLE_VECTOR_VALUETYPE));
91 return ((
SimpleTy >= MVT::FIRST_INTEGER_VALUETYPE &&
92 SimpleTy <= MVT::LAST_INTEGER_VALUETYPE) ||
93 (
SimpleTy >= MVT::FIRST_INTEGER_FIXEDLEN_VECTOR_VALUETYPE &&
94 SimpleTy <= MVT::LAST_INTEGER_FIXEDLEN_VECTOR_VALUETYPE) ||
95 (
SimpleTy >= MVT::FIRST_INTEGER_SCALABLE_VECTOR_VALUETYPE &&
96 SimpleTy <= MVT::LAST_INTEGER_SCALABLE_VECTOR_VALUETYPE));
101 return (
SimpleTy >= MVT::FIRST_INTEGER_VALUETYPE &&
102 SimpleTy <= MVT::LAST_INTEGER_VALUETYPE);
107 return (
SimpleTy >= MVT::FIRST_VECTOR_VALUETYPE &&
108 SimpleTy <= MVT::LAST_VECTOR_VALUETYPE);
114 return (
SimpleTy >= MVT::FIRST_SCALABLE_VECTOR_VALUETYPE &&
115 SimpleTy <= MVT::LAST_SCALABLE_VECTOR_VALUETYPE);
121 return (
SimpleTy >= MVT::FIRST_RISCV_VECTOR_TUPLE_VALUETYPE &&
122 SimpleTy <= MVT::LAST_RISCV_VECTOR_TUPLE_VALUETYPE);
136 return (
SimpleTy >= MVT::FIRST_FIXEDLEN_VECTOR_VALUETYPE &&
137 SimpleTy <= MVT::LAST_FIXEDLEN_VECTOR_VALUETYPE);
183#define GET_VT_ATTR(Ty, n, sz, Any, Int, FP, Vec, Sc, Tup, NF, NElem, EltTy) \
186#include "llvm/CodeGen/GenVT.inc"
201 "Simple vector VT not representable by simple integer vector VT!");
210 "Simple vector VT not representable by simple integer vector VT!");
228 assert(EltCnt.isKnownEven() &&
"Splitting vector, but not in half!");
229 return getVectorVT(EltVT, EltCnt.divideCoefficientBy(2));
243 return !(NElts & (NElts - 1));
266#define GET_VT_ATTR(Ty, N, Sz, Any, Int, FP, Vec, Sc, Tup, NF, NElem, EltTy) \
268#include "llvm/CodeGen/GenVT.inc"
279 static constexpr uint16_t NElemTable[] = {
280#define GET_VT_ATTR(Ty, N, Sz, Any, Int, FP, Vec, Sc, Tup, NF, NElem, EltTy) \
282#include "llvm/CodeGen/GenVT.inc"
285 unsigned NElem = NElemTable[
SimpleTy - FIRST_VALUETYPE];
286 assert(NElem != 0 &&
"Not a vector MVT!");
297 "Possible incorrect use of MVT::getVectorNumElements() for "
298 "scalable vector. Scalable flag may be dropped, use "
299 "MVT::getVectorElementCount() instead");
309 static constexpr TypeSize SizeTable[] = {
310#define GET_VT_ATTR(Ty, N, Sz, Any, Int, FP, Vec, Sc, Tup, NF, NElem, EltTy) \
311 TypeSize(Sz, Sc || Tup || Ty == aarch64svcount
313#include "llvm/CodeGen/GenVT.inc"
332 "in codegen and has no size");
337 return SizeTable[
SimpleTy - FIRST_VALUETYPE];
407 "Comparison between scalable and fixed types");
414 "Comparison between scalable and fixed types");
421 "Comparison between scalable and fixed types");
428 "Comparison between scalable and fixed types");
433#define GET_VT_ATTR(Ty, n, sz, Any, Int, FP, Vec, Sc, Tup, NF, NElem, EltTy) \
434 if (FP == 3 && sz == BitWidth) \
436#include "llvm/CodeGen/GenVT.inc"
443#define GET_VT_ATTR(Ty, n, sz, Any, Int, FP, Vec, Sc, Tup, NF, NElem, EltTy) \
444 if (Int == 3 && sz == BitWidth) \
446#include "llvm/CodeGen/GenVT.inc"
453#define GET_VT_VECATTR(Ty, Sc, Tup, nElem, ElTy) \
454 if (!Sc && !Tup && VT.SimpleTy == ElTy && NumElements == nElem) \
456#include "llvm/CodeGen/GenVT.inc"
463#define GET_VT_VECATTR(Ty, Sc, Tup, nElem, ElTy) \
464 if (Sc && VT.SimpleTy == ElTy && NumElements == nElem) \
466#include "llvm/CodeGen/GenVT.inc"
473#define GET_VT_ATTR(Ty, n, sz, Any, Int, FP, Vec, Sc, Tup, NF, nElem, EltTy) \
474 if (Tup && sz == Sz && NF == NFields) \
476#include "llvm/CodeGen/GenVT.inc"
486 static constexpr uint8_t NFTable[] = {
487#define GET_VT_ATTR(Ty, N, Sz, Any, Int, FP, Vec, Sc, Tup, NF, NElem, EltTy) \
489#include "llvm/CodeGen/GenVT.inc"
492 return NFTable[
SimpleTy - FIRST_VALUETYPE];
528 MVT::LAST_INTEGER_VALUETYPE,
539 MVT::LAST_VECTOR_VALUETYPE,
545 MVT::LAST_FIXEDLEN_VECTOR_VALUETYPE,
551 MVT::LAST_SCALABLE_VECTOR_VALUETYPE,
557 MVT::LAST_INTEGER_FIXEDLEN_VECTOR_VALUETYPE,
563 MVT::LAST_FP_FIXEDLEN_VECTOR_VALUETYPE,
569 MVT::LAST_INTEGER_SCALABLE_VECTOR_VALUETYPE,
575 MVT::LAST_FP_SCALABLE_VECTOR_VALUETYPE,
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Provides some synthesis utilities to produce sequences of values.
static constexpr ElementCount get(ScalarTy MinVal, bool Scalable)
void dump() const
Support for debugging, callable in GDB: VT.dump()
static MVT getFloatingPointVT(unsigned BitWidth)
bool isByteSized() const
Returns true if the number of bits for the type is a multiple of an 8-bit byte.
bool is128BitVector() const
Return true if this is a 128-bit vector type.
bool knownBitsGT(MVT VT) const
Return true if we know at compile time this has more bits than VT.
@ INVALID_SIMPLE_VALUE_TYPE
static auto integer_fixedlen_vector_valuetypes()
unsigned getVectorMinNumElements() const
Given a vector type, return the minimum number of elements it contains.
bool isRISCVVectorTuple() const
Return true if this is a RISCV vector tuple type where the runtime length is machine dependent.
bool operator>(const MVT &S) const
bool isOverloaded() const
Return true if this is an overloaded type for TableGen.
bool isScalableTargetExtVT() const
Return true if this is a custom target type that has a scalable size.
uint64_t getScalarSizeInBits() const
MVT changeVectorElementType(MVT EltVT) const
Return a VT for a vector type whose attributes match ourselves with the exception of the element type...
bool operator<=(const MVT &S) const
bool bitsLE(MVT VT) const
Return true if this has no more bits than VT.
unsigned getVectorNumElements() const
bool knownBitsLT(MVT VT) const
Return true if we know at compile time this has fewer bits than VT.
static MVT getRISCVVectorTupleVT(unsigned Sz, unsigned NFields)
bool isVector() const
Return true if this is a vector value type.
bool isInteger() const
Return true if this is an integer or a vector integer type.
bool isScalableVector() const
Return true if this is a vector value type where the runtime length is machine dependent.
static MVT getScalableVectorVT(MVT VT, unsigned NumElements)
bool is16BitVector() const
Return true if this is a 16-bit vector type.
bool is32BitVector() const
Return true if this is a 32-bit vector type.
unsigned getRISCVVectorTupleNumFields() const
Given a RISC-V vector tuple type, return the num_fields.
MVT changeTypeToInteger()
Return the type converted to an equivalently sized integer or vector with integer element type.
static MVT getVT(Type *Ty, bool HandleUnknown=false)
Return the value type corresponding to the specified type.
bool isScalableVT() const
Return true if the type is a scalable type.
bool bitsLT(MVT VT) const
Return true if this has less bits than VT.
static auto all_valuetypes()
SimpleValueType Iteration.
bool operator<(const MVT &S) const
bool is512BitVector() const
Return true if this is a 512-bit vector type.
bool operator==(const MVT &S) const
static auto integer_valuetypes()
bool is1024BitVector() const
Return true if this is a 1024-bit vector type.
TypeSize getSizeInBits() const
Returns the size of the specified MVT in bits.
bool isPow2VectorType() const
Returns true if the given vector is a power of 2.
uint64_t getScalarStoreSize() const
static auto scalable_vector_valuetypes()
static auto fixedlen_vector_valuetypes()
uint64_t getFixedSizeInBits() const
Return the size of the specified fixed width value type in bits.
const fltSemantics & getFltSemantics() const
Returns an APFloat semantics tag appropriate for the value type.
bool bitsGT(MVT VT) const
Return true if this has more bits than VT.
bool isFixedLengthVector() const
static auto vector_valuetypes()
bool is256BitVector() const
Return true if this is a 256-bit vector type.
ElementCount getVectorElementCount() const
TypeSize getStoreSize() const
Return the number of bytes overwritten by a store of the specified value type.
bool bitsGE(MVT VT) const
Return true if this has no less bits than VT.
bool isScalarInteger() const
Return true if this is an integer, not including vectors.
TypeSize getStoreSizeInBits() const
Return the number of bits overwritten by a store of the specified value type.
static MVT getVectorVT(MVT VT, unsigned NumElements)
bool knownBitsGE(MVT VT) const
Return true if we know at compile time this has more than or the same bits as VT.
static auto fp_scalable_vector_valuetypes()
MVT getVectorElementType() const
bool isFloatingPoint() const
Return true if this is a FP or a vector FP type.
bool operator>=(const MVT &S) const
bool isValid() const
Return true if this is a valid simple valuetype.
static MVT getIntegerVT(unsigned BitWidth)
MVT getDoubleNumVectorElementsVT() const
static auto fp_valuetypes()
MVT getHalfNumVectorElementsVT() const
Return a VT for a vector type with the same element type but half the number of elements.
bool knownBitsLE(MVT VT) const
Return true if we know at compile time this has fewer than or the same bits as VT.
bool operator!=(const MVT &S) const
MVT getScalarType() const
If this is a vector, return the element type, otherwise return this.
static auto integer_scalable_vector_valuetypes()
void print(raw_ostream &OS) const
Implement operator<<.
bool is64BitVector() const
Return true if this is a 64-bit vector type.
MVT changeVectorElementTypeToInteger() const
Return a vector with the same number of elements as this vector, but with the element type converted ...
MVT getPow2VectorType() const
Widens the length of the given vector MVT up to the nearest power of 2 and returns that type.
static auto fp_fixedlen_vector_valuetypes()
constexpr MVT(SimpleValueType SVT)
bool is2048BitVector() const
Return true if this is a 2048-bit vector type.
The instances of the Type class are immutable: once they are created, they are never changed.
constexpr bool isKnownMultipleOf(ScalarTy RHS) const
This function tells the caller whether the element count is known at compile time to be a multiple of...
constexpr ScalarTy getFixedValue() const
static constexpr bool isKnownLE(const FixedOrScalableQuantity &LHS, const FixedOrScalableQuantity &RHS)
static constexpr bool isKnownLT(const FixedOrScalableQuantity &LHS, const FixedOrScalableQuantity &RHS)
constexpr bool isScalable() const
Returns whether the quantity is scaled by a runtime quantity (vscale).
constexpr ScalarTy getKnownMinValue() const
Returns the minimum value this quantity can represent.
static constexpr bool isKnownGT(const FixedOrScalableQuantity &LHS, const FixedOrScalableQuantity &RHS)
static constexpr bool isKnownGE(const FixedOrScalableQuantity &LHS, const FixedOrScalableQuantity &RHS)
This class implements an extremely fast bulk output stream that can only output to a stream.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
unsigned Log2_32_Ceil(uint32_t Value)
Return the ceil log base 2 of the specified value, 32 if the value is zero.
auto enum_seq_inclusive(EnumT Begin, EnumT End)
Iterate over an enum type from Begin to End inclusive.
constexpr force_iteration_on_noniterable_enum_t force_iteration_on_noniterable_enum
void reportInvalidSizeRequest(const char *Msg)
Reports a diagnostic message to indicate an invalid size request has been done on a scalable vector.
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
constexpr unsigned BitWidth