/Users/buildslave/jenkins/sharedspace/clang-stage2-coverage-R@2/llvm/include/llvm/CodeGen/MachineValueType.h
Line | Count | Source (jump to first uncovered line) |
1 | | //===- CodeGen/MachineValueType.h - Machine-Level types ---------*- C++ -*-===// |
2 | | // |
3 | | // The LLVM Compiler Infrastructure |
4 | | // |
5 | | // This file is distributed under the University of Illinois Open Source |
6 | | // License. See LICENSE.TXT for details. |
7 | | // |
8 | | //===----------------------------------------------------------------------===// |
9 | | // |
10 | | // This file defines the set of machine-level target independent types which |
11 | | // legal values in the code generator use. |
12 | | // |
13 | | //===----------------------------------------------------------------------===// |
14 | | |
15 | | #ifndef LLVM_CODEGEN_MACHINEVALUETYPE_H |
16 | | #define LLVM_CODEGEN_MACHINEVALUETYPE_H |
17 | | |
18 | | #include "llvm/ADT/iterator_range.h" |
19 | | #include "llvm/Support/ErrorHandling.h" |
20 | | #include "llvm/Support/MathExtras.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 | | f16 = 8, // This is a 16 bit floating point value |
51 | | f32 = 9, // This is a 32 bit floating point value |
52 | | f64 = 10, // This is a 64 bit floating point value |
53 | | f80 = 11, // This is a 80 bit floating point value |
54 | | f128 = 12, // This is a 128 bit floating point value |
55 | | ppcf128 = 13, // This is a PPC 128-bit floating point value |
56 | | |
57 | | FIRST_FP_VALUETYPE = f16, |
58 | | LAST_FP_VALUETYPE = ppcf128, |
59 | | |
60 | | v1i1 = 14, // 1 x i1 |
61 | | v2i1 = 15, // 2 x i1 |
62 | | v4i1 = 16, // 4 x i1 |
63 | | v8i1 = 17, // 8 x i1 |
64 | | v16i1 = 18, // 16 x i1 |
65 | | v32i1 = 19, // 32 x i1 |
66 | | v64i1 = 20, // 64 x i1 |
67 | | v512i1 = 21, // 512 x i1 |
68 | | v1024i1 = 22, // 1024 x i1 |
69 | | |
70 | | v1i8 = 23, // 1 x i8 |
71 | | v2i8 = 24, // 2 x i8 |
72 | | v4i8 = 25, // 4 x i8 |
73 | | v8i8 = 26, // 8 x i8 |
74 | | v16i8 = 27, // 16 x i8 |
75 | | v32i8 = 28, // 32 x i8 |
76 | | v64i8 = 29, // 64 x i8 |
77 | | v128i8 = 30, //128 x i8 |
78 | | v256i8 = 31, //256 x i8 |
79 | | |
80 | | v1i16 = 32, // 1 x i16 |
81 | | v2i16 = 33, // 2 x i16 |
82 | | v4i16 = 34, // 4 x i16 |
83 | | v8i16 = 35, // 8 x i16 |
84 | | v16i16 = 36, // 16 x i16 |
85 | | v32i16 = 37, // 32 x i16 |
86 | | v64i16 = 38, // 64 x i16 |
87 | | v128i16 = 39, //128 x i16 |
88 | | |
89 | | v1i32 = 40, // 1 x i32 |
90 | | v2i32 = 41, // 2 x i32 |
91 | | v4i32 = 42, // 4 x i32 |
92 | | v8i32 = 43, // 8 x i32 |
93 | | v16i32 = 44, // 16 x i32 |
94 | | v32i32 = 45, // 32 x i32 |
95 | | v64i32 = 46, // 64 x i32 |
96 | | |
97 | | v1i64 = 47, // 1 x i64 |
98 | | v2i64 = 48, // 2 x i64 |
99 | | v4i64 = 49, // 4 x i64 |
100 | | v8i64 = 50, // 8 x i64 |
101 | | v16i64 = 51, // 16 x i64 |
102 | | v32i64 = 52, // 32 x i64 |
103 | | |
104 | | v1i128 = 53, // 1 x i128 |
105 | | |
106 | | // Scalable integer types |
107 | | nxv1i1 = 54, // n x 1 x i1 |
108 | | nxv2i1 = 55, // n x 2 x i1 |
109 | | nxv4i1 = 56, // n x 4 x i1 |
110 | | nxv8i1 = 57, // n x 8 x i1 |
111 | | nxv16i1 = 58, // n x 16 x i1 |
112 | | nxv32i1 = 59, // n x 32 x i1 |
113 | | |
114 | | nxv1i8 = 60, // n x 1 x i8 |
115 | | nxv2i8 = 61, // n x 2 x i8 |
116 | | nxv4i8 = 62, // n x 4 x i8 |
117 | | nxv8i8 = 63, // n x 8 x i8 |
118 | | nxv16i8 = 64, // n x 16 x i8 |
119 | | nxv32i8 = 65, // n x 32 x i8 |
120 | | |
121 | | nxv1i16 = 66, // n x 1 x i16 |
122 | | nxv2i16 = 67, // n x 2 x i16 |
123 | | nxv4i16 = 68, // n x 4 x i16 |
124 | | nxv8i16 = 69, // n x 8 x i16 |
125 | | nxv16i16 = 70, // n x 16 x i16 |
126 | | nxv32i16 = 71, // n x 32 x i16 |
127 | | |
128 | | nxv1i32 = 72, // n x 1 x i32 |
129 | | nxv2i32 = 73, // n x 2 x i32 |
130 | | nxv4i32 = 74, // n x 4 x i32 |
131 | | nxv8i32 = 75, // n x 8 x i32 |
132 | | nxv16i32 = 76, // n x 16 x i32 |
133 | | nxv32i32 = 77, // n x 32 x i32 |
134 | | |
135 | | nxv1i64 = 78, // n x 1 x i64 |
136 | | nxv2i64 = 79, // n x 2 x i64 |
137 | | nxv4i64 = 80, // n x 4 x i64 |
138 | | nxv8i64 = 81, // n x 8 x i64 |
139 | | nxv16i64 = 82, // n x 16 x i64 |
140 | | nxv32i64 = 83, // n x 32 x i64 |
141 | | |
142 | | FIRST_INTEGER_VECTOR_VALUETYPE = v1i1, |
143 | | LAST_INTEGER_VECTOR_VALUETYPE = nxv32i64, |
144 | | |
145 | | FIRST_INTEGER_SCALABLE_VALUETYPE = nxv1i1, |
146 | | LAST_INTEGER_SCALABLE_VALUETYPE = nxv32i64, |
147 | | |
148 | | v2f16 = 84, // 2 x f16 |
149 | | v4f16 = 85, // 4 x f16 |
150 | | v8f16 = 86, // 8 x f16 |
151 | | v1f32 = 87, // 1 x f32 |
152 | | v2f32 = 88, // 2 x f32 |
153 | | v4f32 = 89, // 4 x f32 |
154 | | v8f32 = 90, // 8 x f32 |
155 | | v16f32 = 91, // 16 x f32 |
156 | | v1f64 = 92, // 1 x f64 |
157 | | v2f64 = 93, // 2 x f64 |
158 | | v4f64 = 94, // 4 x f64 |
159 | | v8f64 = 95, // 8 x f64 |
160 | | |
161 | | nxv2f16 = 96, // n x 2 x f16 |
162 | | nxv4f16 = 97, // n x 4 x f16 |
163 | | nxv8f16 = 98, // n x 8 x f16 |
164 | | nxv1f32 = 99, // n x 1 x f32 |
165 | | nxv2f32 = 100, // n x 2 x f32 |
166 | | nxv4f32 = 101, // n x 4 x f32 |
167 | | nxv8f32 = 102, // n x 8 x f32 |
168 | | nxv16f32 = 103, // n x 16 x f32 |
169 | | nxv1f64 = 104, // n x 1 x f64 |
170 | | nxv2f64 = 105, // n x 2 x f64 |
171 | | nxv4f64 = 106, // n x 4 x f64 |
172 | | nxv8f64 = 107, // n x 8 x f64 |
173 | | |
174 | | FIRST_FP_VECTOR_VALUETYPE = v2f16, |
175 | | LAST_FP_VECTOR_VALUETYPE = nxv8f64, |
176 | | |
177 | | FIRST_FP_SCALABLE_VALUETYPE = nxv2f16, |
178 | | LAST_FP_SCALABLE_VALUETYPE = nxv8f64, |
179 | | |
180 | | FIRST_VECTOR_VALUETYPE = v1i1, |
181 | | LAST_VECTOR_VALUETYPE = nxv8f64, |
182 | | |
183 | | x86mmx = 108, // This is an X86 MMX value |
184 | | |
185 | | Glue = 109, // This glues nodes together during pre-RA sched |
186 | | |
187 | | isVoid = 110, // This has no value |
188 | | |
189 | | Untyped = 111, // This value takes a register, but has |
190 | | // unspecified type. The register class |
191 | | // will be determined by the opcode. |
192 | | |
193 | | FIRST_VALUETYPE = 1, // This is always the beginning of the list. |
194 | | LAST_VALUETYPE = 112, // This always remains at the end of the list. |
195 | | |
196 | | // This is the current maximum for LAST_VALUETYPE. |
197 | | // MVT::MAX_ALLOWED_VALUETYPE is used for asserts and to size bit vectors |
198 | | // This value must be a multiple of 32. |
199 | | MAX_ALLOWED_VALUETYPE = 128, |
200 | | |
201 | | // A value of type llvm::TokenTy |
202 | | token = 248, |
203 | | |
204 | | // This is MDNode or MDString. |
205 | | Metadata = 249, |
206 | | |
207 | | // An int value the size of the pointer of the current |
208 | | // target to any address space. This must only be used internal to |
209 | | // tblgen. Other than for overloading, we treat iPTRAny the same as iPTR. |
210 | | iPTRAny = 250, |
211 | | |
212 | | // A vector with any length and element size. This is used |
213 | | // for intrinsics that have overloadings based on vector types. |
214 | | // This is only for tblgen's consumption! |
215 | | vAny = 251, |
216 | | |
217 | | // Any floating-point or vector floating-point value. This is used |
218 | | // for intrinsics that have overloadings based on floating-point types. |
219 | | // This is only for tblgen's consumption! |
220 | | fAny = 252, |
221 | | |
222 | | // An integer or vector integer value of any bit width. This is |
223 | | // used for intrinsics that have overloadings based on integer bit widths. |
224 | | // This is only for tblgen's consumption! |
225 | | iAny = 253, |
226 | | |
227 | | // An int value the size of the pointer of the current |
228 | | // target. This should only be used internal to tblgen! |
229 | | iPTR = 254, |
230 | | |
231 | | // Any type. This is used for intrinsics that have overloadings. |
232 | | // This is only for tblgen's consumption! |
233 | | Any = 255 |
234 | | }; |
235 | | |
236 | | SimpleValueType SimpleTy = INVALID_SIMPLE_VALUE_TYPE; |
237 | | |
238 | | // A class to represent the number of elements in a vector |
239 | | // |
240 | | // For fixed-length vectors, the total number of elements is equal to 'Min' |
241 | | // For scalable vectors, the total number of elements is a multiple of 'Min' |
242 | | class ElementCount { |
243 | | public: |
244 | | unsigned Min; |
245 | | bool Scalable; |
246 | | |
247 | | ElementCount(unsigned Min, bool Scalable) |
248 | 304k | : Min(Min), Scalable(Scalable) {} |
249 | | |
250 | 0 | ElementCount operator*(unsigned RHS) { |
251 | 0 | return { Min * RHS, Scalable }; |
252 | 0 | } |
253 | | |
254 | 0 | ElementCount& operator*=(unsigned RHS) { |
255 | 0 | Min *= RHS; |
256 | 0 | return *this; |
257 | 0 | } |
258 | | |
259 | 149k | ElementCount operator/(unsigned RHS) { |
260 | 149k | return { Min / RHS, Scalable }; |
261 | 149k | } |
262 | | |
263 | 0 | ElementCount& operator/=(unsigned RHS) { |
264 | 0 | Min /= RHS; |
265 | 0 | return *this; |
266 | 0 | } |
267 | | |
268 | 0 | bool operator==(const ElementCount& RHS) { |
269 | 0 | return Min == RHS.Min && Scalable == RHS.Scalable; |
270 | 0 | } |
271 | | }; |
272 | | |
273 | 80.3M | constexpr MVT() = default; |
274 | 3.53G | constexpr MVT(SimpleValueType SVT) : SimpleTy(SVT) {} |
275 | | |
276 | 1.65k | bool operator>(const MVT& S) const { return SimpleTy > S.SimpleTy; } |
277 | 830k | bool operator<(const MVT& S) const { return SimpleTy < S.SimpleTy; } |
278 | 1.58G | bool operator==(const MVT& S) const { return SimpleTy == S.SimpleTy; } |
279 | 830M | bool operator!=(const MVT& S) const { return SimpleTy != S.SimpleTy; } |
280 | 7.31k | bool operator>=(const MVT& S) const { return SimpleTy >= S.SimpleTy; } |
281 | 7.40k | bool operator<=(const MVT& S) const { return SimpleTy <= S.SimpleTy; } |
282 | | |
283 | | /// Return true if this is a valid simple valuetype. |
284 | 3.07M | bool isValid() const { |
285 | 3.07M | return (SimpleTy >= MVT::FIRST_VALUETYPE && |
286 | 3.02M | SimpleTy < MVT::LAST_VALUETYPE); |
287 | 3.07M | } |
288 | | |
289 | | /// Return true if this is a FP or a vector FP type. |
290 | 12.6M | bool isFloatingPoint() const { |
291 | 12.6M | return ((SimpleTy >= MVT::FIRST_FP_VALUETYPE && |
292 | 8.08M | SimpleTy <= MVT::LAST_FP_VALUETYPE) || |
293 | 12.2M | (SimpleTy >= MVT::FIRST_FP_VECTOR_VALUETYPE && |
294 | 12.2M | SimpleTy <= MVT::LAST_FP_VECTOR_VALUETYPE)); |
295 | 12.6M | } |
296 | | |
297 | | /// Return true if this is an integer or a vector integer type. |
298 | 88.5M | bool isInteger() const { |
299 | 88.5M | return ((SimpleTy >= MVT::FIRST_INTEGER_VALUETYPE && |
300 | 88.5M | SimpleTy <= MVT::LAST_INTEGER_VALUETYPE) || |
301 | 27.8M | (SimpleTy >= MVT::FIRST_INTEGER_VECTOR_VALUETYPE && |
302 | 27.8M | SimpleTy <= MVT::LAST_INTEGER_VECTOR_VALUETYPE)); |
303 | 88.5M | } |
304 | | |
305 | | /// Return true if this is an integer, not including vectors. |
306 | 8.35M | bool isScalarInteger() const { |
307 | 8.35M | return (SimpleTy >= MVT::FIRST_INTEGER_VALUETYPE && |
308 | 8.35M | SimpleTy <= MVT::LAST_INTEGER_VALUETYPE); |
309 | 8.35M | } |
310 | | |
311 | | /// Return true if this is a vector value type. |
312 | 684M | bool isVector() const { |
313 | 684M | return (SimpleTy >= MVT::FIRST_VECTOR_VALUETYPE && |
314 | 142M | SimpleTy <= MVT::LAST_VECTOR_VALUETYPE); |
315 | 684M | } |
316 | | |
317 | | /// Return true if this is a vector value type where the |
318 | | /// runtime length is machine dependent |
319 | 189k | bool isScalableVector() const { |
320 | 189k | return ((SimpleTy >= MVT::FIRST_INTEGER_SCALABLE_VALUETYPE && |
321 | 50.0k | SimpleTy <= MVT::LAST_INTEGER_SCALABLE_VALUETYPE) || |
322 | 189k | (SimpleTy >= MVT::FIRST_FP_SCALABLE_VALUETYPE && |
323 | 189k | SimpleTy <= MVT::LAST_FP_SCALABLE_VALUETYPE)); |
324 | 189k | } |
325 | | |
326 | | /// Return true if this is a 16-bit vector type. |
327 | 0 | bool is16BitVector() const { |
328 | 0 | return (SimpleTy == MVT::v2i8 || SimpleTy == MVT::v1i16 || |
329 | 0 | SimpleTy == MVT::v16i1); |
330 | 0 | } |
331 | | |
332 | | /// Return true if this is a 32-bit vector type. |
333 | 1.66k | bool is32BitVector() const { |
334 | 1.66k | return (SimpleTy == MVT::v32i1 || SimpleTy == MVT::v4i8 || |
335 | 1.66k | SimpleTy == MVT::v2i161.66k || SimpleTy == MVT::v1i321.66k || |
336 | 1.66k | SimpleTy == MVT::v2f161.66k || SimpleTy == MVT::v1f321.66k ); |
337 | 1.66k | } |
338 | | |
339 | | /// Return true if this is a 64-bit vector type. |
340 | 12.8k | bool is64BitVector() const { |
341 | 12.8k | return (SimpleTy == MVT::v64i1 || SimpleTy == MVT::v8i8 || |
342 | 12.8k | SimpleTy == MVT::v4i1612.0k || SimpleTy == MVT::v2i3210.8k || |
343 | 12.8k | SimpleTy == MVT::v1i649.03k || SimpleTy == MVT::v4f168.76k || |
344 | 12.8k | SimpleTy == MVT::v2f328.58k || SimpleTy == MVT::v1f648.54k ); |
345 | 12.8k | } |
346 | | |
347 | | /// Return true if this is a 128-bit vector type. |
348 | 5.05M | bool is128BitVector() const { |
349 | 4.95M | return (SimpleTy == MVT::v16i8 || SimpleTy == MVT::v8i16 || |
350 | 5.05M | SimpleTy == MVT::v4i324.82M || SimpleTy == MVT::v2i644.61M || |
351 | 5.05M | SimpleTy == MVT::v1i1284.48M || SimpleTy == MVT::v8f164.48M || |
352 | 5.05M | SimpleTy == MVT::v4f324.48M || SimpleTy == MVT::v2f644.44M ); |
353 | 5.05M | } |
354 | | |
355 | | /// Return true if this is a 256-bit vector type. |
356 | 1.35M | bool is256BitVector() const { |
357 | 1.33M | return (SimpleTy == MVT::v8f32 || SimpleTy == MVT::v4f64 || |
358 | 1.35M | SimpleTy == MVT::v32i81.32M || SimpleTy == MVT::v16i161.29M || |
359 | 1.35M | SimpleTy == MVT::v8i321.25M || SimpleTy == MVT::v4i641.23M ); |
360 | 1.35M | } |
361 | | |
362 | | /// Return true if this is a 512-bit vector type. |
363 | 455k | bool is512BitVector() const { |
364 | 452k | return (SimpleTy == MVT::v16f32 || SimpleTy == MVT::v8f64 || |
365 | 455k | SimpleTy == MVT::v512i1448k || SimpleTy == MVT::v64i8448k || |
366 | 455k | SimpleTy == MVT::v32i16446k || SimpleTy == MVT::v16i32443k || |
367 | 432k | SimpleTy == MVT::v8i64); |
368 | 455k | } |
369 | | |
370 | | /// Return true if this is a 1024-bit vector type. |
371 | 0 | bool is1024BitVector() const { |
372 | 0 | return (SimpleTy == MVT::v1024i1 || SimpleTy == MVT::v128i8 || |
373 | 0 | SimpleTy == MVT::v64i16 || SimpleTy == MVT::v32i32 || |
374 | 0 | SimpleTy == MVT::v16i64); |
375 | 0 | } |
376 | | |
377 | | /// Return true if this is a 1024-bit vector type. |
378 | 0 | bool is2048BitVector() const { |
379 | 0 | return (SimpleTy == MVT::v256i8 || SimpleTy == MVT::v128i16 || |
380 | 0 | SimpleTy == MVT::v64i32 || SimpleTy == MVT::v32i64); |
381 | 0 | } |
382 | | |
383 | | /// Return true if this is an overloaded type for TableGen. |
384 | | bool isOverloaded() const { |
385 | | return (SimpleTy==MVT::Any || |
386 | | SimpleTy==MVT::iAny || SimpleTy==MVT::fAny || |
387 | | SimpleTy==MVT::vAny || SimpleTy==MVT::iPTRAny); |
388 | | } |
389 | | |
390 | | /// Returns true if the given vector is a power of 2. |
391 | 3.54M | bool isPow2VectorType() const { |
392 | 3.54M | unsigned NElts = getVectorNumElements(); |
393 | 3.54M | return !(NElts & (NElts - 1)); |
394 | 3.54M | } |
395 | | |
396 | | /// Widens the length of the given vector MVT up to the nearest power of 2 |
397 | | /// and returns that type. |
398 | 3.54M | MVT getPow2VectorType() const { |
399 | 3.54M | if (isPow2VectorType()) |
400 | 3.54M | return *this; |
401 | 3.54M | |
402 | 18.4E | unsigned NElts = getVectorNumElements(); |
403 | 18.4E | unsigned Pow2NElts = 1 << Log2_32_Ceil(NElts); |
404 | 18.4E | return MVT::getVectorVT(getVectorElementType(), Pow2NElts); |
405 | 3.54M | } |
406 | | |
407 | | /// If this is a vector, return the element type, otherwise return this. |
408 | 69.4M | MVT getScalarType() const { |
409 | 69.4M | return isVector() ? getVectorElementType()69.2M : *this271k ; |
410 | 69.4M | } |
411 | | |
412 | 408M | MVT getVectorElementType() const { |
413 | 408M | switch (SimpleTy) { |
414 | 0 | default: |
415 | 0 | llvm_unreachable("Not a vector MVT!"); |
416 | 46.0M | case v1i1: |
417 | 46.0M | case v2i1: |
418 | 46.0M | case v4i1: |
419 | 46.0M | case v8i1: |
420 | 46.0M | case v16i1: |
421 | 46.0M | case v32i1: |
422 | 46.0M | case v64i1: |
423 | 46.0M | case v512i1: |
424 | 46.0M | case v1024i1: |
425 | 46.0M | case nxv1i1: |
426 | 46.0M | case nxv2i1: |
427 | 46.0M | case nxv4i1: |
428 | 46.0M | case nxv8i1: |
429 | 46.0M | case nxv16i1: |
430 | 46.0M | case nxv32i1: return i1; |
431 | 53.1M | case v1i8: |
432 | 53.1M | case v2i8: |
433 | 53.1M | case v4i8: |
434 | 53.1M | case v8i8: |
435 | 53.1M | case v16i8: |
436 | 53.1M | case v32i8: |
437 | 53.1M | case v64i8: |
438 | 53.1M | case v128i8: |
439 | 53.1M | case v256i8: |
440 | 53.1M | case nxv1i8: |
441 | 53.1M | case nxv2i8: |
442 | 53.1M | case nxv4i8: |
443 | 53.1M | case nxv8i8: |
444 | 53.1M | case nxv16i8: |
445 | 53.1M | case nxv32i8: return i8; |
446 | 56.1M | case v1i16: |
447 | 56.1M | case v2i16: |
448 | 56.1M | case v4i16: |
449 | 56.1M | case v8i16: |
450 | 56.1M | case v16i16: |
451 | 56.1M | case v32i16: |
452 | 56.1M | case v64i16: |
453 | 56.1M | case v128i16: |
454 | 56.1M | case nxv1i16: |
455 | 56.1M | case nxv2i16: |
456 | 56.1M | case nxv4i16: |
457 | 56.1M | case nxv8i16: |
458 | 56.1M | case nxv16i16: |
459 | 56.1M | case nxv32i16: return i16; |
460 | 62.6M | case v1i32: |
461 | 62.6M | case v2i32: |
462 | 62.6M | case v4i32: |
463 | 62.6M | case v8i32: |
464 | 62.6M | case v16i32: |
465 | 62.6M | case v32i32: |
466 | 62.6M | case v64i32: |
467 | 62.6M | case nxv1i32: |
468 | 62.6M | case nxv2i32: |
469 | 62.6M | case nxv4i32: |
470 | 62.6M | case nxv8i32: |
471 | 62.6M | case nxv16i32: |
472 | 62.6M | case nxv32i32: return i32; |
473 | 60.1M | case v1i64: |
474 | 60.1M | case v2i64: |
475 | 60.1M | case v4i64: |
476 | 60.1M | case v8i64: |
477 | 60.1M | case v16i64: |
478 | 60.1M | case v32i64: |
479 | 60.1M | case nxv1i64: |
480 | 60.1M | case nxv2i64: |
481 | 60.1M | case nxv4i64: |
482 | 60.1M | case nxv8i64: |
483 | 60.1M | case nxv16i64: |
484 | 60.1M | case nxv32i64: return i64; |
485 | 3.98M | case v1i128: return i128; |
486 | 25.5M | case v2f16: |
487 | 25.5M | case v4f16: |
488 | 25.5M | case v8f16: |
489 | 25.5M | case nxv2f16: |
490 | 25.5M | case nxv4f16: |
491 | 25.5M | case nxv8f16: return f16; |
492 | 46.8M | case v1f32: |
493 | 46.8M | case v2f32: |
494 | 46.8M | case v4f32: |
495 | 46.8M | case v8f32: |
496 | 46.8M | case v16f32: |
497 | 46.8M | case nxv1f32: |
498 | 46.8M | case nxv2f32: |
499 | 46.8M | case nxv4f32: |
500 | 46.8M | case nxv8f32: |
501 | 46.8M | case nxv16f32: return f32; |
502 | 53.7M | case v1f64: |
503 | 53.7M | case v2f64: |
504 | 53.7M | case v4f64: |
505 | 53.7M | case v8f64: |
506 | 53.7M | case nxv1f64: |
507 | 53.7M | case nxv2f64: |
508 | 53.7M | case nxv4f64: |
509 | 53.7M | case nxv8f64: return f64; |
510 | 408M | } |
511 | 408M | } |
512 | | |
513 | 115M | unsigned getVectorNumElements() const { |
514 | 115M | switch (SimpleTy) { |
515 | 0 | default: |
516 | 0 | llvm_unreachable("Not a vector MVT!"); |
517 | 360k | case v1024i1: return 1024; |
518 | 317k | case v512i1: return 512; |
519 | 656k | case v256i8: return 256; |
520 | 1.47M | case v128i8: |
521 | 1.47M | case v128i16: return 128; |
522 | 3.08M | case v64i1: |
523 | 3.08M | case v64i8: |
524 | 3.08M | case v64i16: |
525 | 3.08M | case v64i32: return 64; |
526 | 11.4M | case v32i1: |
527 | 11.4M | case v32i8: |
528 | 11.4M | case v32i16: |
529 | 11.4M | case v32i32: |
530 | 11.4M | case v32i64: |
531 | 11.4M | case nxv32i1: |
532 | 11.4M | case nxv32i8: |
533 | 11.4M | case nxv32i16: |
534 | 11.4M | case nxv32i32: |
535 | 11.4M | case nxv32i64: return 32; |
536 | 14.1M | case v16i1: |
537 | 14.1M | case v16i8: |
538 | 14.1M | case v16i16: |
539 | 14.1M | case v16i32: |
540 | 14.1M | case v16i64: |
541 | 14.1M | case v16f32: |
542 | 14.1M | case nxv16i1: |
543 | 14.1M | case nxv16i8: |
544 | 14.1M | case nxv16i16: |
545 | 14.1M | case nxv16i32: |
546 | 14.1M | case nxv16i64: |
547 | 14.1M | case nxv16f32: return 16; |
548 | 15.2M | case v8i1: |
549 | 15.2M | case v8i8: |
550 | 15.2M | case v8i16: |
551 | 15.2M | case v8i32: |
552 | 15.2M | case v8i64: |
553 | 15.2M | case v8f16: |
554 | 15.2M | case v8f32: |
555 | 15.2M | case v8f64: |
556 | 15.2M | case nxv8i1: |
557 | 15.2M | case nxv8i8: |
558 | 15.2M | case nxv8i16: |
559 | 15.2M | case nxv8i32: |
560 | 15.2M | case nxv8i64: |
561 | 15.2M | case nxv8f16: |
562 | 15.2M | case nxv8f32: |
563 | 15.2M | case nxv8f64: return 8; |
564 | 35.7M | case v4i1: |
565 | 35.7M | case v4i8: |
566 | 35.7M | case v4i16: |
567 | 35.7M | case v4i32: |
568 | 35.7M | case v4i64: |
569 | 35.7M | case v4f16: |
570 | 35.7M | case v4f32: |
571 | 35.7M | case v4f64: |
572 | 35.7M | case nxv4i1: |
573 | 35.7M | case nxv4i8: |
574 | 35.7M | case nxv4i16: |
575 | 35.7M | case nxv4i32: |
576 | 35.7M | case nxv4i64: |
577 | 35.7M | case nxv4f16: |
578 | 35.7M | case nxv4f32: |
579 | 35.7M | case nxv4f64: return 4; |
580 | 19.5M | case v2i1: |
581 | 19.5M | case v2i8: |
582 | 19.5M | case v2i16: |
583 | 19.5M | case v2i32: |
584 | 19.5M | case v2i64: |
585 | 19.5M | case v2f16: |
586 | 19.5M | case v2f32: |
587 | 19.5M | case v2f64: |
588 | 19.5M | case nxv2i1: |
589 | 19.5M | case nxv2i8: |
590 | 19.5M | case nxv2i16: |
591 | 19.5M | case nxv2i32: |
592 | 19.5M | case nxv2i64: |
593 | 19.5M | case nxv2f16: |
594 | 19.5M | case nxv2f32: |
595 | 19.5M | case nxv2f64: return 2; |
596 | 13.9M | case v1i1: |
597 | 13.9M | case v1i8: |
598 | 13.9M | case v1i16: |
599 | 13.9M | case v1i32: |
600 | 13.9M | case v1i64: |
601 | 13.9M | case v1i128: |
602 | 13.9M | case v1f32: |
603 | 13.9M | case v1f64: |
604 | 13.9M | case nxv1i1: |
605 | 13.9M | case nxv1i8: |
606 | 13.9M | case nxv1i16: |
607 | 13.9M | case nxv1i32: |
608 | 13.9M | case nxv1i64: |
609 | 13.9M | case nxv1f32: |
610 | 13.9M | case nxv1f64: return 1; |
611 | 115M | } |
612 | 115M | } |
613 | | |
614 | 147k | MVT::ElementCount getVectorElementCount() const { |
615 | 147k | return { getVectorNumElements(), isScalableVector() }; |
616 | 147k | } |
617 | | |
618 | 745M | unsigned getSizeInBits() const { |
619 | 745M | switch (SimpleTy) { |
620 | 0 | default: |
621 | 0 | llvm_unreachable("getSizeInBits called on extended MVT."); |
622 | 0 | case Other: |
623 | 0 | llvm_unreachable("Value type is non-standard value, Other."); |
624 | 0 | case iPTR: |
625 | 0 | llvm_unreachable("Value type size is target-dependent. Ask TLI."); |
626 | 0 | case iPTRAny: |
627 | 0 | case iAny: |
628 | 0 | case fAny: |
629 | 0 | case vAny: |
630 | 0 | case Any: |
631 | 0 | llvm_unreachable("Value type is overloaded."); |
632 | 0 | case token: |
633 | 0 | llvm_unreachable("Token type is a sentinel that cannot be used " |
634 | 0 | "in codegen and has no size"); |
635 | 0 | case Metadata: |
636 | 0 | llvm_unreachable("Value type is metadata."); |
637 | 35.2M | case i1: |
638 | 35.2M | case v1i1: |
639 | 35.2M | case nxv1i1: return 1; |
640 | 91.4k | case v2i1: |
641 | 91.4k | case nxv2i1: return 2; |
642 | 85.1k | case v4i1: |
643 | 85.1k | case nxv4i1: return 4; |
644 | 46.2M | case i8 : |
645 | 46.2M | case v1i8: |
646 | 46.2M | case v8i1: |
647 | 46.2M | case nxv1i8: |
648 | 46.2M | case nxv8i1: return 8; |
649 | 60.6M | case i16 : |
650 | 60.6M | case f16: |
651 | 60.6M | case v16i1: |
652 | 60.6M | case v2i8: |
653 | 60.6M | case v1i16: |
654 | 60.6M | case nxv16i1: |
655 | 60.6M | case nxv2i8: |
656 | 60.6M | case nxv1i16: return 16; |
657 | 156M | case f32 : |
658 | 156M | case i32 : |
659 | 156M | case v32i1: |
660 | 156M | case v4i8: |
661 | 156M | case v2i16: |
662 | 156M | case v2f16: |
663 | 156M | case v1f32: |
664 | 156M | case v1i32: |
665 | 156M | case nxv32i1: |
666 | 156M | case nxv4i8: |
667 | 156M | case nxv2i16: |
668 | 156M | case nxv1i32: |
669 | 156M | case nxv2f16: |
670 | 156M | case nxv1f32: return 32; |
671 | 295M | case x86mmx: |
672 | 295M | case f64 : |
673 | 295M | case i64 : |
674 | 295M | case v64i1: |
675 | 295M | case v8i8: |
676 | 295M | case v4i16: |
677 | 295M | case v2i32: |
678 | 295M | case v1i64: |
679 | 295M | case v4f16: |
680 | 295M | case v2f32: |
681 | 295M | case v1f64: |
682 | 295M | case nxv8i8: |
683 | 295M | case nxv4i16: |
684 | 295M | case nxv2i32: |
685 | 295M | case nxv1i64: |
686 | 295M | case nxv4f16: |
687 | 295M | case nxv2f32: |
688 | 295M | case nxv1f64: return 64; |
689 | 681k | case f80 : return 80; |
690 | 146M | case f128: |
691 | 146M | case ppcf128: |
692 | 146M | case i128: |
693 | 146M | case v16i8: |
694 | 146M | case v8i16: |
695 | 146M | case v4i32: |
696 | 146M | case v2i64: |
697 | 146M | case v1i128: |
698 | 146M | case v8f16: |
699 | 146M | case v4f32: |
700 | 146M | case v2f64: |
701 | 146M | case nxv16i8: |
702 | 146M | case nxv8i16: |
703 | 146M | case nxv4i32: |
704 | 146M | case nxv2i64: |
705 | 146M | case nxv8f16: |
706 | 146M | case nxv4f32: |
707 | 146M | case nxv2f64: return 128; |
708 | 2.20M | case v32i8: |
709 | 2.20M | case v16i16: |
710 | 2.20M | case v8i32: |
711 | 2.20M | case v4i64: |
712 | 2.20M | case v8f32: |
713 | 2.20M | case v4f64: |
714 | 2.20M | case nxv32i8: |
715 | 2.20M | case nxv16i16: |
716 | 2.20M | case nxv8i32: |
717 | 2.20M | case nxv4i64: |
718 | 2.20M | case nxv8f32: |
719 | 2.20M | case nxv4f64: return 256; |
720 | 1.10M | case v512i1: |
721 | 1.10M | case v64i8: |
722 | 1.10M | case v32i16: |
723 | 1.10M | case v16i32: |
724 | 1.10M | case v8i64: |
725 | 1.10M | case v16f32: |
726 | 1.10M | case v8f64: |
727 | 1.10M | case nxv32i16: |
728 | 1.10M | case nxv16i32: |
729 | 1.10M | case nxv8i64: |
730 | 1.10M | case nxv16f32: |
731 | 1.10M | case nxv8f64: return 512; |
732 | 73.2k | case v1024i1: |
733 | 73.2k | case v128i8: |
734 | 73.2k | case v64i16: |
735 | 73.2k | case v32i32: |
736 | 73.2k | case v16i64: |
737 | 73.2k | case nxv32i32: |
738 | 73.2k | case nxv16i64: return 1024; |
739 | 45.9k | case v256i8: |
740 | 45.9k | case v128i16: |
741 | 45.9k | case v64i32: |
742 | 45.9k | case v32i64: |
743 | 45.9k | case nxv32i64: return 2048; |
744 | 745M | } |
745 | 745M | } |
746 | | |
747 | 69.4M | unsigned getScalarSizeInBits() const { |
748 | 69.4M | return getScalarType().getSizeInBits(); |
749 | 69.4M | } |
750 | | |
751 | | /// Return the number of bytes overwritten by a store of the specified value |
752 | | /// type. |
753 | 1.04M | unsigned getStoreSize() const { |
754 | 1.04M | return (getSizeInBits() + 7) / 8; |
755 | 1.04M | } |
756 | | |
757 | | /// Return the number of bits overwritten by a store of the specified value |
758 | | /// type. |
759 | 49 | unsigned getStoreSizeInBits() const { |
760 | 49 | return getStoreSize() * 8; |
761 | 49 | } |
762 | | |
763 | | /// Return true if this has more bits than VT. |
764 | 1.86k | bool bitsGT(MVT VT) const { |
765 | 1.86k | return getSizeInBits() > VT.getSizeInBits(); |
766 | 1.86k | } |
767 | | |
768 | | /// Return true if this has no less bits than VT. |
769 | 154 | bool bitsGE(MVT VT) const { |
770 | 154 | return getSizeInBits() >= VT.getSizeInBits(); |
771 | 154 | } |
772 | | |
773 | | /// Return true if this has less bits than VT. |
774 | 1.12k | bool bitsLT(MVT VT) const { |
775 | 1.12k | return getSizeInBits() < VT.getSizeInBits(); |
776 | 1.12k | } |
777 | | |
778 | | /// Return true if this has no more bits than VT. |
779 | 0 | bool bitsLE(MVT VT) const { |
780 | 0 | return getSizeInBits() <= VT.getSizeInBits(); |
781 | 0 | } |
782 | | |
783 | 15.6k | static MVT getFloatingPointVT(unsigned BitWidth) { |
784 | 15.6k | switch (BitWidth) { |
785 | 0 | default: |
786 | 0 | llvm_unreachable("Bad bit width!"); |
787 | 2 | case 16: |
788 | 2 | return MVT::f16; |
789 | 7.63k | case 32: |
790 | 7.63k | return MVT::f32; |
791 | 8.03k | case 64: |
792 | 8.03k | return MVT::f64; |
793 | 0 | case 80: |
794 | 0 | return MVT::f80; |
795 | 0 | case 128: |
796 | 0 | return MVT::f128; |
797 | 15.6k | } |
798 | 15.6k | } |
799 | | |
800 | 129M | static MVT getIntegerVT(unsigned BitWidth) { |
801 | 129M | switch (BitWidth) { |
802 | 1.14M | default: |
803 | 1.14M | return (MVT::SimpleValueType)(MVT::INVALID_SIMPLE_VALUE_TYPE); |
804 | 9.12M | case 1: |
805 | 9.12M | return MVT::i1; |
806 | 4.98M | case 8: |
807 | 4.98M | return MVT::i8; |
808 | 2.55M | case 16: |
809 | 2.55M | return MVT::i16; |
810 | 31.2M | case 32: |
811 | 31.2M | return MVT::i32; |
812 | 79.8M | case 64: |
813 | 79.8M | return MVT::i64; |
814 | 413k | case 128: |
815 | 413k | return MVT::i128; |
816 | 129M | } |
817 | 129M | } |
818 | | |
819 | 38.4M | static MVT getVectorVT(MVT VT, unsigned NumElements) { |
820 | 38.4M | switch (VT.SimpleTy) { |
821 | 12.9k | default: |
822 | 12.9k | break; |
823 | 3.04M | case MVT::i1: |
824 | 3.04M | if (NumElements == 13.04M ) return MVT::v1i1554k ; |
825 | 2.49M | if (2.49M NumElements == 22.49M ) return MVT::v2i1600k ; |
826 | 1.89M | if (1.89M NumElements == 41.89M ) return MVT::v4i1434k ; |
827 | 1.45M | if (1.45M NumElements == 81.45M ) return MVT::v8i1361k ; |
828 | 1.09M | if (1.09M NumElements == 161.09M ) return MVT::v16i1335k ; |
829 | 758k | if (758k NumElements == 32758k ) return MVT::v32i1266k ; |
830 | 492k | if (492k NumElements == 64492k ) return MVT::v64i1177k ; |
831 | 314k | if (314k NumElements == 512314k ) return MVT::v512i189.6k ; |
832 | 225k | if (225k NumElements == 1024225k ) return MVT::v1024i144.6k ; |
833 | 180k | break; |
834 | 2.48M | case MVT::i8: |
835 | 2.48M | if (NumElements == 12.48M ) return MVT::v1i8375k ; |
836 | 2.11M | if (2.11M NumElements == 22.11M ) return MVT::v2i8346k ; |
837 | 1.76M | if (1.76M NumElements == 41.76M ) return MVT::v4i8254k ; |
838 | 1.51M | if (1.51M NumElements == 81.51M ) return MVT::v8i8280k ; |
839 | 1.23M | if (1.23M NumElements == 161.23M ) return MVT::v16i8626k ; |
840 | 606k | if (606k NumElements == 32606k ) return MVT::v32i8277k ; |
841 | 329k | if (329k NumElements == 64329k ) return MVT::v64i8150k ; |
842 | 178k | if (178k NumElements == 128178k ) return MVT::v128i890.9k ; |
843 | 87.6k | if (87.6k NumElements == 25687.6k ) return MVT::v256i845.2k ; |
844 | 42.3k | break; |
845 | 2.37M | case MVT::i16: |
846 | 2.37M | if (NumElements == 12.37M ) return MVT::v1i16328k ; |
847 | 2.04M | if (2.04M NumElements == 22.04M ) return MVT::v2i16342k ; |
848 | 1.69M | if (1.69M NumElements == 41.69M ) return MVT::v4i16319k ; |
849 | 1.37M | if (1.37M NumElements == 81.37M ) return MVT::v8i16688k ; |
850 | 690k | if (690k NumElements == 16690k ) return MVT::v16i16338k ; |
851 | 351k | if (351k NumElements == 32351k ) return MVT::v32i16206k ; |
852 | 145k | if (145k NumElements == 64145k ) return MVT::v64i1689.7k ; |
853 | 55.9k | if (55.9k NumElements == 12855.9k ) return MVT::v128i1646.1k ; |
854 | 9.85k | break; |
855 | 5.44M | case MVT::i32: |
856 | 5.44M | if (NumElements == 15.44M ) return MVT::v1i32310k ; |
857 | 5.13M | if (5.13M NumElements == 25.13M ) return MVT::v2i322.09M ; |
858 | 3.04M | if (3.04M NumElements == 43.04M ) return MVT::v4i321.73M ; |
859 | 1.30M | if (1.30M NumElements == 81.30M ) return MVT::v8i32646k ; |
860 | 658k | if (658k NumElements == 16658k ) return MVT::v16i32354k ; |
861 | 304k | if (304k NumElements == 32304k ) return MVT::v32i32147k ; |
862 | 156k | if (156k NumElements == 64156k ) return MVT::v64i3248.6k ; |
863 | 107k | break; |
864 | 3.88M | case MVT::i64: |
865 | 3.88M | if (NumElements == 13.88M ) return MVT::v1i64295k ; |
866 | 3.59M | if (3.59M NumElements == 23.59M ) return MVT::v2i642.26M ; |
867 | 1.32M | if (1.32M NumElements == 41.32M ) return MVT::v4i64646k ; |
868 | 678k | if (678k NumElements == 8678k ) return MVT::v8i64354k ; |
869 | 323k | if (323k NumElements == 16323k ) return MVT::v16i64200k ; |
870 | 122k | if (122k NumElements == 32122k ) return MVT::v32i6493.2k ; |
871 | 29.5k | break; |
872 | 56.2k | case MVT::i128: |
873 | 56.2k | if (NumElements == 156.2k ) return MVT::v1i12847.8k ; |
874 | 8.46k | break; |
875 | 867k | case MVT::f16: |
876 | 867k | if (NumElements == 2867k ) return MVT::v2f16259k ; |
877 | 607k | if (607k NumElements == 4607k ) return MVT::v4f16206k ; |
878 | 400k | if (400k NumElements == 8400k ) return MVT::v8f16146k ; |
879 | 254k | break; |
880 | 1.63M | case MVT::f32: |
881 | 1.63M | if (NumElements == 11.63M ) return MVT::v1f32211k ; |
882 | 1.42M | if (1.42M NumElements == 21.42M ) return MVT::v2f32484k ; |
883 | 938k | if (938k NumElements == 4938k ) return MVT::v4f32576k ; |
884 | 361k | if (361k NumElements == 8361k ) return MVT::v8f32231k ; |
885 | 130k | if (130k NumElements == 16130k ) return MVT::v16f32117k ; |
886 | 13.0k | break; |
887 | 18.6M | case MVT::f64: |
888 | 18.6M | if (NumElements == 118.6M ) return MVT::v1f64902k ; |
889 | 17.7M | if (17.7M NumElements == 217.7M ) return MVT::v2f641.75M ; |
890 | 15.9M | if (15.9M NumElements == 415.9M ) return MVT::v4f64963k ; |
891 | 15.0M | if (15.0M NumElements == 815.0M ) return MVT::v8f64782k ; |
892 | 14.2M | break; |
893 | 38.4M | } |
894 | 14.8M | return (MVT::SimpleValueType)(MVT::INVALID_SIMPLE_VALUE_TYPE); |
895 | 38.4M | } |
896 | | |
897 | 9 | static MVT getScalableVectorVT(MVT VT, unsigned NumElements) { |
898 | 9 | switch(VT.SimpleTy) { |
899 | 0 | default: |
900 | 0 | break; |
901 | 0 | case MVT::i1: |
902 | 0 | if (NumElements == 10 ) return MVT::nxv1i10 ; |
903 | 0 | if (0 NumElements == 20 ) return MVT::nxv2i10 ; |
904 | 0 | if (0 NumElements == 40 ) return MVT::nxv4i10 ; |
905 | 0 | if (0 NumElements == 80 ) return MVT::nxv8i10 ; |
906 | 0 | if (0 NumElements == 160 ) return MVT::nxv16i10 ; |
907 | 0 | if (0 NumElements == 320 ) return MVT::nxv32i10 ; |
908 | 0 | break; |
909 | 0 | case MVT::i8: |
910 | 0 | if (NumElements == 10 ) return MVT::nxv1i80 ; |
911 | 0 | if (0 NumElements == 20 ) return MVT::nxv2i80 ; |
912 | 0 | if (0 NumElements == 40 ) return MVT::nxv4i80 ; |
913 | 0 | if (0 NumElements == 80 ) return MVT::nxv8i80 ; |
914 | 0 | if (0 NumElements == 160 ) return MVT::nxv16i80 ; |
915 | 0 | if (0 NumElements == 320 ) return MVT::nxv32i80 ; |
916 | 0 | break; |
917 | 0 | case MVT::i16: |
918 | 0 | if (NumElements == 10 ) return MVT::nxv1i160 ; |
919 | 0 | if (0 NumElements == 20 ) return MVT::nxv2i160 ; |
920 | 0 | if (0 NumElements == 40 ) return MVT::nxv4i160 ; |
921 | 0 | if (0 NumElements == 80 ) return MVT::nxv8i160 ; |
922 | 0 | if (0 NumElements == 160 ) return MVT::nxv16i160 ; |
923 | 0 | if (0 NumElements == 320 ) return MVT::nxv32i160 ; |
924 | 0 | break; |
925 | 3 | case MVT::i32: |
926 | 3 | if (NumElements == 13 ) return MVT::nxv1i320 ; |
927 | 3 | if (3 NumElements == 23 ) return MVT::nxv2i322 ; |
928 | 1 | if (1 NumElements == 41 ) return MVT::nxv4i321 ; |
929 | 0 | if (0 NumElements == 80 ) return MVT::nxv8i320 ; |
930 | 0 | if (0 NumElements == 160 ) return MVT::nxv16i320 ; |
931 | 0 | if (0 NumElements == 320 ) return MVT::nxv32i320 ; |
932 | 0 | break; |
933 | 5 | case MVT::i64: |
934 | 5 | if (NumElements == 15 ) return MVT::nxv1i641 ; |
935 | 4 | if (4 NumElements == 24 ) return MVT::nxv2i643 ; |
936 | 1 | if (1 NumElements == 41 ) return MVT::nxv4i641 ; |
937 | 0 | if (0 NumElements == 80 ) return MVT::nxv8i640 ; |
938 | 0 | if (0 NumElements == 160 ) return MVT::nxv16i640 ; |
939 | 0 | if (0 NumElements == 320 ) return MVT::nxv32i640 ; |
940 | 0 | break; |
941 | 0 | case MVT::f16: |
942 | 0 | if (NumElements == 20 ) return MVT::nxv2f160 ; |
943 | 0 | if (0 NumElements == 40 ) return MVT::nxv4f160 ; |
944 | 0 | if (0 NumElements == 80 ) return MVT::nxv8f160 ; |
945 | 0 | break; |
946 | 0 | case MVT::f32: |
947 | 0 | if (NumElements == 10 ) return MVT::nxv1f320 ; |
948 | 0 | if (0 NumElements == 20 ) return MVT::nxv2f320 ; |
949 | 0 | if (0 NumElements == 40 ) return MVT::nxv4f320 ; |
950 | 0 | if (0 NumElements == 80 ) return MVT::nxv8f320 ; |
951 | 0 | if (0 NumElements == 160 ) return MVT::nxv16f320 ; |
952 | 0 | break; |
953 | 1 | case MVT::f64: |
954 | 1 | if (NumElements == 11 ) return MVT::nxv1f640 ; |
955 | 1 | if (1 NumElements == 21 ) return MVT::nxv2f641 ; |
956 | 0 | if (0 NumElements == 40 ) return MVT::nxv4f640 ; |
957 | 0 | if (0 NumElements == 80 ) return MVT::nxv8f640 ; |
958 | 0 | break; |
959 | 9 | } |
960 | 0 | return (MVT::SimpleValueType)(MVT::INVALID_SIMPLE_VALUE_TYPE); |
961 | 9 | } |
962 | | |
963 | 25.0M | static MVT getVectorVT(MVT VT, unsigned NumElements, bool IsScalable) { |
964 | 25.0M | if (IsScalable) |
965 | 2 | return getScalableVectorVT(VT, NumElements); |
966 | 25.0M | return getVectorVT(VT, NumElements); |
967 | 25.0M | } |
968 | | |
969 | 155k | static MVT getVectorVT(MVT VT, MVT::ElementCount EC) { |
970 | 155k | if (EC.Scalable) |
971 | 7 | return getScalableVectorVT(VT, EC.Min); |
972 | 155k | return getVectorVT(VT, EC.Min); |
973 | 155k | } |
974 | | |
975 | | /// Return the value type corresponding to the specified type. This returns |
976 | | /// all pointers as iPTR. If HandleUnknown is true, unknown types are |
977 | | /// returned as Other, otherwise they are invalid. |
978 | | static MVT getVT(Type *Ty, bool HandleUnknown = false); |
979 | | |
980 | | private: |
981 | | /// A simple iterator over the MVT::SimpleValueType enum. |
982 | | struct mvt_iterator { |
983 | | SimpleValueType VT; |
984 | | |
985 | 22.2M | mvt_iterator(SimpleValueType VT) : VT(VT) {} |
986 | | |
987 | 1.15G | MVT operator*() const { return VT; } |
988 | 1.16G | bool operator!=(const mvt_iterator &LHS) const { return VT != LHS.VT; } |
989 | | |
990 | 1.15G | mvt_iterator& operator++() { |
991 | 1.15G | VT = (MVT::SimpleValueType)((int)VT + 1); |
992 | 1.15G | assert((int)VT <= MVT::MAX_ALLOWED_VALUETYPE && |
993 | 1.15G | "MVT iterator overflowed."); |
994 | 1.15G | return *this; |
995 | 1.15G | } |
996 | | }; |
997 | | |
998 | | /// A range of the MVT::SimpleValueType enum. |
999 | | using mvt_range = iterator_range<mvt_iterator>; |
1000 | | |
1001 | | public: |
1002 | | /// SimpleValueType Iteration |
1003 | | /// @{ |
1004 | 7.66M | static mvt_range all_valuetypes() { |
1005 | 7.66M | return mvt_range(MVT::FIRST_VALUETYPE, MVT::LAST_VALUETYPE); |
1006 | 7.66M | } |
1007 | | |
1008 | 105k | static mvt_range integer_valuetypes() { |
1009 | 105k | return mvt_range(MVT::FIRST_INTEGER_VALUETYPE, |
1010 | 105k | (MVT::SimpleValueType)(MVT::LAST_INTEGER_VALUETYPE + 1)); |
1011 | 105k | } |
1012 | | |
1013 | 78.3k | static mvt_range fp_valuetypes() { |
1014 | 78.3k | return mvt_range(MVT::FIRST_FP_VALUETYPE, |
1015 | 78.3k | (MVT::SimpleValueType)(MVT::LAST_FP_VALUETYPE + 1)); |
1016 | 78.3k | } |
1017 | | |
1018 | 3.17M | static mvt_range vector_valuetypes() { |
1019 | 3.17M | return mvt_range(MVT::FIRST_VECTOR_VALUETYPE, |
1020 | 3.17M | (MVT::SimpleValueType)(MVT::LAST_VECTOR_VALUETYPE + 1)); |
1021 | 3.17M | } |
1022 | | |
1023 | 72.2k | static mvt_range integer_vector_valuetypes() { |
1024 | 72.2k | return mvt_range( |
1025 | 72.2k | MVT::FIRST_INTEGER_VECTOR_VALUETYPE, |
1026 | 72.2k | (MVT::SimpleValueType)(MVT::LAST_INTEGER_VECTOR_VALUETYPE + 1)); |
1027 | 72.2k | } |
1028 | | |
1029 | 53.3k | static mvt_range fp_vector_valuetypes() { |
1030 | 53.3k | return mvt_range( |
1031 | 53.3k | MVT::FIRST_FP_VECTOR_VALUETYPE, |
1032 | 53.3k | (MVT::SimpleValueType)(MVT::LAST_FP_VECTOR_VALUETYPE + 1)); |
1033 | 53.3k | } |
1034 | | |
1035 | 0 | static mvt_range integer_scalable_vector_valuetypes() { |
1036 | 0 | return mvt_range(MVT::FIRST_INTEGER_SCALABLE_VALUETYPE, |
1037 | 0 | (MVT::SimpleValueType)(MVT::LAST_INTEGER_SCALABLE_VALUETYPE + 1)); |
1038 | 0 | } |
1039 | | |
1040 | 0 | static mvt_range fp_scalable_vector_valuetypes() { |
1041 | 0 | return mvt_range(MVT::FIRST_FP_SCALABLE_VALUETYPE, |
1042 | 0 | (MVT::SimpleValueType)(MVT::LAST_FP_SCALABLE_VALUETYPE + 1)); |
1043 | 0 | } |
1044 | | /// @} |
1045 | | }; |
1046 | | |
1047 | | } // end namespace llvm |
1048 | | |
1049 | | #endif // LLVM_CODEGEN_MACHINEVALUETYPE_H |