1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -mattr=+m,+v -verify-machineinstrs < %s | FileCheck %s -check-prefixes=CHECK,RV32
3 ; RUN: llc -mtriple=riscv64 -mattr=+m,+v -verify-machineinstrs < %s | FileCheck %s -check-prefixes=CHECK,RV64
5 declare <vscale x 1 x i8> @llvm.experimental.stepvector.nxv1i8()
7 define <vscale x 1 x i8> @stepvector_nxv1i8() {
8 ; CHECK-LABEL: stepvector_nxv1i8:
10 ; CHECK-NEXT: vsetvli a0, zero, e8, mf8, ta, ma
11 ; CHECK-NEXT: vid.v v8
13 %v = call <vscale x 1 x i8> @llvm.experimental.stepvector.nxv1i8()
14 ret <vscale x 1 x i8> %v
17 declare <vscale x 2 x i8> @llvm.experimental.stepvector.nxv2i8()
19 define <vscale x 2 x i8> @stepvector_nxv2i8() {
20 ; CHECK-LABEL: stepvector_nxv2i8:
22 ; CHECK-NEXT: vsetvli a0, zero, e8, mf4, ta, ma
23 ; CHECK-NEXT: vid.v v8
25 %v = call <vscale x 2 x i8> @llvm.experimental.stepvector.nxv2i8()
26 ret <vscale x 2 x i8> %v
29 declare <vscale x 3 x i8> @llvm.experimental.stepvector.nxv3i8()
31 define <vscale x 3 x i8> @stepvector_nxv3i8() {
32 ; CHECK-LABEL: stepvector_nxv3i8:
34 ; CHECK-NEXT: vsetvli a0, zero, e8, mf2, ta, ma
35 ; CHECK-NEXT: vid.v v8
37 %v = call <vscale x 3 x i8> @llvm.experimental.stepvector.nxv3i8()
38 ret <vscale x 3 x i8> %v
41 declare <vscale x 4 x i8> @llvm.experimental.stepvector.nxv4i8()
43 define <vscale x 4 x i8> @stepvector_nxv4i8() {
44 ; CHECK-LABEL: stepvector_nxv4i8:
46 ; CHECK-NEXT: vsetvli a0, zero, e8, mf2, ta, ma
47 ; CHECK-NEXT: vid.v v8
49 %v = call <vscale x 4 x i8> @llvm.experimental.stepvector.nxv4i8()
50 ret <vscale x 4 x i8> %v
53 declare <vscale x 8 x i8> @llvm.experimental.stepvector.nxv8i8()
55 define <vscale x 8 x i8> @stepvector_nxv8i8() {
56 ; CHECK-LABEL: stepvector_nxv8i8:
58 ; CHECK-NEXT: vsetvli a0, zero, e8, m1, ta, ma
59 ; CHECK-NEXT: vid.v v8
61 %v = call <vscale x 8 x i8> @llvm.experimental.stepvector.nxv8i8()
62 ret <vscale x 8 x i8> %v
65 define <vscale x 8 x i8> @add_stepvector_nxv8i8() {
66 ; CHECK-LABEL: add_stepvector_nxv8i8:
67 ; CHECK: # %bb.0: # %entry
68 ; CHECK-NEXT: vsetvli a0, zero, e8, m1, ta, ma
69 ; CHECK-NEXT: vid.v v8
70 ; CHECK-NEXT: vadd.vv v8, v8, v8
73 %0 = call <vscale x 8 x i8> @llvm.experimental.stepvector.nxv8i8()
74 %1 = call <vscale x 8 x i8> @llvm.experimental.stepvector.nxv8i8()
75 %2 = add <vscale x 8 x i8> %0, %1
76 ret <vscale x 8 x i8> %2
79 define <vscale x 8 x i8> @mul_stepvector_nxv8i8() {
80 ; CHECK-LABEL: mul_stepvector_nxv8i8:
81 ; CHECK: # %bb.0: # %entry
82 ; CHECK-NEXT: vsetvli a0, zero, e8, m1, ta, ma
83 ; CHECK-NEXT: vid.v v8
84 ; CHECK-NEXT: li a0, 3
85 ; CHECK-NEXT: vmul.vx v8, v8, a0
88 %0 = insertelement <vscale x 8 x i8> poison, i8 3, i32 0
89 %1 = shufflevector <vscale x 8 x i8> %0, <vscale x 8 x i8> poison, <vscale x 8 x i32> zeroinitializer
90 %2 = call <vscale x 8 x i8> @llvm.experimental.stepvector.nxv8i8()
91 %3 = mul <vscale x 8 x i8> %2, %1
92 ret <vscale x 8 x i8> %3
95 define <vscale x 8 x i8> @shl_stepvector_nxv8i8() {
96 ; CHECK-LABEL: shl_stepvector_nxv8i8:
97 ; CHECK: # %bb.0: # %entry
98 ; CHECK-NEXT: vsetvli a0, zero, e8, m1, ta, ma
99 ; CHECK-NEXT: vid.v v8
100 ; CHECK-NEXT: vsll.vi v8, v8, 2
103 %0 = insertelement <vscale x 8 x i8> poison, i8 2, i32 0
104 %1 = shufflevector <vscale x 8 x i8> %0, <vscale x 8 x i8> poison, <vscale x 8 x i32> zeroinitializer
105 %2 = call <vscale x 8 x i8> @llvm.experimental.stepvector.nxv8i8()
106 %3 = shl <vscale x 8 x i8> %2, %1
107 ret <vscale x 8 x i8> %3
110 declare <vscale x 16 x i8> @llvm.experimental.stepvector.nxv16i8()
112 define <vscale x 16 x i8> @stepvector_nxv16i8() {
113 ; CHECK-LABEL: stepvector_nxv16i8:
115 ; CHECK-NEXT: vsetvli a0, zero, e8, m2, ta, ma
116 ; CHECK-NEXT: vid.v v8
118 %v = call <vscale x 16 x i8> @llvm.experimental.stepvector.nxv16i8()
119 ret <vscale x 16 x i8> %v
122 declare <vscale x 32 x i8> @llvm.experimental.stepvector.nxv32i8()
124 define <vscale x 32 x i8> @stepvector_nxv32i8() {
125 ; CHECK-LABEL: stepvector_nxv32i8:
127 ; CHECK-NEXT: vsetvli a0, zero, e8, m4, ta, ma
128 ; CHECK-NEXT: vid.v v8
130 %v = call <vscale x 32 x i8> @llvm.experimental.stepvector.nxv32i8()
131 ret <vscale x 32 x i8> %v
134 declare <vscale x 64 x i8> @llvm.experimental.stepvector.nxv64i8()
136 define <vscale x 64 x i8> @stepvector_nxv64i8() {
137 ; CHECK-LABEL: stepvector_nxv64i8:
139 ; CHECK-NEXT: vsetvli a0, zero, e8, m8, ta, ma
140 ; CHECK-NEXT: vid.v v8
142 %v = call <vscale x 64 x i8> @llvm.experimental.stepvector.nxv64i8()
143 ret <vscale x 64 x i8> %v
146 declare <vscale x 1 x i16> @llvm.experimental.stepvector.nxv1i16()
148 define <vscale x 1 x i16> @stepvector_nxv1i16() {
149 ; CHECK-LABEL: stepvector_nxv1i16:
151 ; CHECK-NEXT: vsetvli a0, zero, e16, mf4, ta, ma
152 ; CHECK-NEXT: vid.v v8
154 %v = call <vscale x 1 x i16> @llvm.experimental.stepvector.nxv1i16()
155 ret <vscale x 1 x i16> %v
158 declare <vscale x 2 x i16> @llvm.experimental.stepvector.nxv2i16()
160 define <vscale x 2 x i16> @stepvector_nxv2i16() {
161 ; CHECK-LABEL: stepvector_nxv2i16:
163 ; CHECK-NEXT: vsetvli a0, zero, e16, mf2, ta, ma
164 ; CHECK-NEXT: vid.v v8
166 %v = call <vscale x 2 x i16> @llvm.experimental.stepvector.nxv2i16()
167 ret <vscale x 2 x i16> %v
170 declare <vscale x 2 x i15> @llvm.experimental.stepvector.nxv2i15()
172 define <vscale x 2 x i15> @stepvector_nxv2i15() {
173 ; CHECK-LABEL: stepvector_nxv2i15:
175 ; CHECK-NEXT: vsetvli a0, zero, e16, mf2, ta, ma
176 ; CHECK-NEXT: vid.v v8
178 %v = call <vscale x 2 x i15> @llvm.experimental.stepvector.nxv2i15()
179 ret <vscale x 2 x i15> %v
182 declare <vscale x 3 x i16> @llvm.experimental.stepvector.nxv3i16()
184 define <vscale x 3 x i16> @stepvector_nxv3i16() {
185 ; CHECK-LABEL: stepvector_nxv3i16:
187 ; CHECK-NEXT: vsetvli a0, zero, e16, m1, ta, ma
188 ; CHECK-NEXT: vid.v v8
190 %v = call <vscale x 3 x i16> @llvm.experimental.stepvector.nxv3i16()
191 ret <vscale x 3 x i16> %v
194 declare <vscale x 4 x i16> @llvm.experimental.stepvector.nxv4i16()
196 define <vscale x 4 x i16> @stepvector_nxv4i16() {
197 ; CHECK-LABEL: stepvector_nxv4i16:
199 ; CHECK-NEXT: vsetvli a0, zero, e16, m1, ta, ma
200 ; CHECK-NEXT: vid.v v8
202 %v = call <vscale x 4 x i16> @llvm.experimental.stepvector.nxv4i16()
203 ret <vscale x 4 x i16> %v
206 declare <vscale x 8 x i16> @llvm.experimental.stepvector.nxv8i16()
208 define <vscale x 8 x i16> @stepvector_nxv8i16() {
209 ; CHECK-LABEL: stepvector_nxv8i16:
211 ; CHECK-NEXT: vsetvli a0, zero, e16, m2, ta, ma
212 ; CHECK-NEXT: vid.v v8
214 %v = call <vscale x 8 x i16> @llvm.experimental.stepvector.nxv8i16()
215 ret <vscale x 8 x i16> %v
218 declare <vscale x 16 x i16> @llvm.experimental.stepvector.nxv16i16()
220 define <vscale x 16 x i16> @stepvector_nxv16i16() {
221 ; CHECK-LABEL: stepvector_nxv16i16:
223 ; CHECK-NEXT: vsetvli a0, zero, e16, m4, ta, ma
224 ; CHECK-NEXT: vid.v v8
226 %v = call <vscale x 16 x i16> @llvm.experimental.stepvector.nxv16i16()
227 ret <vscale x 16 x i16> %v
230 define <vscale x 16 x i16> @add_stepvector_nxv16i16() {
231 ; CHECK-LABEL: add_stepvector_nxv16i16:
232 ; CHECK: # %bb.0: # %entry
233 ; CHECK-NEXT: vsetvli a0, zero, e16, m4, ta, ma
234 ; CHECK-NEXT: vid.v v8
235 ; CHECK-NEXT: vadd.vv v8, v8, v8
238 %0 = call <vscale x 16 x i16> @llvm.experimental.stepvector.nxv16i16()
239 %1 = call <vscale x 16 x i16> @llvm.experimental.stepvector.nxv16i16()
240 %2 = add <vscale x 16 x i16> %0, %1
241 ret <vscale x 16 x i16> %2
244 define <vscale x 16 x i16> @mul_stepvector_nxv16i16() {
245 ; CHECK-LABEL: mul_stepvector_nxv16i16:
246 ; CHECK: # %bb.0: # %entry
247 ; CHECK-NEXT: vsetvli a0, zero, e16, m4, ta, ma
248 ; CHECK-NEXT: vid.v v8
249 ; CHECK-NEXT: li a0, 3
250 ; CHECK-NEXT: vmul.vx v8, v8, a0
253 %0 = insertelement <vscale x 16 x i16> poison, i16 3, i32 0
254 %1 = shufflevector <vscale x 16 x i16> %0, <vscale x 16 x i16> poison, <vscale x 16 x i32> zeroinitializer
255 %2 = call <vscale x 16 x i16> @llvm.experimental.stepvector.nxv16i16()
256 %3 = mul <vscale x 16 x i16> %2, %1
257 ret <vscale x 16 x i16> %3
260 define <vscale x 16 x i16> @shl_stepvector_nxv16i16() {
261 ; CHECK-LABEL: shl_stepvector_nxv16i16:
262 ; CHECK: # %bb.0: # %entry
263 ; CHECK-NEXT: vsetvli a0, zero, e16, m4, ta, ma
264 ; CHECK-NEXT: vid.v v8
265 ; CHECK-NEXT: vsll.vi v8, v8, 2
268 %0 = insertelement <vscale x 16 x i16> poison, i16 2, i32 0
269 %1 = shufflevector <vscale x 16 x i16> %0, <vscale x 16 x i16> poison, <vscale x 16 x i32> zeroinitializer
270 %2 = call <vscale x 16 x i16> @llvm.experimental.stepvector.nxv16i16()
271 %3 = shl <vscale x 16 x i16> %2, %1
272 ret <vscale x 16 x i16> %3
275 declare <vscale x 32 x i16> @llvm.experimental.stepvector.nxv32i16()
277 define <vscale x 32 x i16> @stepvector_nxv32i16() {
278 ; CHECK-LABEL: stepvector_nxv32i16:
280 ; CHECK-NEXT: vsetvli a0, zero, e16, m8, ta, ma
281 ; CHECK-NEXT: vid.v v8
283 %v = call <vscale x 32 x i16> @llvm.experimental.stepvector.nxv32i16()
284 ret <vscale x 32 x i16> %v
287 declare <vscale x 1 x i32> @llvm.experimental.stepvector.nxv1i32()
289 define <vscale x 1 x i32> @stepvector_nxv1i32() {
290 ; CHECK-LABEL: stepvector_nxv1i32:
292 ; CHECK-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
293 ; CHECK-NEXT: vid.v v8
295 %v = call <vscale x 1 x i32> @llvm.experimental.stepvector.nxv1i32()
296 ret <vscale x 1 x i32> %v
299 declare <vscale x 2 x i32> @llvm.experimental.stepvector.nxv2i32()
301 define <vscale x 2 x i32> @stepvector_nxv2i32() {
302 ; CHECK-LABEL: stepvector_nxv2i32:
304 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
305 ; CHECK-NEXT: vid.v v8
307 %v = call <vscale x 2 x i32> @llvm.experimental.stepvector.nxv2i32()
308 ret <vscale x 2 x i32> %v
311 declare <vscale x 3 x i32> @llvm.experimental.stepvector.nxv3i32()
313 define <vscale x 3 x i32> @stepvector_nxv3i32() {
314 ; CHECK-LABEL: stepvector_nxv3i32:
316 ; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
317 ; CHECK-NEXT: vid.v v8
319 %v = call <vscale x 3 x i32> @llvm.experimental.stepvector.nxv3i32()
320 ret <vscale x 3 x i32> %v
323 declare <vscale x 4 x i32> @llvm.experimental.stepvector.nxv4i32()
325 define <vscale x 4 x i32> @stepvector_nxv4i32() {
326 ; CHECK-LABEL: stepvector_nxv4i32:
328 ; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
329 ; CHECK-NEXT: vid.v v8
331 %v = call <vscale x 4 x i32> @llvm.experimental.stepvector.nxv4i32()
332 ret <vscale x 4 x i32> %v
335 declare <vscale x 8 x i32> @llvm.experimental.stepvector.nxv8i32()
337 define <vscale x 8 x i32> @stepvector_nxv8i32() {
338 ; CHECK-LABEL: stepvector_nxv8i32:
340 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma
341 ; CHECK-NEXT: vid.v v8
343 %v = call <vscale x 8 x i32> @llvm.experimental.stepvector.nxv8i32()
344 ret <vscale x 8 x i32> %v
347 declare <vscale x 16 x i32> @llvm.experimental.stepvector.nxv16i32()
349 define <vscale x 16 x i32> @stepvector_nxv16i32() {
350 ; CHECK-LABEL: stepvector_nxv16i32:
352 ; CHECK-NEXT: vsetvli a0, zero, e32, m8, ta, ma
353 ; CHECK-NEXT: vid.v v8
355 %v = call <vscale x 16 x i32> @llvm.experimental.stepvector.nxv16i32()
356 ret <vscale x 16 x i32> %v
359 define <vscale x 16 x i32> @add_stepvector_nxv16i32() {
360 ; CHECK-LABEL: add_stepvector_nxv16i32:
361 ; CHECK: # %bb.0: # %entry
362 ; CHECK-NEXT: vsetvli a0, zero, e32, m8, ta, ma
363 ; CHECK-NEXT: vid.v v8
364 ; CHECK-NEXT: vadd.vv v8, v8, v8
367 %0 = call <vscale x 16 x i32> @llvm.experimental.stepvector.nxv16i32()
368 %1 = call <vscale x 16 x i32> @llvm.experimental.stepvector.nxv16i32()
369 %2 = add <vscale x 16 x i32> %0, %1
370 ret <vscale x 16 x i32> %2
373 define <vscale x 16 x i32> @mul_stepvector_nxv16i32() {
374 ; CHECK-LABEL: mul_stepvector_nxv16i32:
375 ; CHECK: # %bb.0: # %entry
376 ; CHECK-NEXT: vsetvli a0, zero, e32, m8, ta, ma
377 ; CHECK-NEXT: vid.v v8
378 ; CHECK-NEXT: li a0, 3
379 ; CHECK-NEXT: vmul.vx v8, v8, a0
382 %0 = insertelement <vscale x 16 x i32> poison, i32 3, i32 0
383 %1 = shufflevector <vscale x 16 x i32> %0, <vscale x 16 x i32> poison, <vscale x 16 x i32> zeroinitializer
384 %2 = call <vscale x 16 x i32> @llvm.experimental.stepvector.nxv16i32()
385 %3 = mul <vscale x 16 x i32> %2, %1
386 ret <vscale x 16 x i32> %3
389 define <vscale x 16 x i32> @shl_stepvector_nxv16i32() {
390 ; CHECK-LABEL: shl_stepvector_nxv16i32:
391 ; CHECK: # %bb.0: # %entry
392 ; CHECK-NEXT: vsetvli a0, zero, e32, m8, ta, ma
393 ; CHECK-NEXT: vid.v v8
394 ; CHECK-NEXT: vsll.vi v8, v8, 2
397 %0 = insertelement <vscale x 16 x i32> poison, i32 2, i32 0
398 %1 = shufflevector <vscale x 16 x i32> %0, <vscale x 16 x i32> poison, <vscale x 16 x i32> zeroinitializer
399 %2 = call <vscale x 16 x i32> @llvm.experimental.stepvector.nxv16i32()
400 %3 = shl <vscale x 16 x i32> %2, %1
401 ret <vscale x 16 x i32> %3
404 declare <vscale x 1 x i64> @llvm.experimental.stepvector.nxv1i64()
406 define <vscale x 1 x i64> @stepvector_nxv1i64() {
407 ; CHECK-LABEL: stepvector_nxv1i64:
409 ; CHECK-NEXT: vsetvli a0, zero, e64, m1, ta, ma
410 ; CHECK-NEXT: vid.v v8
412 %v = call <vscale x 1 x i64> @llvm.experimental.stepvector.nxv1i64()
413 ret <vscale x 1 x i64> %v
416 declare <vscale x 2 x i64> @llvm.experimental.stepvector.nxv2i64()
418 define <vscale x 2 x i64> @stepvector_nxv2i64() {
419 ; CHECK-LABEL: stepvector_nxv2i64:
421 ; CHECK-NEXT: vsetvli a0, zero, e64, m2, ta, ma
422 ; CHECK-NEXT: vid.v v8
424 %v = call <vscale x 2 x i64> @llvm.experimental.stepvector.nxv2i64()
425 ret <vscale x 2 x i64> %v
428 declare <vscale x 3 x i64> @llvm.experimental.stepvector.nxv3i64()
430 define <vscale x 3 x i64> @stepvector_nxv3i64() {
431 ; CHECK-LABEL: stepvector_nxv3i64:
433 ; CHECK-NEXT: vsetvli a0, zero, e64, m4, ta, ma
434 ; CHECK-NEXT: vid.v v8
436 %v = call <vscale x 3 x i64> @llvm.experimental.stepvector.nxv3i64()
437 ret <vscale x 3 x i64> %v
440 declare <vscale x 4 x i64> @llvm.experimental.stepvector.nxv4i64()
442 define <vscale x 4 x i64> @stepvector_nxv4i64() {
443 ; CHECK-LABEL: stepvector_nxv4i64:
445 ; CHECK-NEXT: vsetvli a0, zero, e64, m4, ta, ma
446 ; CHECK-NEXT: vid.v v8
448 %v = call <vscale x 4 x i64> @llvm.experimental.stepvector.nxv4i64()
449 ret <vscale x 4 x i64> %v
452 declare <vscale x 8 x i64> @llvm.experimental.stepvector.nxv8i64()
454 define <vscale x 8 x i64> @stepvector_nxv8i64() {
455 ; CHECK-LABEL: stepvector_nxv8i64:
457 ; CHECK-NEXT: vsetvli a0, zero, e64, m8, ta, ma
458 ; CHECK-NEXT: vid.v v8
460 %v = call <vscale x 8 x i64> @llvm.experimental.stepvector.nxv8i64()
461 ret <vscale x 8 x i64> %v
464 define <vscale x 8 x i64> @add_stepvector_nxv8i64() {
465 ; CHECK-LABEL: add_stepvector_nxv8i64:
466 ; CHECK: # %bb.0: # %entry
467 ; CHECK-NEXT: vsetvli a0, zero, e64, m8, ta, ma
468 ; CHECK-NEXT: vid.v v8
469 ; CHECK-NEXT: vadd.vv v8, v8, v8
472 %0 = call <vscale x 8 x i64> @llvm.experimental.stepvector.nxv8i64()
473 %1 = call <vscale x 8 x i64> @llvm.experimental.stepvector.nxv8i64()
474 %2 = add <vscale x 8 x i64> %0, %1
475 ret <vscale x 8 x i64> %2
478 define <vscale x 8 x i64> @mul_stepvector_nxv8i64() {
479 ; CHECK-LABEL: mul_stepvector_nxv8i64:
480 ; CHECK: # %bb.0: # %entry
481 ; CHECK-NEXT: vsetvli a0, zero, e64, m8, ta, ma
482 ; CHECK-NEXT: vid.v v8
483 ; CHECK-NEXT: li a0, 3
484 ; CHECK-NEXT: vmul.vx v8, v8, a0
487 %0 = insertelement <vscale x 8 x i64> poison, i64 3, i32 0
488 %1 = shufflevector <vscale x 8 x i64> %0, <vscale x 8 x i64> poison, <vscale x 8 x i32> zeroinitializer
489 %2 = call <vscale x 8 x i64> @llvm.experimental.stepvector.nxv8i64()
490 %3 = mul <vscale x 8 x i64> %2, %1
491 ret <vscale x 8 x i64> %3
494 define <vscale x 8 x i64> @mul_bigimm_stepvector_nxv8i64() {
495 ; RV32-LABEL: mul_bigimm_stepvector_nxv8i64:
496 ; RV32: # %bb.0: # %entry
497 ; RV32-NEXT: addi sp, sp, -16
498 ; RV32-NEXT: .cfi_def_cfa_offset 16
499 ; RV32-NEXT: li a0, 7
500 ; RV32-NEXT: sw a0, 12(sp)
501 ; RV32-NEXT: lui a0, 797989
502 ; RV32-NEXT: addi a0, a0, -683
503 ; RV32-NEXT: sw a0, 8(sp)
504 ; RV32-NEXT: addi a0, sp, 8
505 ; RV32-NEXT: vsetvli a1, zero, e64, m8, ta, ma
506 ; RV32-NEXT: vlse64.v v8, (a0), zero
507 ; RV32-NEXT: vid.v v16
508 ; RV32-NEXT: vmul.vv v8, v16, v8
509 ; RV32-NEXT: addi sp, sp, 16
512 ; RV64-LABEL: mul_bigimm_stepvector_nxv8i64:
513 ; RV64: # %bb.0: # %entry
514 ; RV64-NEXT: vsetvli a0, zero, e64, m8, ta, ma
515 ; RV64-NEXT: vid.v v8
516 ; RV64-NEXT: lui a0, 1987
517 ; RV64-NEXT: addiw a0, a0, -731
518 ; RV64-NEXT: slli a0, a0, 12
519 ; RV64-NEXT: addi a0, a0, -683
520 ; RV64-NEXT: vmul.vx v8, v8, a0
523 %0 = insertelement <vscale x 8 x i64> poison, i64 33333333333, i32 0
524 %1 = shufflevector <vscale x 8 x i64> %0, <vscale x 8 x i64> poison, <vscale x 8 x i32> zeroinitializer
525 %2 = call <vscale x 8 x i64> @llvm.experimental.stepvector.nxv8i64()
526 %3 = mul <vscale x 8 x i64> %2, %1
527 ret <vscale x 8 x i64> %3
530 define <vscale x 8 x i64> @shl_stepvector_nxv8i64() {
531 ; CHECK-LABEL: shl_stepvector_nxv8i64:
532 ; CHECK: # %bb.0: # %entry
533 ; CHECK-NEXT: vsetvli a0, zero, e64, m8, ta, ma
534 ; CHECK-NEXT: vid.v v8
535 ; CHECK-NEXT: vsll.vi v8, v8, 2
538 %0 = insertelement <vscale x 8 x i64> poison, i64 2, i32 0
539 %1 = shufflevector <vscale x 8 x i64> %0, <vscale x 8 x i64> poison, <vscale x 8 x i32> zeroinitializer
540 %2 = call <vscale x 8 x i64> @llvm.experimental.stepvector.nxv8i64()
541 %3 = shl <vscale x 8 x i64> %2, %1
542 ret <vscale x 8 x i64> %3
545 declare <vscale x 16 x i64> @llvm.experimental.stepvector.nxv16i64()
547 define <vscale x 16 x i64> @stepvector_nxv16i64() {
548 ; RV32-LABEL: stepvector_nxv16i64:
550 ; RV32-NEXT: addi sp, sp, -16
551 ; RV32-NEXT: .cfi_def_cfa_offset 16
552 ; RV32-NEXT: sw zero, 12(sp)
553 ; RV32-NEXT: csrr a0, vlenb
554 ; RV32-NEXT: sw a0, 8(sp)
555 ; RV32-NEXT: addi a0, sp, 8
556 ; RV32-NEXT: vsetvli a1, zero, e64, m8, ta, ma
557 ; RV32-NEXT: vlse64.v v16, (a0), zero
558 ; RV32-NEXT: vid.v v8
559 ; RV32-NEXT: vadd.vv v16, v8, v16
560 ; RV32-NEXT: addi sp, sp, 16
563 ; RV64-LABEL: stepvector_nxv16i64:
565 ; RV64-NEXT: csrr a0, vlenb
566 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, ma
567 ; RV64-NEXT: vid.v v8
568 ; RV64-NEXT: vadd.vx v16, v8, a0
570 %v = call <vscale x 16 x i64> @llvm.experimental.stepvector.nxv16i64()
571 ret <vscale x 16 x i64> %v
574 define <vscale x 16 x i64> @add_stepvector_nxv16i64() {
575 ; RV32-LABEL: add_stepvector_nxv16i64:
576 ; RV32: # %bb.0: # %entry
577 ; RV32-NEXT: addi sp, sp, -16
578 ; RV32-NEXT: .cfi_def_cfa_offset 16
579 ; RV32-NEXT: sw zero, 12(sp)
580 ; RV32-NEXT: csrr a0, vlenb
581 ; RV32-NEXT: slli a0, a0, 1
582 ; RV32-NEXT: sw a0, 8(sp)
583 ; RV32-NEXT: vsetvli a0, zero, e64, m8, ta, ma
584 ; RV32-NEXT: addi a0, sp, 8
585 ; RV32-NEXT: vlse64.v v16, (a0), zero
586 ; RV32-NEXT: vid.v v8
587 ; RV32-NEXT: vadd.vv v8, v8, v8
588 ; RV32-NEXT: vadd.vv v16, v8, v16
589 ; RV32-NEXT: addi sp, sp, 16
592 ; RV64-LABEL: add_stepvector_nxv16i64:
593 ; RV64: # %bb.0: # %entry
594 ; RV64-NEXT: csrr a0, vlenb
595 ; RV64-NEXT: slli a0, a0, 1
596 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, ma
597 ; RV64-NEXT: vid.v v8
598 ; RV64-NEXT: vadd.vv v8, v8, v8
599 ; RV64-NEXT: vadd.vx v16, v8, a0
602 %0 = call <vscale x 16 x i64> @llvm.experimental.stepvector.nxv16i64()
603 %1 = call <vscale x 16 x i64> @llvm.experimental.stepvector.nxv16i64()
604 %2 = add <vscale x 16 x i64> %0, %1
605 ret <vscale x 16 x i64> %2
608 define <vscale x 16 x i64> @mul_stepvector_nxv16i64() {
609 ; RV32-LABEL: mul_stepvector_nxv16i64:
610 ; RV32: # %bb.0: # %entry
611 ; RV32-NEXT: addi sp, sp, -16
612 ; RV32-NEXT: .cfi_def_cfa_offset 16
613 ; RV32-NEXT: sw zero, 12(sp)
614 ; RV32-NEXT: csrr a0, vlenb
615 ; RV32-NEXT: slli a1, a0, 1
616 ; RV32-NEXT: add a0, a1, a0
617 ; RV32-NEXT: sw a0, 8(sp)
618 ; RV32-NEXT: vsetvli a0, zero, e64, m8, ta, ma
619 ; RV32-NEXT: addi a0, sp, 8
620 ; RV32-NEXT: vlse64.v v16, (a0), zero
621 ; RV32-NEXT: vid.v v8
622 ; RV32-NEXT: li a0, 3
623 ; RV32-NEXT: vmul.vx v8, v8, a0
624 ; RV32-NEXT: vadd.vv v16, v8, v16
625 ; RV32-NEXT: addi sp, sp, 16
628 ; RV64-LABEL: mul_stepvector_nxv16i64:
629 ; RV64: # %bb.0: # %entry
630 ; RV64-NEXT: vsetvli a0, zero, e64, m8, ta, ma
631 ; RV64-NEXT: vid.v v8
632 ; RV64-NEXT: li a0, 3
633 ; RV64-NEXT: vmul.vx v8, v8, a0
634 ; RV64-NEXT: csrr a0, vlenb
635 ; RV64-NEXT: slli a1, a0, 1
636 ; RV64-NEXT: add a0, a1, a0
637 ; RV64-NEXT: vadd.vx v16, v8, a0
640 %0 = insertelement <vscale x 16 x i64> poison, i64 3, i32 0
641 %1 = shufflevector <vscale x 16 x i64> %0, <vscale x 16 x i64> poison, <vscale x 16 x i32> zeroinitializer
642 %2 = call <vscale x 16 x i64> @llvm.experimental.stepvector.nxv16i64()
643 %3 = mul <vscale x 16 x i64> %2, %1
644 ret <vscale x 16 x i64> %3
647 define <vscale x 16 x i64> @mul_bigimm_stepvector_nxv16i64() {
648 ; RV32-LABEL: mul_bigimm_stepvector_nxv16i64:
649 ; RV32: # %bb.0: # %entry
650 ; RV32-NEXT: addi sp, sp, -16
651 ; RV32-NEXT: .cfi_def_cfa_offset 16
652 ; RV32-NEXT: li a0, 7
653 ; RV32-NEXT: sw a0, 12(sp)
654 ; RV32-NEXT: lui a0, 797989
655 ; RV32-NEXT: addi a0, a0, -683
656 ; RV32-NEXT: sw a0, 8(sp)
657 ; RV32-NEXT: csrr a0, vlenb
658 ; RV32-NEXT: lui a1, 11557
659 ; RV32-NEXT: addi a1, a1, -683
660 ; RV32-NEXT: mul a1, a0, a1
661 ; RV32-NEXT: sw a1, 0(sp)
662 ; RV32-NEXT: srli a0, a0, 3
663 ; RV32-NEXT: li a1, 62
664 ; RV32-NEXT: mul a1, a0, a1
665 ; RV32-NEXT: lui a2, 92455
666 ; RV32-NEXT: addi a2, a2, -1368
667 ; RV32-NEXT: mulhu a0, a0, a2
668 ; RV32-NEXT: add a0, a0, a1
669 ; RV32-NEXT: sw a0, 4(sp)
670 ; RV32-NEXT: addi a0, sp, 8
671 ; RV32-NEXT: vsetvli a1, zero, e64, m8, ta, ma
672 ; RV32-NEXT: vlse64.v v8, (a0), zero
673 ; RV32-NEXT: mv a0, sp
674 ; RV32-NEXT: vlse64.v v16, (a0), zero
675 ; RV32-NEXT: vid.v v24
676 ; RV32-NEXT: vmul.vv v8, v24, v8
677 ; RV32-NEXT: vadd.vv v16, v8, v16
678 ; RV32-NEXT: addi sp, sp, 16
681 ; RV64-LABEL: mul_bigimm_stepvector_nxv16i64:
682 ; RV64: # %bb.0: # %entry
683 ; RV64-NEXT: csrr a0, vlenb
684 ; RV64-NEXT: lui a1, 1987
685 ; RV64-NEXT: addiw a1, a1, -731
686 ; RV64-NEXT: slli a1, a1, 12
687 ; RV64-NEXT: addi a1, a1, -683
688 ; RV64-NEXT: mul a0, a0, a1
689 ; RV64-NEXT: vsetvli a2, zero, e64, m8, ta, ma
690 ; RV64-NEXT: vid.v v8
691 ; RV64-NEXT: vmul.vx v8, v8, a1
692 ; RV64-NEXT: vadd.vx v16, v8, a0
695 %0 = insertelement <vscale x 16 x i64> poison, i64 33333333333, i32 0
696 %1 = shufflevector <vscale x 16 x i64> %0, <vscale x 16 x i64> poison, <vscale x 16 x i32> zeroinitializer
697 %2 = call <vscale x 16 x i64> @llvm.experimental.stepvector.nxv16i64()
698 %3 = mul <vscale x 16 x i64> %2, %1
699 ret <vscale x 16 x i64> %3
702 define <vscale x 16 x i64> @shl_stepvector_nxv16i64() {
703 ; RV32-LABEL: shl_stepvector_nxv16i64:
704 ; RV32: # %bb.0: # %entry
705 ; RV32-NEXT: addi sp, sp, -16
706 ; RV32-NEXT: .cfi_def_cfa_offset 16
707 ; RV32-NEXT: sw zero, 12(sp)
708 ; RV32-NEXT: csrr a0, vlenb
709 ; RV32-NEXT: slli a0, a0, 2
710 ; RV32-NEXT: sw a0, 8(sp)
711 ; RV32-NEXT: vsetvli a0, zero, e64, m8, ta, ma
712 ; RV32-NEXT: addi a0, sp, 8
713 ; RV32-NEXT: vlse64.v v16, (a0), zero
714 ; RV32-NEXT: vid.v v8
715 ; RV32-NEXT: vsll.vi v8, v8, 2
716 ; RV32-NEXT: vadd.vv v16, v8, v16
717 ; RV32-NEXT: addi sp, sp, 16
720 ; RV64-LABEL: shl_stepvector_nxv16i64:
721 ; RV64: # %bb.0: # %entry
722 ; RV64-NEXT: csrr a0, vlenb
723 ; RV64-NEXT: slli a0, a0, 2
724 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, ma
725 ; RV64-NEXT: vid.v v8
726 ; RV64-NEXT: vsll.vi v8, v8, 2
727 ; RV64-NEXT: vadd.vx v16, v8, a0
730 %0 = insertelement <vscale x 16 x i64> poison, i64 2, i32 0
731 %1 = shufflevector <vscale x 16 x i64> %0, <vscale x 16 x i64> poison, <vscale x 16 x i32> zeroinitializer
732 %2 = call <vscale x 16 x i64> @llvm.experimental.stepvector.nxv16i64()
733 %3 = shl <vscale x 16 x i64> %2, %1
734 ret <vscale x 16 x i64> %3