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, NElem, EltTy) Ty = n,
44#include "llvm/CodeGen/GenVT.inc"
51 static_assert(FIRST_VALUETYPE > 0);
52 static_assert(LAST_VALUETYPE < token);
56 constexpr MVT() =
default;
74 return (
SimpleTy >= MVT::FIRST_VALUETYPE &&
80 return ((
SimpleTy >= MVT::FIRST_FP_VALUETYPE &&
81 SimpleTy <= MVT::LAST_FP_VALUETYPE) ||
82 (
SimpleTy >= MVT::FIRST_FP_FIXEDLEN_VECTOR_VALUETYPE &&
83 SimpleTy <= MVT::LAST_FP_FIXEDLEN_VECTOR_VALUETYPE) ||
84 (
SimpleTy >= MVT::FIRST_FP_SCALABLE_VECTOR_VALUETYPE &&
85 SimpleTy <= MVT::LAST_FP_SCALABLE_VECTOR_VALUETYPE));
90 return ((
SimpleTy >= MVT::FIRST_INTEGER_VALUETYPE &&
91 SimpleTy <= MVT::LAST_INTEGER_VALUETYPE) ||
92 (
SimpleTy >= MVT::FIRST_INTEGER_FIXEDLEN_VECTOR_VALUETYPE &&
93 SimpleTy <= MVT::LAST_INTEGER_FIXEDLEN_VECTOR_VALUETYPE) ||
94 (
SimpleTy >= MVT::FIRST_INTEGER_SCALABLE_VECTOR_VALUETYPE &&
95 SimpleTy <= MVT::LAST_INTEGER_SCALABLE_VECTOR_VALUETYPE));
100 return (
SimpleTy >= MVT::FIRST_INTEGER_VALUETYPE &&
101 SimpleTy <= MVT::LAST_INTEGER_VALUETYPE);
106 return (
SimpleTy >= MVT::FIRST_VECTOR_VALUETYPE &&
107 SimpleTy <= MVT::LAST_VECTOR_VALUETYPE);
113 return (
SimpleTy >= MVT::FIRST_SCALABLE_VECTOR_VALUETYPE &&
114 SimpleTy <= MVT::LAST_SCALABLE_VECTOR_VALUETYPE);
119 return SimpleTy == MVT::aarch64svcount;
128 return (
SimpleTy >= MVT::FIRST_FIXEDLEN_VECTOR_VALUETYPE &&
129 SimpleTy <= MVT::LAST_FIXEDLEN_VECTOR_VALUETYPE);
175#define GET_VT_ATTR(Ty, n, sz, Any, Int, FP, Vec, Sc, NElem, EltTy) \
178#include "llvm/CodeGen/GenVT.inc"
193 "Simple vector VT not representable by simple integer vector VT!");
202 "Simple vector VT not representable by simple integer vector VT!");
220 assert(EltCnt.isKnownEven() &&
"Splitting vector, but not in half!");
221 return getVectorVT(EltVT, EltCnt.divideCoefficientBy(2));
235 return !(NElts & (NElts - 1));
258#define GET_VT_ATTR(Ty, N, Sz, Any, Int, FP, Vec, Sc, NElem, EltTy) EltTy,
259#include "llvm/CodeGen/GenVT.inc"
270 static constexpr uint16_t NElemTable[] = {
271#define GET_VT_ATTR(Ty, N, Sz, Any, Int, FP, Vec, Sc, NElem, EltTy) NElem,
272#include "llvm/CodeGen/GenVT.inc"
275 unsigned NElem = NElemTable[
SimpleTy - FIRST_VALUETYPE];
276 assert(NElem != 0 &&
"Not a vector MVT!");
287 "Possible incorrect use of MVT::getVectorNumElements() for "
288 "scalable vector. Scalable flag may be dropped, use "
289 "MVT::getVectorElementCount() instead");
299 static constexpr TypeSize SizeTable[] = {
300#define GET_VT_ATTR(Ty, N, Sz, Any, Int, FP, Vec, Sc, NElem, EltTy) \
301 TypeSize(Sz, Sc || Ty == aarch64svcount ),
302#include "llvm/CodeGen/GenVT.inc"
321 "in codegen and has no size");
326 return SizeTable[
SimpleTy - FIRST_VALUETYPE];
396 "Comparison between scalable and fixed types");
403 "Comparison between scalable and fixed types");
410 "Comparison between scalable and fixed types");
417 "Comparison between scalable and fixed types");
422#define GET_VT_ATTR(Ty, n, sz, Any, Int, FP, Vec, Sc, NElem, EltTy) \
423 if (FP == 3 && sz == BitWidth) \
425#include "llvm/CodeGen/GenVT.inc"
432#define GET_VT_ATTR(Ty, n, sz, Any, Int, FP, Vec, Sc, NElem, EltTy) \
433 if (Int == 3 && sz == BitWidth) \
435#include "llvm/CodeGen/GenVT.inc"
442#define GET_VT_VECATTR(Ty, Sc, nElem, ElTy) \
443 if (!Sc && VT.SimpleTy == ElTy && NumElements == nElem) \
445#include "llvm/CodeGen/GenVT.inc"
452#define GET_VT_VECATTR(Ty, Sc, nElem, ElTy) \
453 if (Sc && VT.SimpleTy == ElTy && NumElements == nElem) \
455#include "llvm/CodeGen/GenVT.inc"
494 MVT::LAST_INTEGER_VALUETYPE,
505 MVT::LAST_VECTOR_VALUETYPE,
511 MVT::LAST_FIXEDLEN_VECTOR_VALUETYPE,
517 MVT::LAST_SCALABLE_VECTOR_VALUETYPE,
523 MVT::LAST_INTEGER_FIXEDLEN_VECTOR_VALUETYPE,
529 MVT::LAST_FP_FIXEDLEN_VECTOR_VALUETYPE,
535 MVT::LAST_INTEGER_SCALABLE_VECTOR_VALUETYPE,
541 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 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
static MVT getVectorVT(MVT VT, ElementCount EC)
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.
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.
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
static MVT getVectorVT(MVT VT, unsigned NumElements, bool IsScalable)
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