1 //===- Support/MachineValueType.h - Machine-Level types ---------*- 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 // This file defines the set of machine-level target independent types which 10 // legal values in the code generator use. 11 // 12 //===----------------------------------------------------------------------===// 13 14 #ifndef LLVM_SUPPORT_MACHINEVALUETYPE_H 15 #define LLVM_SUPPORT_MACHINEVALUETYPE_H 16 17 #include "llvm/ADT/iterator_range.h" 18 #include "llvm/Support/ErrorHandling.h" 19 #include "llvm/Support/MathExtras.h" 20 #include "llvm/Support/TypeSize.h" 21 #include <cassert> 22 23 namespace llvm { 24 25 class Type; 26 27 /// Machine Value Type. Every type that is supported natively by some 28 /// processor targeted by LLVM occurs here. This means that any legal value 29 /// type can be represented by an MVT. 30 class MVT { 31 public: 32 enum SimpleValueType : uint8_t { 33 // Simple value types that aren't explicitly part of this enumeration 34 // are considered extended value types. 35 INVALID_SIMPLE_VALUE_TYPE = 0, 36 37 // If you change this numbering, you must change the values in 38 // ValueTypes.td as well! 39 Other = 1, // This is a non-standard value 40 i1 = 2, // This is a 1 bit integer value 41 i8 = 3, // This is an 8 bit integer value 42 i16 = 4, // This is a 16 bit integer value 43 i32 = 5, // This is a 32 bit integer value 44 i64 = 6, // This is a 64 bit integer value 45 i128 = 7, // This is a 128 bit integer value 46 47 FIRST_INTEGER_VALUETYPE = i1, 48 LAST_INTEGER_VALUETYPE = i128, 49 50 bf16 = 8, // This is a 16 bit brain floating point value 51 f16 = 9, // This is a 16 bit floating point value 52 f32 = 10, // This is a 32 bit floating point value 53 f64 = 11, // This is a 64 bit floating point value 54 f80 = 12, // This is a 80 bit floating point value 55 f128 = 13, // This is a 128 bit floating point value 56 ppcf128 = 14, // This is a PPC 128-bit floating point value 57 58 FIRST_FP_VALUETYPE = bf16, 59 LAST_FP_VALUETYPE = ppcf128, 60 61 v1i1 = 15, // 1 x i1 62 v2i1 = 16, // 2 x i1 63 v4i1 = 17, // 4 x i1 64 v8i1 = 18, // 8 x i1 65 v16i1 = 19, // 16 x i1 66 v32i1 = 20, // 32 x i1 67 v64i1 = 21, // 64 x i1 68 v128i1 = 22, // 128 x i1 69 v256i1 = 23, // 256 x i1 70 v512i1 = 24, // 512 x i1 71 v1024i1 = 25, // 1024 x i1 72 73 v1i8 = 26, // 1 x i8 74 v2i8 = 27, // 2 x i8 75 v4i8 = 28, // 4 x i8 76 v8i8 = 29, // 8 x i8 77 v16i8 = 30, // 16 x i8 78 v32i8 = 31, // 32 x i8 79 v64i8 = 32, // 64 x i8 80 v128i8 = 33, //128 x i8 81 v256i8 = 34, //256 x i8 82 83 v1i16 = 35, // 1 x i16 84 v2i16 = 36, // 2 x i16 85 v3i16 = 37, // 3 x i16 86 v4i16 = 38, // 4 x i16 87 v8i16 = 39, // 8 x i16 88 v16i16 = 40, // 16 x i16 89 v32i16 = 41, // 32 x i16 90 v64i16 = 42, // 64 x i16 91 v128i16 = 43, //128 x i16 92 93 v1i32 = 44, // 1 x i32 94 v2i32 = 45, // 2 x i32 95 v3i32 = 46, // 3 x i32 96 v4i32 = 47, // 4 x i32 97 v5i32 = 48, // 5 x i32 98 v8i32 = 49, // 8 x i32 99 v16i32 = 50, // 16 x i32 100 v32i32 = 51, // 32 x i32 101 v64i32 = 52, // 64 x i32 102 v128i32 = 53, // 128 x i32 103 v256i32 = 54, // 256 x i32 104 v512i32 = 55, // 512 x i32 105 v1024i32 = 56, // 1024 x i32 106 v2048i32 = 57, // 2048 x i32 107 108 v1i64 = 58, // 1 x i64 109 v2i64 = 59, // 2 x i64 110 v4i64 = 60, // 4 x i64 111 v8i64 = 61, // 8 x i64 112 v16i64 = 62, // 16 x i64 113 v32i64 = 63, // 32 x i64 114 115 v1i128 = 64, // 1 x i128 116 117 FIRST_INTEGER_FIXEDLEN_VECTOR_VALUETYPE = v1i1, 118 LAST_INTEGER_FIXEDLEN_VECTOR_VALUETYPE = v1i128, 119 120 v2f16 = 65, // 2 x f16 121 v3f16 = 66, // 3 x f16 122 v4f16 = 67, // 4 x f16 123 v8f16 = 68, // 8 x f16 124 v16f16 = 69, // 16 x f16 125 v32f16 = 70, // 32 x f16 126 v64f16 = 71, // 64 x f16 127 v128f16 = 72, // 128 x f16 128 v2bf16 = 73, // 2 x bf16 129 v3bf16 = 74, // 3 x bf16 130 v4bf16 = 75, // 4 x bf16 131 v8bf16 = 76, // 8 x bf16 132 v16bf16 = 77, // 16 x bf16 133 v32bf16 = 78, // 32 x bf16 134 v64bf16 = 79, // 64 x bf16 135 v128bf16 = 80, // 128 x bf16 136 v1f32 = 81, // 1 x f32 137 v2f32 = 82, // 2 x f32 138 v3f32 = 83, // 3 x f32 139 v4f32 = 84, // 4 x f32 140 v5f32 = 85, // 5 x f32 141 v8f32 = 86, // 8 x f32 142 v16f32 = 87, // 16 x f32 143 v32f32 = 88, // 32 x f32 144 v64f32 = 89, // 64 x f32 145 v128f32 = 90, // 128 x f32 146 v256f32 = 91, // 256 x f32 147 v512f32 = 92, // 512 x f32 148 v1024f32 = 93, // 1024 x f32 149 v2048f32 = 94, // 2048 x f32 150 v1f64 = 95, // 1 x f64 151 v2f64 = 96, // 2 x f64 152 v4f64 = 97, // 4 x f64 153 v8f64 = 98, // 8 x f64 154 v16f64 = 99, // 16 x f64 155 v32f64 = 100, // 32 x f64 156 157 FIRST_FP_FIXEDLEN_VECTOR_VALUETYPE = v2f16, 158 LAST_FP_FIXEDLEN_VECTOR_VALUETYPE = v32f64, 159 160 FIRST_FIXEDLEN_VECTOR_VALUETYPE = v1i1, 161 LAST_FIXEDLEN_VECTOR_VALUETYPE = v32f64, 162 163 nxv1i1 = 101, // n x 1 x i1 164 nxv2i1 = 102, // n x 2 x i1 165 nxv4i1 = 103, // n x 4 x i1 166 nxv8i1 = 104, // n x 8 x i1 167 nxv16i1 = 105, // n x 16 x i1 168 nxv32i1 = 106, // n x 32 x i1 169 nxv64i1 = 107, // n x 64 x i1 170 171 nxv1i8 = 108, // n x 1 x i8 172 nxv2i8 = 109, // n x 2 x i8 173 nxv4i8 = 110, // n x 4 x i8 174 nxv8i8 = 111, // n x 8 x i8 175 nxv16i8 = 112, // n x 16 x i8 176 nxv32i8 = 113, // n x 32 x i8 177 nxv64i8 = 114, // n x 64 x i8 178 179 nxv1i16 = 115, // n x 1 x i16 180 nxv2i16 = 116, // n x 2 x i16 181 nxv4i16 = 117, // n x 4 x i16 182 nxv8i16 = 118, // n x 8 x i16 183 nxv16i16 = 119, // n x 16 x i16 184 nxv32i16 = 120, // n x 32 x i16 185 186 nxv1i32 = 121, // n x 1 x i32 187 nxv2i32 = 122, // n x 2 x i32 188 nxv4i32 = 123, // n x 4 x i32 189 nxv8i32 = 124, // n x 8 x i32 190 nxv16i32 = 125, // n x 16 x i32 191 nxv32i32 = 126, // n x 32 x i32 192 193 nxv1i64 = 127, // n x 1 x i64 194 nxv2i64 = 128, // n x 2 x i64 195 nxv4i64 = 129, // n x 4 x i64 196 nxv8i64 = 130, // n x 8 x i64 197 nxv16i64 = 131, // n x 16 x i64 198 nxv32i64 = 132, // n x 32 x i64 199 200 FIRST_INTEGER_SCALABLE_VECTOR_VALUETYPE = nxv1i1, 201 LAST_INTEGER_SCALABLE_VECTOR_VALUETYPE = nxv32i64, 202 203 nxv1f16 = 133, // n x 1 x f16 204 nxv2f16 = 134, // n x 2 x f16 205 nxv4f16 = 135, // n x 4 x f16 206 nxv8f16 = 136, // n x 8 x f16 207 nxv16f16 = 137, // n x 16 x f16 208 nxv32f16 = 138, // n x 32 x f16 209 nxv2bf16 = 139, // n x 2 x bf16 210 nxv4bf16 = 140, // n x 4 x bf16 211 nxv8bf16 = 141, // n x 8 x bf16 212 nxv1f32 = 142, // n x 1 x f32 213 nxv2f32 = 143, // n x 2 x f32 214 nxv4f32 = 144, // n x 4 x f32 215 nxv8f32 = 145, // n x 8 x f32 216 nxv16f32 = 146, // n x 16 x f32 217 nxv1f64 = 147, // n x 1 x f64 218 nxv2f64 = 148, // n x 2 x f64 219 nxv4f64 = 149, // n x 4 x f64 220 nxv8f64 = 150, // n x 8 x f64 221 222 FIRST_FP_SCALABLE_VECTOR_VALUETYPE = nxv1f16, 223 LAST_FP_SCALABLE_VECTOR_VALUETYPE = nxv8f64, 224 225 FIRST_SCALABLE_VECTOR_VALUETYPE = nxv1i1, 226 LAST_SCALABLE_VECTOR_VALUETYPE = nxv8f64, 227 228 FIRST_VECTOR_VALUETYPE = v1i1, 229 LAST_VECTOR_VALUETYPE = nxv8f64, 230 231 x86mmx = 151, // This is an X86 MMX value 232 233 Glue = 152, // This glues nodes together during pre-RA sched 234 235 isVoid = 153, // This has no value 236 237 Untyped = 154, // This value takes a register, but has 238 // unspecified type. The register class 239 // will be determined by the opcode. 240 241 exnref = 155, // WebAssembly's exnref type 242 243 FIRST_VALUETYPE = 1, // This is always the beginning of the list. 244 LAST_VALUETYPE = 156, // This always remains at the end of the list. 245 246 // This is the current maximum for LAST_VALUETYPE. 247 // MVT::MAX_ALLOWED_VALUETYPE is used for asserts and to size bit vectors 248 // This value must be a multiple of 32. 249 MAX_ALLOWED_VALUETYPE = 160, 250 251 // A value of type llvm::TokenTy 252 token = 248, 253 254 // This is MDNode or MDString. 255 Metadata = 249, 256 257 // An int value the size of the pointer of the current 258 // target to any address space. This must only be used internal to 259 // tblgen. Other than for overloading, we treat iPTRAny the same as iPTR. 260 iPTRAny = 250, 261 262 // A vector with any length and element size. This is used 263 // for intrinsics that have overloadings based on vector types. 264 // This is only for tblgen's consumption! 265 vAny = 251, 266 267 // Any floating-point or vector floating-point value. This is used 268 // for intrinsics that have overloadings based on floating-point types. 269 // This is only for tblgen's consumption! 270 fAny = 252, 271 272 // An integer or vector integer value of any bit width. This is 273 // used for intrinsics that have overloadings based on integer bit widths. 274 // This is only for tblgen's consumption! 275 iAny = 253, 276 277 // An int value the size of the pointer of the current 278 // target. This should only be used internal to tblgen! 279 iPTR = 254, 280 281 // Any type. This is used for intrinsics that have overloadings. 282 // This is only for tblgen's consumption! 283 Any = 255 284 }; 285 286 SimpleValueType SimpleTy = INVALID_SIMPLE_VALUE_TYPE; 287 288 constexpr MVT() = default; MVT(SimpleValueType SVT)289 constexpr MVT(SimpleValueType SVT) : SimpleTy(SVT) {} 290 291 bool operator>(const MVT& S) const { return SimpleTy > S.SimpleTy; } 292 bool operator<(const MVT& S) const { return SimpleTy < S.SimpleTy; } 293 bool operator==(const MVT& S) const { return SimpleTy == S.SimpleTy; } 294 bool operator!=(const MVT& S) const { return SimpleTy != S.SimpleTy; } 295 bool operator>=(const MVT& S) const { return SimpleTy >= S.SimpleTy; } 296 bool operator<=(const MVT& S) const { return SimpleTy <= S.SimpleTy; } 297 298 /// Return true if this is a valid simple valuetype. isValid()299 bool isValid() const { 300 return (SimpleTy >= MVT::FIRST_VALUETYPE && 301 SimpleTy < MVT::LAST_VALUETYPE); 302 } 303 304 /// Return true if this is a FP or a vector FP type. isFloatingPoint()305 bool isFloatingPoint() const { 306 return ((SimpleTy >= MVT::FIRST_FP_VALUETYPE && 307 SimpleTy <= MVT::LAST_FP_VALUETYPE) || 308 (SimpleTy >= MVT::FIRST_FP_FIXEDLEN_VECTOR_VALUETYPE && 309 SimpleTy <= MVT::LAST_FP_FIXEDLEN_VECTOR_VALUETYPE) || 310 (SimpleTy >= MVT::FIRST_FP_SCALABLE_VECTOR_VALUETYPE && 311 SimpleTy <= MVT::LAST_FP_SCALABLE_VECTOR_VALUETYPE)); 312 } 313 314 /// Return true if this is an integer or a vector integer type. isInteger()315 bool isInteger() const { 316 return ((SimpleTy >= MVT::FIRST_INTEGER_VALUETYPE && 317 SimpleTy <= MVT::LAST_INTEGER_VALUETYPE) || 318 (SimpleTy >= MVT::FIRST_INTEGER_FIXEDLEN_VECTOR_VALUETYPE && 319 SimpleTy <= MVT::LAST_INTEGER_FIXEDLEN_VECTOR_VALUETYPE) || 320 (SimpleTy >= MVT::FIRST_INTEGER_SCALABLE_VECTOR_VALUETYPE && 321 SimpleTy <= MVT::LAST_INTEGER_SCALABLE_VECTOR_VALUETYPE)); 322 } 323 324 /// Return true if this is an integer, not including vectors. isScalarInteger()325 bool isScalarInteger() const { 326 return (SimpleTy >= MVT::FIRST_INTEGER_VALUETYPE && 327 SimpleTy <= MVT::LAST_INTEGER_VALUETYPE); 328 } 329 330 /// Return true if this is a vector value type. isVector()331 bool isVector() const { 332 return (SimpleTy >= MVT::FIRST_VECTOR_VALUETYPE && 333 SimpleTy <= MVT::LAST_VECTOR_VALUETYPE); 334 } 335 336 /// Return true if this is a vector value type where the 337 /// runtime length is machine dependent isScalableVector()338 bool isScalableVector() const { 339 return (SimpleTy >= MVT::FIRST_SCALABLE_VECTOR_VALUETYPE && 340 SimpleTy <= MVT::LAST_SCALABLE_VECTOR_VALUETYPE); 341 } 342 isFixedLengthVector()343 bool isFixedLengthVector() const { 344 return (SimpleTy >= MVT::FIRST_FIXEDLEN_VECTOR_VALUETYPE && 345 SimpleTy <= MVT::LAST_FIXEDLEN_VECTOR_VALUETYPE); 346 } 347 348 /// Return true if this is a 16-bit vector type. is16BitVector()349 bool is16BitVector() const { 350 return (SimpleTy == MVT::v2i8 || SimpleTy == MVT::v1i16 || 351 SimpleTy == MVT::v16i1); 352 } 353 354 /// Return true if this is a 32-bit vector type. is32BitVector()355 bool is32BitVector() const { 356 return (SimpleTy == MVT::v32i1 || SimpleTy == MVT::v4i8 || 357 SimpleTy == MVT::v2i16 || SimpleTy == MVT::v1i32 || 358 SimpleTy == MVT::v2f16 || SimpleTy == MVT::v2bf16 || 359 SimpleTy == MVT::v1f32); 360 } 361 362 /// Return true if this is a 64-bit vector type. is64BitVector()363 bool is64BitVector() const { 364 return (SimpleTy == MVT::v64i1 || SimpleTy == MVT::v8i8 || 365 SimpleTy == MVT::v4i16 || SimpleTy == MVT::v2i32 || 366 SimpleTy == MVT::v1i64 || SimpleTy == MVT::v4f16 || 367 SimpleTy == MVT::v4bf16 ||SimpleTy == MVT::v2f32 || 368 SimpleTy == MVT::v1f64); 369 } 370 371 /// Return true if this is a 128-bit vector type. is128BitVector()372 bool is128BitVector() const { 373 return (SimpleTy == MVT::v128i1 || SimpleTy == MVT::v16i8 || 374 SimpleTy == MVT::v8i16 || SimpleTy == MVT::v4i32 || 375 SimpleTy == MVT::v2i64 || SimpleTy == MVT::v1i128 || 376 SimpleTy == MVT::v8f16 || SimpleTy == MVT::v8bf16 || 377 SimpleTy == MVT::v4f32 || SimpleTy == MVT::v2f64); 378 } 379 380 /// Return true if this is a 256-bit vector type. is256BitVector()381 bool is256BitVector() const { 382 return (SimpleTy == MVT::v16f16 || SimpleTy == MVT::v16bf16 || 383 SimpleTy == MVT::v8f32 || SimpleTy == MVT::v4f64 || 384 SimpleTy == MVT::v32i8 || SimpleTy == MVT::v16i16 || 385 SimpleTy == MVT::v8i32 || SimpleTy == MVT::v4i64 || 386 SimpleTy == MVT::v256i1); 387 } 388 389 /// Return true if this is a 512-bit vector type. is512BitVector()390 bool is512BitVector() const { 391 return (SimpleTy == MVT::v32f16 || SimpleTy == MVT::v32bf16 || 392 SimpleTy == MVT::v16f32 || SimpleTy == MVT::v8f64 || 393 SimpleTy == MVT::v512i1 || SimpleTy == MVT::v64i8 || 394 SimpleTy == MVT::v32i16 || SimpleTy == MVT::v16i32 || 395 SimpleTy == MVT::v8i64); 396 } 397 398 /// Return true if this is a 1024-bit vector type. is1024BitVector()399 bool is1024BitVector() const { 400 return (SimpleTy == MVT::v1024i1 || SimpleTy == MVT::v128i8 || 401 SimpleTy == MVT::v64i16 || SimpleTy == MVT::v32i32 || 402 SimpleTy == MVT::v16i64 || SimpleTy == MVT::v64f16 || 403 SimpleTy == MVT::v32f32 || SimpleTy == MVT::v16f64 || 404 SimpleTy == MVT::v64bf16); 405 } 406 407 /// Return true if this is a 2048-bit vector type. is2048BitVector()408 bool is2048BitVector() const { 409 return (SimpleTy == MVT::v256i8 || SimpleTy == MVT::v128i16 || 410 SimpleTy == MVT::v64i32 || SimpleTy == MVT::v32i64 || 411 SimpleTy == MVT::v128f16 || SimpleTy == MVT::v64f32 || 412 SimpleTy == MVT::v32f64 || SimpleTy == MVT::v128bf16); 413 } 414 415 /// Return true if this is an overloaded type for TableGen. isOverloaded()416 bool isOverloaded() const { 417 return (SimpleTy == MVT::Any || SimpleTy == MVT::iAny || 418 SimpleTy == MVT::fAny || SimpleTy == MVT::vAny || 419 SimpleTy == MVT::iPTRAny); 420 } 421 422 /// Return a VT for a vector type with the same element type but 423 /// half the number of elements. getHalfNumVectorElementsVT()424 MVT getHalfNumVectorElementsVT() const { 425 MVT EltVT = getVectorElementType(); 426 auto EltCnt = getVectorElementCount(); 427 assert(!(EltCnt.Min & 1) && "Splitting vector, but not in half!"); 428 return getVectorVT(EltVT, EltCnt / 2); 429 } 430 431 /// Returns true if the given vector is a power of 2. isPow2VectorType()432 bool isPow2VectorType() const { 433 unsigned NElts = getVectorNumElements(); 434 return !(NElts & (NElts - 1)); 435 } 436 437 /// Widens the length of the given vector MVT up to the nearest power of 2 438 /// and returns that type. getPow2VectorType()439 MVT getPow2VectorType() const { 440 if (isPow2VectorType()) 441 return *this; 442 443 unsigned NElts = getVectorNumElements(); 444 unsigned Pow2NElts = 1 << Log2_32_Ceil(NElts); 445 return MVT::getVectorVT(getVectorElementType(), Pow2NElts); 446 } 447 448 /// If this is a vector, return the element type, otherwise return this. getScalarType()449 MVT getScalarType() const { 450 return isVector() ? getVectorElementType() : *this; 451 } 452 getVectorElementType()453 MVT getVectorElementType() const { 454 switch (SimpleTy) { 455 default: 456 llvm_unreachable("Not a vector MVT!"); 457 case v1i1: 458 case v2i1: 459 case v4i1: 460 case v8i1: 461 case v16i1: 462 case v32i1: 463 case v64i1: 464 case v128i1: 465 case v256i1: 466 case v512i1: 467 case v1024i1: 468 case nxv1i1: 469 case nxv2i1: 470 case nxv4i1: 471 case nxv8i1: 472 case nxv16i1: 473 case nxv32i1: 474 case nxv64i1: return i1; 475 case v1i8: 476 case v2i8: 477 case v4i8: 478 case v8i8: 479 case v16i8: 480 case v32i8: 481 case v64i8: 482 case v128i8: 483 case v256i8: 484 case nxv1i8: 485 case nxv2i8: 486 case nxv4i8: 487 case nxv8i8: 488 case nxv16i8: 489 case nxv32i8: 490 case nxv64i8: return i8; 491 case v1i16: 492 case v2i16: 493 case v3i16: 494 case v4i16: 495 case v8i16: 496 case v16i16: 497 case v32i16: 498 case v64i16: 499 case v128i16: 500 case nxv1i16: 501 case nxv2i16: 502 case nxv4i16: 503 case nxv8i16: 504 case nxv16i16: 505 case nxv32i16: return i16; 506 case v1i32: 507 case v2i32: 508 case v3i32: 509 case v4i32: 510 case v5i32: 511 case v8i32: 512 case v16i32: 513 case v32i32: 514 case v64i32: 515 case v128i32: 516 case v256i32: 517 case v512i32: 518 case v1024i32: 519 case v2048i32: 520 case nxv1i32: 521 case nxv2i32: 522 case nxv4i32: 523 case nxv8i32: 524 case nxv16i32: 525 case nxv32i32: return i32; 526 case v1i64: 527 case v2i64: 528 case v4i64: 529 case v8i64: 530 case v16i64: 531 case v32i64: 532 case nxv1i64: 533 case nxv2i64: 534 case nxv4i64: 535 case nxv8i64: 536 case nxv16i64: 537 case nxv32i64: return i64; 538 case v1i128: return i128; 539 case v2f16: 540 case v3f16: 541 case v4f16: 542 case v8f16: 543 case v16f16: 544 case v32f16: 545 case v64f16: 546 case v128f16: 547 case nxv1f16: 548 case nxv2f16: 549 case nxv4f16: 550 case nxv8f16: 551 case nxv16f16: 552 case nxv32f16: return f16; 553 case v2bf16: 554 case v3bf16: 555 case v4bf16: 556 case v8bf16: 557 case v16bf16: 558 case v32bf16: 559 case v64bf16: 560 case v128bf16: 561 case nxv2bf16: 562 case nxv4bf16: 563 case nxv8bf16: return bf16; 564 case v1f32: 565 case v2f32: 566 case v3f32: 567 case v4f32: 568 case v5f32: 569 case v8f32: 570 case v16f32: 571 case v32f32: 572 case v64f32: 573 case v128f32: 574 case v256f32: 575 case v512f32: 576 case v1024f32: 577 case v2048f32: 578 case nxv1f32: 579 case nxv2f32: 580 case nxv4f32: 581 case nxv8f32: 582 case nxv16f32: return f32; 583 case v1f64: 584 case v2f64: 585 case v4f64: 586 case v8f64: 587 case v16f64: 588 case v32f64: 589 case nxv1f64: 590 case nxv2f64: 591 case nxv4f64: 592 case nxv8f64: return f64; 593 } 594 } 595 getVectorNumElements()596 unsigned getVectorNumElements() const { 597 switch (SimpleTy) { 598 default: 599 llvm_unreachable("Not a vector MVT!"); 600 case v2048i32: 601 case v2048f32: return 2048; 602 case v1024i1: 603 case v1024i32: 604 case v1024f32: return 1024; 605 case v512i1: 606 case v512i32: 607 case v512f32: return 512; 608 case v256i1: 609 case v256i8: 610 case v256i32: 611 case v256f32: return 256; 612 case v128i1: 613 case v128i8: 614 case v128i16: 615 case v128i32: 616 case v128f16: 617 case v128bf16: 618 case v128f32: return 128; 619 case v64i1: 620 case v64i8: 621 case v64i16: 622 case v64i32: 623 case v64f16: 624 case v64bf16: 625 case v64f32: 626 case nxv64i1: 627 case nxv64i8: return 64; 628 case v32i1: 629 case v32i8: 630 case v32i16: 631 case v32i32: 632 case v32i64: 633 case v32f16: 634 case v32bf16: 635 case v32f32: 636 case v32f64: 637 case nxv32i1: 638 case nxv32i8: 639 case nxv32i16: 640 case nxv32i32: 641 case nxv32i64: 642 case nxv32f16: return 32; 643 case v16i1: 644 case v16i8: 645 case v16i16: 646 case v16i32: 647 case v16i64: 648 case v16f16: 649 case v16bf16: 650 case v16f32: 651 case v16f64: 652 case nxv16i1: 653 case nxv16i8: 654 case nxv16i16: 655 case nxv16i32: 656 case nxv16i64: 657 case nxv16f16: 658 case nxv16f32: return 16; 659 case v8i1: 660 case v8i8: 661 case v8i16: 662 case v8i32: 663 case v8i64: 664 case v8f16: 665 case v8bf16: 666 case v8f32: 667 case v8f64: 668 case nxv8i1: 669 case nxv8i8: 670 case nxv8i16: 671 case nxv8i32: 672 case nxv8i64: 673 case nxv8f16: 674 case nxv8bf16: 675 case nxv8f32: 676 case nxv8f64: return 8; 677 case v5i32: 678 case v5f32: return 5; 679 case v4i1: 680 case v4i8: 681 case v4i16: 682 case v4i32: 683 case v4i64: 684 case v4f16: 685 case v4bf16: 686 case v4f32: 687 case v4f64: 688 case nxv4i1: 689 case nxv4i8: 690 case nxv4i16: 691 case nxv4i32: 692 case nxv4i64: 693 case nxv4f16: 694 case nxv4bf16: 695 case nxv4f32: 696 case nxv4f64: return 4; 697 case v3i16: 698 case v3i32: 699 case v3f16: 700 case v3bf16: 701 case v3f32: return 3; 702 case v2i1: 703 case v2i8: 704 case v2i16: 705 case v2i32: 706 case v2i64: 707 case v2f16: 708 case v2bf16: 709 case v2f32: 710 case v2f64: 711 case nxv2i1: 712 case nxv2i8: 713 case nxv2i16: 714 case nxv2i32: 715 case nxv2i64: 716 case nxv2f16: 717 case nxv2bf16: 718 case nxv2f32: 719 case nxv2f64: return 2; 720 case v1i1: 721 case v1i8: 722 case v1i16: 723 case v1i32: 724 case v1i64: 725 case v1i128: 726 case v1f32: 727 case v1f64: 728 case nxv1i1: 729 case nxv1i8: 730 case nxv1i16: 731 case nxv1i32: 732 case nxv1i64: 733 case nxv1f16: 734 case nxv1f32: 735 case nxv1f64: return 1; 736 } 737 } 738 getVectorElementCount()739 ElementCount getVectorElementCount() const { 740 return { getVectorNumElements(), isScalableVector() }; 741 } 742 743 /// Given a vector type, return the minimum number of elements it contains. getVectorMinNumElements()744 unsigned getVectorMinNumElements() const { 745 return getVectorElementCount().Min; 746 } 747 748 /// Returns the size of the specified MVT in bits. 749 /// 750 /// If the value type is a scalable vector type, the scalable property will 751 /// be set and the runtime size will be a positive integer multiple of the 752 /// base size. getSizeInBits()753 TypeSize getSizeInBits() const { 754 switch (SimpleTy) { 755 default: 756 llvm_unreachable("getSizeInBits called on extended MVT."); 757 case Other: 758 llvm_unreachable("Value type is non-standard value, Other."); 759 case iPTR: 760 llvm_unreachable("Value type size is target-dependent. Ask TLI."); 761 case iPTRAny: 762 case iAny: 763 case fAny: 764 case vAny: 765 case Any: 766 llvm_unreachable("Value type is overloaded."); 767 case token: 768 llvm_unreachable("Token type is a sentinel that cannot be used " 769 "in codegen and has no size"); 770 case Metadata: 771 llvm_unreachable("Value type is metadata."); 772 case i1: 773 case v1i1: return TypeSize::Fixed(1); 774 case nxv1i1: return TypeSize::Scalable(1); 775 case v2i1: return TypeSize::Fixed(2); 776 case nxv2i1: return TypeSize::Scalable(2); 777 case v4i1: return TypeSize::Fixed(4); 778 case nxv4i1: return TypeSize::Scalable(4); 779 case i8 : 780 case v1i8: 781 case v8i1: return TypeSize::Fixed(8); 782 case nxv1i8: 783 case nxv8i1: return TypeSize::Scalable(8); 784 case i16 : 785 case f16: 786 case bf16: 787 case v16i1: 788 case v2i8: 789 case v1i16: return TypeSize::Fixed(16); 790 case nxv16i1: 791 case nxv2i8: 792 case nxv1i16: 793 case nxv1f16: return TypeSize::Scalable(16); 794 case f32 : 795 case i32 : 796 case v32i1: 797 case v4i8: 798 case v2i16: 799 case v2f16: 800 case v2bf16: 801 case v1f32: 802 case v1i32: return TypeSize::Fixed(32); 803 case nxv32i1: 804 case nxv4i8: 805 case nxv2i16: 806 case nxv1i32: 807 case nxv2f16: 808 case nxv2bf16: 809 case nxv1f32: return TypeSize::Scalable(32); 810 case v3i16: 811 case v3f16: 812 case v3bf16: return TypeSize::Fixed(48); 813 case x86mmx: 814 case f64 : 815 case i64 : 816 case v64i1: 817 case v8i8: 818 case v4i16: 819 case v2i32: 820 case v1i64: 821 case v4f16: 822 case v4bf16: 823 case v2f32: 824 case v1f64: return TypeSize::Fixed(64); 825 case nxv64i1: 826 case nxv8i8: 827 case nxv4i16: 828 case nxv2i32: 829 case nxv1i64: 830 case nxv4f16: 831 case nxv4bf16: 832 case nxv2f32: 833 case nxv1f64: return TypeSize::Scalable(64); 834 case f80 : return TypeSize::Fixed(80); 835 case v3i32: 836 case v3f32: return TypeSize::Fixed(96); 837 case f128: 838 case ppcf128: 839 case i128: 840 case v128i1: 841 case v16i8: 842 case v8i16: 843 case v4i32: 844 case v2i64: 845 case v1i128: 846 case v8f16: 847 case v8bf16: 848 case v4f32: 849 case v2f64: return TypeSize::Fixed(128); 850 case nxv16i8: 851 case nxv8i16: 852 case nxv4i32: 853 case nxv2i64: 854 case nxv8f16: 855 case nxv8bf16: 856 case nxv4f32: 857 case nxv2f64: return TypeSize::Scalable(128); 858 case v5i32: 859 case v5f32: return TypeSize::Fixed(160); 860 case v256i1: 861 case v32i8: 862 case v16i16: 863 case v8i32: 864 case v4i64: 865 case v16f16: 866 case v16bf16: 867 case v8f32: 868 case v4f64: return TypeSize::Fixed(256); 869 case nxv32i8: 870 case nxv16i16: 871 case nxv8i32: 872 case nxv4i64: 873 case nxv16f16: 874 case nxv8f32: 875 case nxv4f64: return TypeSize::Scalable(256); 876 case v512i1: 877 case v64i8: 878 case v32i16: 879 case v16i32: 880 case v8i64: 881 case v32f16: 882 case v32bf16: 883 case v16f32: 884 case v8f64: return TypeSize::Fixed(512); 885 case nxv64i8: 886 case nxv32i16: 887 case nxv16i32: 888 case nxv8i64: 889 case nxv32f16: 890 case nxv16f32: 891 case nxv8f64: return TypeSize::Scalable(512); 892 case v1024i1: 893 case v128i8: 894 case v64i16: 895 case v32i32: 896 case v16i64: 897 case v64f16: 898 case v64bf16: 899 case v32f32: 900 case v16f64: return TypeSize::Fixed(1024); 901 case nxv32i32: 902 case nxv16i64: return TypeSize::Scalable(1024); 903 case v256i8: 904 case v128i16: 905 case v64i32: 906 case v32i64: 907 case v128f16: 908 case v128bf16: 909 case v64f32: 910 case v32f64: return TypeSize::Fixed(2048); 911 case nxv32i64: return TypeSize::Scalable(2048); 912 case v128i32: 913 case v128f32: return TypeSize::Fixed(4096); 914 case v256i32: 915 case v256f32: return TypeSize::Fixed(8192); 916 case v512i32: 917 case v512f32: return TypeSize::Fixed(16384); 918 case v1024i32: 919 case v1024f32: return TypeSize::Fixed(32768); 920 case v2048i32: 921 case v2048f32: return TypeSize::Fixed(65536); 922 case exnref: return TypeSize::Fixed(0); // opaque type 923 } 924 } 925 getScalarSizeInBits()926 TypeSize getScalarSizeInBits() const { 927 return getScalarType().getSizeInBits(); 928 } 929 930 /// Return the number of bytes overwritten by a store of the specified value 931 /// type. 932 /// 933 /// If the value type is a scalable vector type, the scalable property will 934 /// be set and the runtime size will be a positive integer multiple of the 935 /// base size. getStoreSize()936 TypeSize getStoreSize() const { 937 TypeSize BaseSize = getSizeInBits(); 938 return {(BaseSize.getKnownMinSize() + 7) / 8, BaseSize.isScalable()}; 939 } 940 941 /// Return the number of bits overwritten by a store of the specified value 942 /// type. 943 /// 944 /// If the value type is a scalable vector type, the scalable property will 945 /// be set and the runtime size will be a positive integer multiple of the 946 /// base size. getStoreSizeInBits()947 TypeSize getStoreSizeInBits() const { 948 return getStoreSize() * 8; 949 } 950 951 /// Returns true if the number of bits for the type is a multiple of an 952 /// 8-bit byte. isByteSized()953 bool isByteSized() const { 954 return getSizeInBits().isByteSized(); 955 } 956 957 /// Return true if this has more bits than VT. bitsGT(MVT VT)958 bool bitsGT(MVT VT) const { 959 return getSizeInBits() > VT.getSizeInBits(); 960 } 961 962 /// Return true if this has no less bits than VT. bitsGE(MVT VT)963 bool bitsGE(MVT VT) const { 964 return getSizeInBits() >= VT.getSizeInBits(); 965 } 966 967 /// Return true if this has less bits than VT. bitsLT(MVT VT)968 bool bitsLT(MVT VT) const { 969 return getSizeInBits() < VT.getSizeInBits(); 970 } 971 972 /// Return true if this has no more bits than VT. bitsLE(MVT VT)973 bool bitsLE(MVT VT) const { 974 return getSizeInBits() <= VT.getSizeInBits(); 975 } 976 getFloatingPointVT(unsigned BitWidth)977 static MVT getFloatingPointVT(unsigned BitWidth) { 978 switch (BitWidth) { 979 default: 980 llvm_unreachable("Bad bit width!"); 981 case 16: 982 return MVT::f16; 983 case 32: 984 return MVT::f32; 985 case 64: 986 return MVT::f64; 987 case 80: 988 return MVT::f80; 989 case 128: 990 return MVT::f128; 991 } 992 } 993 getIntegerVT(unsigned BitWidth)994 static MVT getIntegerVT(unsigned BitWidth) { 995 switch (BitWidth) { 996 default: 997 return (MVT::SimpleValueType)(MVT::INVALID_SIMPLE_VALUE_TYPE); 998 case 1: 999 return MVT::i1; 1000 case 8: 1001 return MVT::i8; 1002 case 16: 1003 return MVT::i16; 1004 case 32: 1005 return MVT::i32; 1006 case 64: 1007 return MVT::i64; 1008 case 128: 1009 return MVT::i128; 1010 } 1011 } 1012 getVectorVT(MVT VT,unsigned NumElements)1013 static MVT getVectorVT(MVT VT, unsigned NumElements) { 1014 switch (VT.SimpleTy) { 1015 default: 1016 break; 1017 case MVT::i1: 1018 if (NumElements == 1) return MVT::v1i1; 1019 if (NumElements == 2) return MVT::v2i1; 1020 if (NumElements == 4) return MVT::v4i1; 1021 if (NumElements == 8) return MVT::v8i1; 1022 if (NumElements == 16) return MVT::v16i1; 1023 if (NumElements == 32) return MVT::v32i1; 1024 if (NumElements == 64) return MVT::v64i1; 1025 if (NumElements == 128) return MVT::v128i1; 1026 if (NumElements == 256) return MVT::v256i1; 1027 if (NumElements == 512) return MVT::v512i1; 1028 if (NumElements == 1024) return MVT::v1024i1; 1029 break; 1030 case MVT::i8: 1031 if (NumElements == 1) return MVT::v1i8; 1032 if (NumElements == 2) return MVT::v2i8; 1033 if (NumElements == 4) return MVT::v4i8; 1034 if (NumElements == 8) return MVT::v8i8; 1035 if (NumElements == 16) return MVT::v16i8; 1036 if (NumElements == 32) return MVT::v32i8; 1037 if (NumElements == 64) return MVT::v64i8; 1038 if (NumElements == 128) return MVT::v128i8; 1039 if (NumElements == 256) return MVT::v256i8; 1040 break; 1041 case MVT::i16: 1042 if (NumElements == 1) return MVT::v1i16; 1043 if (NumElements == 2) return MVT::v2i16; 1044 if (NumElements == 3) return MVT::v3i16; 1045 if (NumElements == 4) return MVT::v4i16; 1046 if (NumElements == 8) return MVT::v8i16; 1047 if (NumElements == 16) return MVT::v16i16; 1048 if (NumElements == 32) return MVT::v32i16; 1049 if (NumElements == 64) return MVT::v64i16; 1050 if (NumElements == 128) return MVT::v128i16; 1051 break; 1052 case MVT::i32: 1053 if (NumElements == 1) return MVT::v1i32; 1054 if (NumElements == 2) return MVT::v2i32; 1055 if (NumElements == 3) return MVT::v3i32; 1056 if (NumElements == 4) return MVT::v4i32; 1057 if (NumElements == 5) return MVT::v5i32; 1058 if (NumElements == 8) return MVT::v8i32; 1059 if (NumElements == 16) return MVT::v16i32; 1060 if (NumElements == 32) return MVT::v32i32; 1061 if (NumElements == 64) return MVT::v64i32; 1062 if (NumElements == 128) return MVT::v128i32; 1063 if (NumElements == 256) return MVT::v256i32; 1064 if (NumElements == 512) return MVT::v512i32; 1065 if (NumElements == 1024) return MVT::v1024i32; 1066 if (NumElements == 2048) return MVT::v2048i32; 1067 break; 1068 case MVT::i64: 1069 if (NumElements == 1) return MVT::v1i64; 1070 if (NumElements == 2) return MVT::v2i64; 1071 if (NumElements == 4) return MVT::v4i64; 1072 if (NumElements == 8) return MVT::v8i64; 1073 if (NumElements == 16) return MVT::v16i64; 1074 if (NumElements == 32) return MVT::v32i64; 1075 break; 1076 case MVT::i128: 1077 if (NumElements == 1) return MVT::v1i128; 1078 break; 1079 case MVT::f16: 1080 if (NumElements == 2) return MVT::v2f16; 1081 if (NumElements == 3) return MVT::v3f16; 1082 if (NumElements == 4) return MVT::v4f16; 1083 if (NumElements == 8) return MVT::v8f16; 1084 if (NumElements == 16) return MVT::v16f16; 1085 if (NumElements == 32) return MVT::v32f16; 1086 if (NumElements == 64) return MVT::v64f16; 1087 if (NumElements == 128) return MVT::v128f16; 1088 break; 1089 case MVT::bf16: 1090 if (NumElements == 2) return MVT::v2bf16; 1091 if (NumElements == 3) return MVT::v3bf16; 1092 if (NumElements == 4) return MVT::v4bf16; 1093 if (NumElements == 8) return MVT::v8bf16; 1094 if (NumElements == 16) return MVT::v16bf16; 1095 if (NumElements == 32) return MVT::v32bf16; 1096 if (NumElements == 64) return MVT::v64bf16; 1097 if (NumElements == 128) return MVT::v128bf16; 1098 break; 1099 case MVT::f32: 1100 if (NumElements == 1) return MVT::v1f32; 1101 if (NumElements == 2) return MVT::v2f32; 1102 if (NumElements == 3) return MVT::v3f32; 1103 if (NumElements == 4) return MVT::v4f32; 1104 if (NumElements == 5) return MVT::v5f32; 1105 if (NumElements == 8) return MVT::v8f32; 1106 if (NumElements == 16) return MVT::v16f32; 1107 if (NumElements == 32) return MVT::v32f32; 1108 if (NumElements == 64) return MVT::v64f32; 1109 if (NumElements == 128) return MVT::v128f32; 1110 if (NumElements == 256) return MVT::v256f32; 1111 if (NumElements == 512) return MVT::v512f32; 1112 if (NumElements == 1024) return MVT::v1024f32; 1113 if (NumElements == 2048) return MVT::v2048f32; 1114 break; 1115 case MVT::f64: 1116 if (NumElements == 1) return MVT::v1f64; 1117 if (NumElements == 2) return MVT::v2f64; 1118 if (NumElements == 4) return MVT::v4f64; 1119 if (NumElements == 8) return MVT::v8f64; 1120 if (NumElements == 16) return MVT::v16f64; 1121 if (NumElements == 32) return MVT::v32f64; 1122 break; 1123 } 1124 return (MVT::SimpleValueType)(MVT::INVALID_SIMPLE_VALUE_TYPE); 1125 } 1126 getScalableVectorVT(MVT VT,unsigned NumElements)1127 static MVT getScalableVectorVT(MVT VT, unsigned NumElements) { 1128 switch(VT.SimpleTy) { 1129 default: 1130 break; 1131 case MVT::i1: 1132 if (NumElements == 1) return MVT::nxv1i1; 1133 if (NumElements == 2) return MVT::nxv2i1; 1134 if (NumElements == 4) return MVT::nxv4i1; 1135 if (NumElements == 8) return MVT::nxv8i1; 1136 if (NumElements == 16) return MVT::nxv16i1; 1137 if (NumElements == 32) return MVT::nxv32i1; 1138 if (NumElements == 64) return MVT::nxv64i1; 1139 break; 1140 case MVT::i8: 1141 if (NumElements == 1) return MVT::nxv1i8; 1142 if (NumElements == 2) return MVT::nxv2i8; 1143 if (NumElements == 4) return MVT::nxv4i8; 1144 if (NumElements == 8) return MVT::nxv8i8; 1145 if (NumElements == 16) return MVT::nxv16i8; 1146 if (NumElements == 32) return MVT::nxv32i8; 1147 if (NumElements == 64) return MVT::nxv64i8; 1148 break; 1149 case MVT::i16: 1150 if (NumElements == 1) return MVT::nxv1i16; 1151 if (NumElements == 2) return MVT::nxv2i16; 1152 if (NumElements == 4) return MVT::nxv4i16; 1153 if (NumElements == 8) return MVT::nxv8i16; 1154 if (NumElements == 16) return MVT::nxv16i16; 1155 if (NumElements == 32) return MVT::nxv32i16; 1156 break; 1157 case MVT::i32: 1158 if (NumElements == 1) return MVT::nxv1i32; 1159 if (NumElements == 2) return MVT::nxv2i32; 1160 if (NumElements == 4) return MVT::nxv4i32; 1161 if (NumElements == 8) return MVT::nxv8i32; 1162 if (NumElements == 16) return MVT::nxv16i32; 1163 if (NumElements == 32) return MVT::nxv32i32; 1164 break; 1165 case MVT::i64: 1166 if (NumElements == 1) return MVT::nxv1i64; 1167 if (NumElements == 2) return MVT::nxv2i64; 1168 if (NumElements == 4) return MVT::nxv4i64; 1169 if (NumElements == 8) return MVT::nxv8i64; 1170 if (NumElements == 16) return MVT::nxv16i64; 1171 if (NumElements == 32) return MVT::nxv32i64; 1172 break; 1173 case MVT::f16: 1174 if (NumElements == 1) return MVT::nxv1f16; 1175 if (NumElements == 2) return MVT::nxv2f16; 1176 if (NumElements == 4) return MVT::nxv4f16; 1177 if (NumElements == 8) return MVT::nxv8f16; 1178 if (NumElements == 16) return MVT::nxv16f16; 1179 if (NumElements == 32) return MVT::nxv32f16; 1180 break; 1181 case MVT::bf16: 1182 if (NumElements == 2) return MVT::nxv2bf16; 1183 if (NumElements == 4) return MVT::nxv4bf16; 1184 if (NumElements == 8) return MVT::nxv8bf16; 1185 break; 1186 case MVT::f32: 1187 if (NumElements == 1) return MVT::nxv1f32; 1188 if (NumElements == 2) return MVT::nxv2f32; 1189 if (NumElements == 4) return MVT::nxv4f32; 1190 if (NumElements == 8) return MVT::nxv8f32; 1191 if (NumElements == 16) return MVT::nxv16f32; 1192 break; 1193 case MVT::f64: 1194 if (NumElements == 1) return MVT::nxv1f64; 1195 if (NumElements == 2) return MVT::nxv2f64; 1196 if (NumElements == 4) return MVT::nxv4f64; 1197 if (NumElements == 8) return MVT::nxv8f64; 1198 break; 1199 } 1200 return (MVT::SimpleValueType)(MVT::INVALID_SIMPLE_VALUE_TYPE); 1201 } 1202 getVectorVT(MVT VT,unsigned NumElements,bool IsScalable)1203 static MVT getVectorVT(MVT VT, unsigned NumElements, bool IsScalable) { 1204 if (IsScalable) 1205 return getScalableVectorVT(VT, NumElements); 1206 return getVectorVT(VT, NumElements); 1207 } 1208 getVectorVT(MVT VT,ElementCount EC)1209 static MVT getVectorVT(MVT VT, ElementCount EC) { 1210 if (EC.Scalable) 1211 return getScalableVectorVT(VT, EC.Min); 1212 return getVectorVT(VT, EC.Min); 1213 } 1214 1215 /// Return the value type corresponding to the specified type. This returns 1216 /// all pointers as iPTR. If HandleUnknown is true, unknown types are 1217 /// returned as Other, otherwise they are invalid. 1218 static MVT getVT(Type *Ty, bool HandleUnknown = false); 1219 1220 private: 1221 /// A simple iterator over the MVT::SimpleValueType enum. 1222 struct mvt_iterator { 1223 SimpleValueType VT; 1224 mvt_iteratormvt_iterator1225 mvt_iterator(SimpleValueType VT) : VT(VT) {} 1226 1227 MVT operator*() const { return VT; } 1228 bool operator!=(const mvt_iterator &LHS) const { return VT != LHS.VT; } 1229 1230 mvt_iterator& operator++() { 1231 VT = (MVT::SimpleValueType)((int)VT + 1); 1232 assert((int)VT <= MVT::MAX_ALLOWED_VALUETYPE && 1233 "MVT iterator overflowed."); 1234 return *this; 1235 } 1236 }; 1237 1238 /// A range of the MVT::SimpleValueType enum. 1239 using mvt_range = iterator_range<mvt_iterator>; 1240 1241 public: 1242 /// SimpleValueType Iteration 1243 /// @{ all_valuetypes()1244 static mvt_range all_valuetypes() { 1245 return mvt_range(MVT::FIRST_VALUETYPE, MVT::LAST_VALUETYPE); 1246 } 1247 integer_valuetypes()1248 static mvt_range integer_valuetypes() { 1249 return mvt_range(MVT::FIRST_INTEGER_VALUETYPE, 1250 (MVT::SimpleValueType)(MVT::LAST_INTEGER_VALUETYPE + 1)); 1251 } 1252 fp_valuetypes()1253 static mvt_range fp_valuetypes() { 1254 return mvt_range(MVT::FIRST_FP_VALUETYPE, 1255 (MVT::SimpleValueType)(MVT::LAST_FP_VALUETYPE + 1)); 1256 } 1257 vector_valuetypes()1258 static mvt_range vector_valuetypes() { 1259 return mvt_range(MVT::FIRST_VECTOR_VALUETYPE, 1260 (MVT::SimpleValueType)(MVT::LAST_VECTOR_VALUETYPE + 1)); 1261 } 1262 fixedlen_vector_valuetypes()1263 static mvt_range fixedlen_vector_valuetypes() { 1264 return mvt_range( 1265 MVT::FIRST_FIXEDLEN_VECTOR_VALUETYPE, 1266 (MVT::SimpleValueType)(MVT::LAST_FIXEDLEN_VECTOR_VALUETYPE + 1)); 1267 } 1268 scalable_vector_valuetypes()1269 static mvt_range scalable_vector_valuetypes() { 1270 return mvt_range( 1271 MVT::FIRST_SCALABLE_VECTOR_VALUETYPE, 1272 (MVT::SimpleValueType)(MVT::LAST_SCALABLE_VECTOR_VALUETYPE + 1)); 1273 } 1274 integer_fixedlen_vector_valuetypes()1275 static mvt_range integer_fixedlen_vector_valuetypes() { 1276 return mvt_range( 1277 MVT::FIRST_INTEGER_FIXEDLEN_VECTOR_VALUETYPE, 1278 (MVT::SimpleValueType)(MVT::LAST_INTEGER_FIXEDLEN_VECTOR_VALUETYPE + 1)); 1279 } 1280 fp_fixedlen_vector_valuetypes()1281 static mvt_range fp_fixedlen_vector_valuetypes() { 1282 return mvt_range( 1283 MVT::FIRST_FP_FIXEDLEN_VECTOR_VALUETYPE, 1284 (MVT::SimpleValueType)(MVT::LAST_FP_FIXEDLEN_VECTOR_VALUETYPE + 1)); 1285 } 1286 integer_scalable_vector_valuetypes()1287 static mvt_range integer_scalable_vector_valuetypes() { 1288 return mvt_range( 1289 MVT::FIRST_INTEGER_SCALABLE_VECTOR_VALUETYPE, 1290 (MVT::SimpleValueType)(MVT::LAST_INTEGER_SCALABLE_VECTOR_VALUETYPE + 1)); 1291 } 1292 fp_scalable_vector_valuetypes()1293 static mvt_range fp_scalable_vector_valuetypes() { 1294 return mvt_range( 1295 MVT::FIRST_FP_SCALABLE_VECTOR_VALUETYPE, 1296 (MVT::SimpleValueType)(MVT::LAST_FP_SCALABLE_VECTOR_VALUETYPE + 1)); 1297 } 1298 /// @} 1299 }; 1300 1301 } // end namespace llvm 1302 1303 #endif // LLVM_CODEGEN_MACHINEVALUETYPE_H 1304