1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=riscv32 -mattr=+v -run-pass=legalizer %s -o - | FileCheck %s
3 # RUN: llc -mtriple=riscv64 -mattr=+v -run-pass=legalizer %s -o - | FileCheck %s
9 ; CHECK-LABEL: name: test_nxv1i8
10 ; CHECK: [[COPY:%[0-9]+]]:_(<vscale x 1 x s8>) = COPY $v8
11 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<vscale x 1 x s8>) = COPY $v9
12 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(<vscale x 1 x s8>) = G_ADD [[COPY]], [[COPY1]]
13 ; CHECK-NEXT: $v8 = COPY [[ADD]](<vscale x 1 x s8>)
14 ; CHECK-NEXT: PseudoRET implicit $v8
15 %0:_(<vscale x 1 x s8>) = COPY $v8
16 %1:_(<vscale x 1 x s8>) = COPY $v9
17 %2:_(<vscale x 1 x s8>) = G_ADD %0, %1
18 $v8 = COPY %2(<vscale x 1 x s8>)
19 PseudoRET implicit $v8
27 ; CHECK-LABEL: name: test_nxv2i8
28 ; CHECK: [[COPY:%[0-9]+]]:_(<vscale x 2 x s8>) = COPY $v8
29 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<vscale x 2 x s8>) = COPY $v9
30 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(<vscale x 2 x s8>) = G_ADD [[COPY]], [[COPY1]]
31 ; CHECK-NEXT: $v8 = COPY [[ADD]](<vscale x 2 x s8>)
32 ; CHECK-NEXT: PseudoRET implicit $v8
33 %0:_(<vscale x 2 x s8>) = COPY $v8
34 %1:_(<vscale x 2 x s8>) = COPY $v9
35 %2:_(<vscale x 2 x s8>) = G_ADD %0, %1
36 $v8 = COPY %2(<vscale x 2 x s8>)
37 PseudoRET implicit $v8
45 ; CHECK-LABEL: name: test_nxv4i8
46 ; CHECK: [[COPY:%[0-9]+]]:_(<vscale x 4 x s8>) = COPY $v8
47 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<vscale x 4 x s8>) = COPY $v9
48 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(<vscale x 4 x s8>) = G_ADD [[COPY]], [[COPY1]]
49 ; CHECK-NEXT: $v8 = COPY [[ADD]](<vscale x 4 x s8>)
50 ; CHECK-NEXT: PseudoRET implicit $v8
51 %0:_(<vscale x 4 x s8>) = COPY $v8
52 %1:_(<vscale x 4 x s8>) = COPY $v9
53 %2:_(<vscale x 4 x s8>) = G_ADD %0, %1
54 $v8 = COPY %2(<vscale x 4 x s8>)
55 PseudoRET implicit $v8
63 ; CHECK-LABEL: name: test_nxv8i8
64 ; CHECK: [[COPY:%[0-9]+]]:_(<vscale x 8 x s8>) = COPY $v8
65 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<vscale x 8 x s8>) = COPY $v9
66 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(<vscale x 8 x s8>) = G_ADD [[COPY]], [[COPY1]]
67 ; CHECK-NEXT: $v8 = COPY [[ADD]](<vscale x 8 x s8>)
68 ; CHECK-NEXT: PseudoRET implicit $v8
69 %0:_(<vscale x 8 x s8>) = COPY $v8
70 %1:_(<vscale x 8 x s8>) = COPY $v9
71 %2:_(<vscale x 8 x s8>) = G_ADD %0, %1
72 $v8 = COPY %2(<vscale x 8 x s8>)
73 PseudoRET implicit $v8
81 ; CHECK-LABEL: name: test_nxv16i8
82 ; CHECK: [[COPY:%[0-9]+]]:_(<vscale x 16 x s8>) = COPY $v8m2
83 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<vscale x 16 x s8>) = COPY $v10m2
84 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(<vscale x 16 x s8>) = G_ADD [[COPY]], [[COPY1]]
85 ; CHECK-NEXT: $v8m2 = COPY [[ADD]](<vscale x 16 x s8>)
86 ; CHECK-NEXT: PseudoRET implicit $v8m2
87 %0:_(<vscale x 16 x s8>) = COPY $v8m2
88 %1:_(<vscale x 16 x s8>) = COPY $v10m2
89 %2:_(<vscale x 16 x s8>) = G_ADD %0, %1
90 $v8m2 = COPY %2(<vscale x 16 x s8>)
91 PseudoRET implicit $v8m2
99 ; CHECK-LABEL: name: test_nxv32i8
100 ; CHECK: [[COPY:%[0-9]+]]:_(<vscale x 32 x s8>) = COPY $v8m4
101 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<vscale x 32 x s8>) = COPY $v12m4
102 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(<vscale x 32 x s8>) = G_ADD [[COPY]], [[COPY1]]
103 ; CHECK-NEXT: $v8m4 = COPY [[ADD]](<vscale x 32 x s8>)
104 ; CHECK-NEXT: PseudoRET implicit $v8m4
105 %0:_(<vscale x 32 x s8>) = COPY $v8m4
106 %1:_(<vscale x 32 x s8>) = COPY $v12m4
107 %2:_(<vscale x 32 x s8>) = G_ADD %0, %1
108 $v8m4 = COPY %2(<vscale x 32 x s8>)
109 PseudoRET implicit $v8m4
117 ; CHECK-LABEL: name: test_nxv64i8
118 ; CHECK: [[COPY:%[0-9]+]]:_(<vscale x 64 x s8>) = COPY $v8m8
119 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<vscale x 64 x s8>) = COPY $v16m8
120 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(<vscale x 64 x s8>) = G_ADD [[COPY]], [[COPY1]]
121 ; CHECK-NEXT: $v8m8 = COPY [[ADD]](<vscale x 64 x s8>)
122 ; CHECK-NEXT: PseudoRET implicit $v8m8
123 %0:_(<vscale x 64 x s8>) = COPY $v8m8
124 %1:_(<vscale x 64 x s8>) = COPY $v16m8
125 %2:_(<vscale x 64 x s8>) = G_ADD %0, %1
126 $v8m8 = COPY %2(<vscale x 64 x s8>)
127 PseudoRET implicit $v8m8
135 ; CHECK-LABEL: name: test_nxv1i16
136 ; CHECK: [[COPY:%[0-9]+]]:_(<vscale x 1 x s16>) = COPY $v8
137 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<vscale x 1 x s16>) = COPY $v9
138 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(<vscale x 1 x s16>) = G_ADD [[COPY]], [[COPY1]]
139 ; CHECK-NEXT: $v8 = COPY [[ADD]](<vscale x 1 x s16>)
140 ; CHECK-NEXT: PseudoRET implicit $v8
141 %0:_(<vscale x 1 x s16>) = COPY $v8
142 %1:_(<vscale x 1 x s16>) = COPY $v9
143 %2:_(<vscale x 1 x s16>) = G_ADD %0, %1
144 $v8 = COPY %2(<vscale x 1 x s16>)
145 PseudoRET implicit $v8
153 ; CHECK-LABEL: name: test_nxv2i16
154 ; CHECK: [[COPY:%[0-9]+]]:_(<vscale x 2 x s16>) = COPY $v8
155 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<vscale x 2 x s16>) = COPY $v9
156 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(<vscale x 2 x s16>) = G_ADD [[COPY]], [[COPY1]]
157 ; CHECK-NEXT: $v8 = COPY [[ADD]](<vscale x 2 x s16>)
158 ; CHECK-NEXT: PseudoRET implicit $v8
159 %0:_(<vscale x 2 x s16>) = COPY $v8
160 %1:_(<vscale x 2 x s16>) = COPY $v9
161 %2:_(<vscale x 2 x s16>) = G_ADD %0, %1
162 $v8 = COPY %2(<vscale x 2 x s16>)
163 PseudoRET implicit $v8
171 ; CHECK-LABEL: name: test_nxv4i16
172 ; CHECK: [[COPY:%[0-9]+]]:_(<vscale x 4 x s16>) = COPY $v8
173 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<vscale x 4 x s16>) = COPY $v9
174 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(<vscale x 4 x s16>) = G_ADD [[COPY]], [[COPY1]]
175 ; CHECK-NEXT: $v8 = COPY [[ADD]](<vscale x 4 x s16>)
176 ; CHECK-NEXT: PseudoRET implicit $v8
177 %0:_(<vscale x 4 x s16>) = COPY $v8
178 %1:_(<vscale x 4 x s16>) = COPY $v9
179 %2:_(<vscale x 4 x s16>) = G_ADD %0, %1
180 $v8 = COPY %2(<vscale x 4 x s16>)
181 PseudoRET implicit $v8
189 ; CHECK-LABEL: name: test_nxv8i16
190 ; CHECK: [[COPY:%[0-9]+]]:_(<vscale x 8 x s16>) = COPY $v8m2
191 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<vscale x 8 x s16>) = COPY $v10m2
192 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(<vscale x 8 x s16>) = G_ADD [[COPY]], [[COPY1]]
193 ; CHECK-NEXT: $v8m2 = COPY [[ADD]](<vscale x 8 x s16>)
194 ; CHECK-NEXT: PseudoRET implicit $v8m2
195 %0:_(<vscale x 8 x s16>) = COPY $v8m2
196 %1:_(<vscale x 8 x s16>) = COPY $v10m2
197 %2:_(<vscale x 8 x s16>) = G_ADD %0, %1
198 $v8m2 = COPY %2(<vscale x 8 x s16>)
199 PseudoRET implicit $v8m2
207 ; CHECK-LABEL: name: test_nxv16i16
208 ; CHECK: [[COPY:%[0-9]+]]:_(<vscale x 16 x s16>) = COPY $v8m4
209 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<vscale x 16 x s16>) = COPY $v12m4
210 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(<vscale x 16 x s16>) = G_ADD [[COPY]], [[COPY1]]
211 ; CHECK-NEXT: $v8m4 = COPY [[ADD]](<vscale x 16 x s16>)
212 ; CHECK-NEXT: PseudoRET implicit $v8m4
213 %0:_(<vscale x 16 x s16>) = COPY $v8m4
214 %1:_(<vscale x 16 x s16>) = COPY $v12m4
215 %2:_(<vscale x 16 x s16>) = G_ADD %0, %1
216 $v8m4 = COPY %2(<vscale x 16 x s16>)
217 PseudoRET implicit $v8m4
225 ; CHECK-LABEL: name: test_nxv32i16
226 ; CHECK: [[COPY:%[0-9]+]]:_(<vscale x 32 x s16>) = COPY $v8m8
227 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<vscale x 32 x s16>) = COPY $v16m8
228 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(<vscale x 32 x s16>) = G_ADD [[COPY]], [[COPY1]]
229 ; CHECK-NEXT: $v8m8 = COPY [[ADD]](<vscale x 32 x s16>)
230 ; CHECK-NEXT: PseudoRET implicit $v8m8
231 %0:_(<vscale x 32 x s16>) = COPY $v8m8
232 %1:_(<vscale x 32 x s16>) = COPY $v16m8
233 %2:_(<vscale x 32 x s16>) = G_ADD %0, %1
234 $v8m8 = COPY %2(<vscale x 32 x s16>)
235 PseudoRET implicit $v8m8
243 ; CHECK-LABEL: name: test_nxv1i32
244 ; CHECK: [[COPY:%[0-9]+]]:_(<vscale x 1 x s32>) = COPY $v8
245 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<vscale x 1 x s32>) = COPY $v9
246 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(<vscale x 1 x s32>) = G_ADD [[COPY]], [[COPY1]]
247 ; CHECK-NEXT: $v8 = COPY [[ADD]](<vscale x 1 x s32>)
248 ; CHECK-NEXT: PseudoRET implicit $v8
249 %0:_(<vscale x 1 x s32>) = COPY $v8
250 %1:_(<vscale x 1 x s32>) = COPY $v9
251 %2:_(<vscale x 1 x s32>) = G_ADD %0, %1
252 $v8 = COPY %2(<vscale x 1 x s32>)
253 PseudoRET implicit $v8
261 ; CHECK-LABEL: name: test_nxv2i32
262 ; CHECK: [[COPY:%[0-9]+]]:_(<vscale x 2 x s32>) = COPY $v8
263 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<vscale x 2 x s32>) = COPY $v9
264 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(<vscale x 2 x s32>) = G_ADD [[COPY]], [[COPY1]]
265 ; CHECK-NEXT: $v8 = COPY [[ADD]](<vscale x 2 x s32>)
266 ; CHECK-NEXT: PseudoRET implicit $v8
267 %0:_(<vscale x 2 x s32>) = COPY $v8
268 %1:_(<vscale x 2 x s32>) = COPY $v9
269 %2:_(<vscale x 2 x s32>) = G_ADD %0, %1
270 $v8 = COPY %2(<vscale x 2 x s32>)
271 PseudoRET implicit $v8
279 ; CHECK-LABEL: name: test_nxv4i32
280 ; CHECK: [[COPY:%[0-9]+]]:_(<vscale x 4 x s32>) = COPY $v8m2
281 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<vscale x 4 x s32>) = COPY $v10m2
282 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(<vscale x 4 x s32>) = G_ADD [[COPY]], [[COPY1]]
283 ; CHECK-NEXT: $v8m2 = COPY [[ADD]](<vscale x 4 x s32>)
284 ; CHECK-NEXT: PseudoRET implicit $v8m2
285 %0:_(<vscale x 4 x s32>) = COPY $v8m2
286 %1:_(<vscale x 4 x s32>) = COPY $v10m2
287 %2:_(<vscale x 4 x s32>) = G_ADD %0, %1
288 $v8m2 = COPY %2(<vscale x 4 x s32>)
289 PseudoRET implicit $v8m2
297 ; CHECK-LABEL: name: test_nxv8i32
298 ; CHECK: [[COPY:%[0-9]+]]:_(<vscale x 8 x s32>) = COPY $v8m4
299 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<vscale x 8 x s32>) = COPY $v12m4
300 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(<vscale x 8 x s32>) = G_ADD [[COPY]], [[COPY1]]
301 ; CHECK-NEXT: $v8m4 = COPY [[ADD]](<vscale x 8 x s32>)
302 ; CHECK-NEXT: PseudoRET implicit $v8m4
303 %0:_(<vscale x 8 x s32>) = COPY $v8m4
304 %1:_(<vscale x 8 x s32>) = COPY $v12m4
305 %2:_(<vscale x 8 x s32>) = G_ADD %0, %1
306 $v8m4 = COPY %2(<vscale x 8 x s32>)
307 PseudoRET implicit $v8m4
315 ; CHECK-LABEL: name: test_nxv16i32
316 ; CHECK: [[COPY:%[0-9]+]]:_(<vscale x 16 x s32>) = COPY $v8m8
317 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<vscale x 16 x s32>) = COPY $v16m8
318 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(<vscale x 16 x s32>) = G_ADD [[COPY]], [[COPY1]]
319 ; CHECK-NEXT: $v8m8 = COPY [[ADD]](<vscale x 16 x s32>)
320 ; CHECK-NEXT: PseudoRET implicit $v8m8
321 %0:_(<vscale x 16 x s32>) = COPY $v8m8
322 %1:_(<vscale x 16 x s32>) = COPY $v16m8
323 %2:_(<vscale x 16 x s32>) = G_ADD %0, %1
324 $v8m8 = COPY %2(<vscale x 16 x s32>)
325 PseudoRET implicit $v8m8
333 ; CHECK-LABEL: name: test_nxv1i64
334 ; CHECK: [[COPY:%[0-9]+]]:_(<vscale x 1 x s64>) = COPY $v8
335 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<vscale x 1 x s64>) = COPY $v9
336 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(<vscale x 1 x s64>) = G_ADD [[COPY]], [[COPY1]]
337 ; CHECK-NEXT: $v8 = COPY [[ADD]](<vscale x 1 x s64>)
338 ; CHECK-NEXT: PseudoRET implicit $v8
339 %0:_(<vscale x 1 x s64>) = COPY $v8
340 %1:_(<vscale x 1 x s64>) = COPY $v9
341 %2:_(<vscale x 1 x s64>) = G_ADD %0, %1
342 $v8 = COPY %2(<vscale x 1 x s64>)
343 PseudoRET implicit $v8
351 ; CHECK-LABEL: name: test_nxv2i64
352 ; CHECK: [[COPY:%[0-9]+]]:_(<vscale x 2 x s64>) = COPY $v8m2
353 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<vscale x 2 x s64>) = COPY $v10m2
354 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(<vscale x 2 x s64>) = G_ADD [[COPY]], [[COPY1]]
355 ; CHECK-NEXT: $v8m2 = COPY [[ADD]](<vscale x 2 x s64>)
356 ; CHECK-NEXT: PseudoRET implicit $v8m2
357 %0:_(<vscale x 2 x s64>) = COPY $v8m2
358 %1:_(<vscale x 2 x s64>) = COPY $v10m2
359 %2:_(<vscale x 2 x s64>) = G_ADD %0, %1
360 $v8m2 = COPY %2(<vscale x 2 x s64>)
361 PseudoRET implicit $v8m2
369 ; CHECK-LABEL: name: test_nxv4i64
370 ; CHECK: [[COPY:%[0-9]+]]:_(<vscale x 4 x s64>) = COPY $v8m4
371 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<vscale x 4 x s64>) = COPY $v12m4
372 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(<vscale x 4 x s64>) = G_ADD [[COPY]], [[COPY1]]
373 ; CHECK-NEXT: $v8m4 = COPY [[ADD]](<vscale x 4 x s64>)
374 ; CHECK-NEXT: PseudoRET implicit $v8m4
375 %0:_(<vscale x 4 x s64>) = COPY $v8m4
376 %1:_(<vscale x 4 x s64>) = COPY $v12m4
377 %2:_(<vscale x 4 x s64>) = G_ADD %0, %1
378 $v8m4 = COPY %2(<vscale x 4 x s64>)
379 PseudoRET implicit $v8m4
387 ; CHECK-LABEL: name: test_nxv8i64
388 ; CHECK: [[COPY:%[0-9]+]]:_(<vscale x 8 x s64>) = COPY $v8m8
389 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<vscale x 8 x s64>) = COPY $v16m8
390 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(<vscale x 8 x s64>) = G_ADD [[COPY]], [[COPY1]]
391 ; CHECK-NEXT: $v8m8 = COPY [[ADD]](<vscale x 8 x s64>)
392 ; CHECK-NEXT: PseudoRET implicit $v8m8
393 %0:_(<vscale x 8 x s64>) = COPY $v8m8
394 %1:_(<vscale x 8 x s64>) = COPY $v16m8
395 %2:_(<vscale x 8 x s64>) = G_ADD %0, %1
396 $v8m8 = COPY %2(<vscale x 8 x s64>)
397 PseudoRET implicit $v8m8