1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -mattr=+v -verify-machineinstrs -riscv-v-fixed-length-vector-lmul-max=1 < %s | FileCheck %s --check-prefixes=CHECK,LMULMAX1,RV32LMULMAX1
3 ; RUN: llc -mtriple=riscv64 -mattr=+v -verify-machineinstrs -riscv-v-fixed-length-vector-lmul-max=1 < %s | FileCheck %s --check-prefixes=CHECK,LMULMAX1,RV64LMULMAX1
4 ; RUN: llc -mtriple=riscv32 -mattr=+v -verify-machineinstrs -riscv-v-fixed-length-vector-lmul-max=2 < %s | FileCheck %s --check-prefixes=CHECK,LMULMAX2,RV32LMULMAX2
5 ; RUN: llc -mtriple=riscv64 -mattr=+v -verify-machineinstrs -riscv-v-fixed-length-vector-lmul-max=2 < %s | FileCheck %s --check-prefixes=CHECK,LMULMAX2,RV64LMULMAX2
7 declare <2 x i8> @llvm.experimental.stepvector.v2i8()
9 define <2 x i8> @stepvector_v2i8() {
10 ; CHECK-LABEL: stepvector_v2i8:
12 ; CHECK-NEXT: vsetivli zero, 2, e8, mf8, ta, ma
13 ; CHECK-NEXT: vid.v v8
15 %v = call <2 x i8> @llvm.experimental.stepvector.v2i8()
19 declare <3 x i8> @llvm.experimental.stepvector.v3i8()
21 define <3 x i8> @stepvector_v3i8() {
22 ; CHECK-LABEL: stepvector_v3i8:
24 ; CHECK-NEXT: vsetivli zero, 4, e8, mf4, ta, ma
25 ; CHECK-NEXT: vid.v v8
27 %v = call <3 x i8> @llvm.experimental.stepvector.v3i8()
31 declare <4 x i8> @llvm.experimental.stepvector.v4i8()
33 define <4 x i8> @stepvector_v4i8() {
34 ; CHECK-LABEL: stepvector_v4i8:
36 ; CHECK-NEXT: vsetivli zero, 4, e8, mf4, ta, ma
37 ; CHECK-NEXT: vid.v v8
39 %v = call <4 x i8> @llvm.experimental.stepvector.v4i8()
43 declare <8 x i8> @llvm.experimental.stepvector.v8i8()
45 define <8 x i8> @stepvector_v8i8() {
46 ; CHECK-LABEL: stepvector_v8i8:
48 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
49 ; CHECK-NEXT: vid.v v8
51 %v = call <8 x i8> @llvm.experimental.stepvector.v8i8()
55 declare <16 x i8> @llvm.experimental.stepvector.v16i8()
57 define <16 x i8> @stepvector_v16i8() {
58 ; CHECK-LABEL: stepvector_v16i8:
60 ; CHECK-NEXT: vsetivli zero, 16, e8, m1, ta, ma
61 ; CHECK-NEXT: vid.v v8
63 %v = call <16 x i8> @llvm.experimental.stepvector.v16i8()
67 declare <2 x i16> @llvm.experimental.stepvector.v2i16()
69 define <2 x i16> @stepvector_v2i16() {
70 ; CHECK-LABEL: stepvector_v2i16:
72 ; CHECK-NEXT: vsetivli zero, 2, e16, mf4, ta, ma
73 ; CHECK-NEXT: vid.v v8
75 %v = call <2 x i16> @llvm.experimental.stepvector.v2i16()
79 declare <4 x i16> @llvm.experimental.stepvector.v4i16()
81 define <4 x i16> @stepvector_v4i16() {
82 ; CHECK-LABEL: stepvector_v4i16:
84 ; CHECK-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
85 ; CHECK-NEXT: vid.v v8
87 %v = call <4 x i16> @llvm.experimental.stepvector.v4i16()
91 declare <8 x i16> @llvm.experimental.stepvector.v8i16()
93 define <8 x i16> @stepvector_v8i16() {
94 ; CHECK-LABEL: stepvector_v8i16:
96 ; CHECK-NEXT: vsetivli zero, 8, e16, m1, ta, ma
97 ; CHECK-NEXT: vid.v v8
99 %v = call <8 x i16> @llvm.experimental.stepvector.v8i16()
103 declare <16 x i16> @llvm.experimental.stepvector.v16i16()
105 define <16 x i16> @stepvector_v16i16() {
106 ; LMULMAX1-LABEL: stepvector_v16i16:
108 ; LMULMAX1-NEXT: vsetivli zero, 8, e16, m1, ta, ma
109 ; LMULMAX1-NEXT: vid.v v8
110 ; LMULMAX1-NEXT: vadd.vi v9, v8, 8
113 ; LMULMAX2-LABEL: stepvector_v16i16:
115 ; LMULMAX2-NEXT: vsetivli zero, 16, e16, m2, ta, ma
116 ; LMULMAX2-NEXT: vid.v v8
118 %v = call <16 x i16> @llvm.experimental.stepvector.v16i16()
122 declare <2 x i32> @llvm.experimental.stepvector.v2i32()
124 define <2 x i32> @stepvector_v2i32() {
125 ; CHECK-LABEL: stepvector_v2i32:
127 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
128 ; CHECK-NEXT: vid.v v8
130 %v = call <2 x i32> @llvm.experimental.stepvector.v2i32()
134 declare <4 x i32> @llvm.experimental.stepvector.v4i32()
136 define <4 x i32> @stepvector_v4i32() {
137 ; CHECK-LABEL: stepvector_v4i32:
139 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
140 ; CHECK-NEXT: vid.v v8
142 %v = call <4 x i32> @llvm.experimental.stepvector.v4i32()
146 declare <8 x i32> @llvm.experimental.stepvector.v8i32()
148 define <8 x i32> @stepvector_v8i32() {
149 ; LMULMAX1-LABEL: stepvector_v8i32:
151 ; LMULMAX1-NEXT: vsetivli zero, 4, e32, m1, ta, ma
152 ; LMULMAX1-NEXT: vid.v v8
153 ; LMULMAX1-NEXT: vadd.vi v9, v8, 4
156 ; LMULMAX2-LABEL: stepvector_v8i32:
158 ; LMULMAX2-NEXT: vsetivli zero, 8, e32, m2, ta, ma
159 ; LMULMAX2-NEXT: vid.v v8
161 %v = call <8 x i32> @llvm.experimental.stepvector.v8i32()
165 declare <16 x i32> @llvm.experimental.stepvector.v16i32()
167 define <16 x i32> @stepvector_v16i32() {
168 ; LMULMAX1-LABEL: stepvector_v16i32:
170 ; LMULMAX1-NEXT: vsetivli zero, 4, e32, m1, ta, ma
171 ; LMULMAX1-NEXT: vid.v v8
172 ; LMULMAX1-NEXT: vadd.vi v9, v8, 4
173 ; LMULMAX1-NEXT: vadd.vi v10, v8, 8
174 ; LMULMAX1-NEXT: vadd.vi v11, v8, 12
177 ; LMULMAX2-LABEL: stepvector_v16i32:
179 ; LMULMAX2-NEXT: vsetivli zero, 8, e32, m2, ta, ma
180 ; LMULMAX2-NEXT: vid.v v8
181 ; LMULMAX2-NEXT: vadd.vi v10, v8, 8
183 %v = call <16 x i32> @llvm.experimental.stepvector.v16i32()
187 declare <2 x i64> @llvm.experimental.stepvector.v2i64()
189 define <2 x i64> @stepvector_v2i64() {
190 ; RV32LMULMAX1-LABEL: stepvector_v2i64:
191 ; RV32LMULMAX1: # %bb.0:
192 ; RV32LMULMAX1-NEXT: lui a0, 16
193 ; RV32LMULMAX1-NEXT: vsetivli zero, 4, e32, m1, ta, ma
194 ; RV32LMULMAX1-NEXT: vmv.s.x v9, a0
195 ; RV32LMULMAX1-NEXT: vsext.vf4 v8, v9
196 ; RV32LMULMAX1-NEXT: ret
198 ; RV64LMULMAX1-LABEL: stepvector_v2i64:
199 ; RV64LMULMAX1: # %bb.0:
200 ; RV64LMULMAX1-NEXT: vsetivli zero, 2, e64, m1, ta, ma
201 ; RV64LMULMAX1-NEXT: vid.v v8
202 ; RV64LMULMAX1-NEXT: ret
204 ; RV32LMULMAX2-LABEL: stepvector_v2i64:
205 ; RV32LMULMAX2: # %bb.0:
206 ; RV32LMULMAX2-NEXT: lui a0, 16
207 ; RV32LMULMAX2-NEXT: vsetivli zero, 4, e32, m1, ta, ma
208 ; RV32LMULMAX2-NEXT: vmv.s.x v9, a0
209 ; RV32LMULMAX2-NEXT: vsext.vf4 v8, v9
210 ; RV32LMULMAX2-NEXT: ret
212 ; RV64LMULMAX2-LABEL: stepvector_v2i64:
213 ; RV64LMULMAX2: # %bb.0:
214 ; RV64LMULMAX2-NEXT: vsetivli zero, 2, e64, m1, ta, ma
215 ; RV64LMULMAX2-NEXT: vid.v v8
216 ; RV64LMULMAX2-NEXT: ret
217 %v = call <2 x i64> @llvm.experimental.stepvector.v2i64()
221 declare <4 x i64> @llvm.experimental.stepvector.v4i64()
223 define <4 x i64> @stepvector_v4i64() {
224 ; RV32LMULMAX1-LABEL: stepvector_v4i64:
225 ; RV32LMULMAX1: # %bb.0:
226 ; RV32LMULMAX1-NEXT: lui a0, 16
227 ; RV32LMULMAX1-NEXT: vsetivli zero, 4, e32, m1, ta, ma
228 ; RV32LMULMAX1-NEXT: vmv.s.x v9, a0
229 ; RV32LMULMAX1-NEXT: vsext.vf4 v8, v9
230 ; RV32LMULMAX1-NEXT: lui a0, 48
231 ; RV32LMULMAX1-NEXT: addi a0, a0, 2
232 ; RV32LMULMAX1-NEXT: vmv.s.x v10, a0
233 ; RV32LMULMAX1-NEXT: vsext.vf4 v9, v10
234 ; RV32LMULMAX1-NEXT: ret
236 ; RV64LMULMAX1-LABEL: stepvector_v4i64:
237 ; RV64LMULMAX1: # %bb.0:
238 ; RV64LMULMAX1-NEXT: vsetivli zero, 2, e64, m1, ta, ma
239 ; RV64LMULMAX1-NEXT: vid.v v8
240 ; RV64LMULMAX1-NEXT: vadd.vi v9, v8, 2
241 ; RV64LMULMAX1-NEXT: ret
243 ; RV32LMULMAX2-LABEL: stepvector_v4i64:
244 ; RV32LMULMAX2: # %bb.0:
245 ; RV32LMULMAX2-NEXT: lui a0, %hi(.LCPI14_0)
246 ; RV32LMULMAX2-NEXT: addi a0, a0, %lo(.LCPI14_0)
247 ; RV32LMULMAX2-NEXT: vsetivli zero, 8, e32, m2, ta, ma
248 ; RV32LMULMAX2-NEXT: vle8.v v10, (a0)
249 ; RV32LMULMAX2-NEXT: vsext.vf4 v8, v10
250 ; RV32LMULMAX2-NEXT: ret
252 ; RV64LMULMAX2-LABEL: stepvector_v4i64:
253 ; RV64LMULMAX2: # %bb.0:
254 ; RV64LMULMAX2-NEXT: vsetivli zero, 4, e64, m2, ta, ma
255 ; RV64LMULMAX2-NEXT: vid.v v8
256 ; RV64LMULMAX2-NEXT: ret
257 %v = call <4 x i64> @llvm.experimental.stepvector.v4i64()
261 declare <8 x i64> @llvm.experimental.stepvector.v8i64()
263 define <8 x i64> @stepvector_v8i64() {
264 ; RV32LMULMAX1-LABEL: stepvector_v8i64:
265 ; RV32LMULMAX1: # %bb.0:
266 ; RV32LMULMAX1-NEXT: lui a0, 16
267 ; RV32LMULMAX1-NEXT: vsetivli zero, 4, e32, m1, ta, ma
268 ; RV32LMULMAX1-NEXT: vmv.s.x v9, a0
269 ; RV32LMULMAX1-NEXT: vsext.vf4 v8, v9
270 ; RV32LMULMAX1-NEXT: lui a0, 48
271 ; RV32LMULMAX1-NEXT: addi a0, a0, 2
272 ; RV32LMULMAX1-NEXT: vmv.s.x v10, a0
273 ; RV32LMULMAX1-NEXT: vsext.vf4 v9, v10
274 ; RV32LMULMAX1-NEXT: lui a0, 80
275 ; RV32LMULMAX1-NEXT: addi a0, a0, 4
276 ; RV32LMULMAX1-NEXT: vmv.s.x v11, a0
277 ; RV32LMULMAX1-NEXT: vsext.vf4 v10, v11
278 ; RV32LMULMAX1-NEXT: lui a0, 112
279 ; RV32LMULMAX1-NEXT: addi a0, a0, 6
280 ; RV32LMULMAX1-NEXT: vmv.s.x v12, a0
281 ; RV32LMULMAX1-NEXT: vsext.vf4 v11, v12
282 ; RV32LMULMAX1-NEXT: ret
284 ; RV64LMULMAX1-LABEL: stepvector_v8i64:
285 ; RV64LMULMAX1: # %bb.0:
286 ; RV64LMULMAX1-NEXT: vsetivli zero, 2, e64, m1, ta, ma
287 ; RV64LMULMAX1-NEXT: vid.v v8
288 ; RV64LMULMAX1-NEXT: vadd.vi v9, v8, 2
289 ; RV64LMULMAX1-NEXT: vadd.vi v10, v8, 4
290 ; RV64LMULMAX1-NEXT: vadd.vi v11, v8, 6
291 ; RV64LMULMAX1-NEXT: ret
293 ; RV32LMULMAX2-LABEL: stepvector_v8i64:
294 ; RV32LMULMAX2: # %bb.0:
295 ; RV32LMULMAX2-NEXT: lui a0, %hi(.LCPI15_0)
296 ; RV32LMULMAX2-NEXT: addi a0, a0, %lo(.LCPI15_0)
297 ; RV32LMULMAX2-NEXT: vsetivli zero, 8, e32, m2, ta, ma
298 ; RV32LMULMAX2-NEXT: vle8.v v10, (a0)
299 ; RV32LMULMAX2-NEXT: lui a0, %hi(.LCPI15_1)
300 ; RV32LMULMAX2-NEXT: addi a0, a0, %lo(.LCPI15_1)
301 ; RV32LMULMAX2-NEXT: vle8.v v12, (a0)
302 ; RV32LMULMAX2-NEXT: vsext.vf4 v8, v10
303 ; RV32LMULMAX2-NEXT: vsext.vf4 v10, v12
304 ; RV32LMULMAX2-NEXT: ret
306 ; RV64LMULMAX2-LABEL: stepvector_v8i64:
307 ; RV64LMULMAX2: # %bb.0:
308 ; RV64LMULMAX2-NEXT: vsetivli zero, 4, e64, m2, ta, ma
309 ; RV64LMULMAX2-NEXT: vid.v v8
310 ; RV64LMULMAX2-NEXT: vadd.vi v10, v8, 4
311 ; RV64LMULMAX2-NEXT: ret
312 %v = call <8 x i64> @llvm.experimental.stepvector.v8i64()
316 declare <16 x i64> @llvm.experimental.stepvector.v16i64()
318 define <16 x i64> @stepvector_v16i64() {
319 ; RV32LMULMAX1-LABEL: stepvector_v16i64:
320 ; RV32LMULMAX1: # %bb.0:
321 ; RV32LMULMAX1-NEXT: lui a0, 16
322 ; RV32LMULMAX1-NEXT: vsetivli zero, 4, e32, m1, ta, ma
323 ; RV32LMULMAX1-NEXT: vmv.s.x v9, a0
324 ; RV32LMULMAX1-NEXT: vsext.vf4 v8, v9
325 ; RV32LMULMAX1-NEXT: lui a0, 48
326 ; RV32LMULMAX1-NEXT: addi a0, a0, 2
327 ; RV32LMULMAX1-NEXT: vmv.s.x v10, a0
328 ; RV32LMULMAX1-NEXT: vsext.vf4 v9, v10
329 ; RV32LMULMAX1-NEXT: lui a0, 80
330 ; RV32LMULMAX1-NEXT: addi a0, a0, 4
331 ; RV32LMULMAX1-NEXT: vmv.s.x v11, a0
332 ; RV32LMULMAX1-NEXT: vsext.vf4 v10, v11
333 ; RV32LMULMAX1-NEXT: lui a0, 112
334 ; RV32LMULMAX1-NEXT: addi a0, a0, 6
335 ; RV32LMULMAX1-NEXT: vmv.s.x v12, a0
336 ; RV32LMULMAX1-NEXT: vsext.vf4 v11, v12
337 ; RV32LMULMAX1-NEXT: lui a0, 144
338 ; RV32LMULMAX1-NEXT: addi a0, a0, 8
339 ; RV32LMULMAX1-NEXT: vmv.s.x v13, a0
340 ; RV32LMULMAX1-NEXT: vsext.vf4 v12, v13
341 ; RV32LMULMAX1-NEXT: lui a0, 176
342 ; RV32LMULMAX1-NEXT: addi a0, a0, 10
343 ; RV32LMULMAX1-NEXT: vmv.s.x v14, a0
344 ; RV32LMULMAX1-NEXT: vsext.vf4 v13, v14
345 ; RV32LMULMAX1-NEXT: lui a0, 208
346 ; RV32LMULMAX1-NEXT: addi a0, a0, 12
347 ; RV32LMULMAX1-NEXT: vmv.s.x v15, a0
348 ; RV32LMULMAX1-NEXT: vsext.vf4 v14, v15
349 ; RV32LMULMAX1-NEXT: lui a0, 240
350 ; RV32LMULMAX1-NEXT: addi a0, a0, 14
351 ; RV32LMULMAX1-NEXT: vmv.s.x v16, a0
352 ; RV32LMULMAX1-NEXT: vsext.vf4 v15, v16
353 ; RV32LMULMAX1-NEXT: ret
355 ; RV64LMULMAX1-LABEL: stepvector_v16i64:
356 ; RV64LMULMAX1: # %bb.0:
357 ; RV64LMULMAX1-NEXT: vsetivli zero, 2, e64, m1, ta, ma
358 ; RV64LMULMAX1-NEXT: vid.v v8
359 ; RV64LMULMAX1-NEXT: vadd.vi v9, v8, 2
360 ; RV64LMULMAX1-NEXT: vadd.vi v10, v8, 4
361 ; RV64LMULMAX1-NEXT: vadd.vi v11, v8, 6
362 ; RV64LMULMAX1-NEXT: vadd.vi v12, v8, 8
363 ; RV64LMULMAX1-NEXT: vadd.vi v13, v8, 10
364 ; RV64LMULMAX1-NEXT: vadd.vi v14, v8, 12
365 ; RV64LMULMAX1-NEXT: vadd.vi v15, v8, 14
366 ; RV64LMULMAX1-NEXT: ret
368 ; RV32LMULMAX2-LABEL: stepvector_v16i64:
369 ; RV32LMULMAX2: # %bb.0:
370 ; RV32LMULMAX2-NEXT: lui a0, %hi(.LCPI16_0)
371 ; RV32LMULMAX2-NEXT: addi a0, a0, %lo(.LCPI16_0)
372 ; RV32LMULMAX2-NEXT: vsetivli zero, 8, e32, m2, ta, ma
373 ; RV32LMULMAX2-NEXT: vle8.v v10, (a0)
374 ; RV32LMULMAX2-NEXT: lui a0, %hi(.LCPI16_1)
375 ; RV32LMULMAX2-NEXT: addi a0, a0, %lo(.LCPI16_1)
376 ; RV32LMULMAX2-NEXT: vle8.v v12, (a0)
377 ; RV32LMULMAX2-NEXT: lui a0, %hi(.LCPI16_2)
378 ; RV32LMULMAX2-NEXT: addi a0, a0, %lo(.LCPI16_2)
379 ; RV32LMULMAX2-NEXT: vle8.v v14, (a0)
380 ; RV32LMULMAX2-NEXT: lui a0, %hi(.LCPI16_3)
381 ; RV32LMULMAX2-NEXT: addi a0, a0, %lo(.LCPI16_3)
382 ; RV32LMULMAX2-NEXT: vle8.v v16, (a0)
383 ; RV32LMULMAX2-NEXT: vsext.vf4 v8, v10
384 ; RV32LMULMAX2-NEXT: vsext.vf4 v10, v12
385 ; RV32LMULMAX2-NEXT: vsext.vf4 v12, v14
386 ; RV32LMULMAX2-NEXT: vsext.vf4 v14, v16
387 ; RV32LMULMAX2-NEXT: ret
389 ; RV64LMULMAX2-LABEL: stepvector_v16i64:
390 ; RV64LMULMAX2: # %bb.0:
391 ; RV64LMULMAX2-NEXT: vsetivli zero, 4, e64, m2, ta, ma
392 ; RV64LMULMAX2-NEXT: vid.v v8
393 ; RV64LMULMAX2-NEXT: vadd.vi v10, v8, 4
394 ; RV64LMULMAX2-NEXT: vadd.vi v12, v8, 8
395 ; RV64LMULMAX2-NEXT: vadd.vi v14, v8, 12
396 ; RV64LMULMAX2-NEXT: ret
397 %v = call <16 x i64> @llvm.experimental.stepvector.v16i64()