1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -mattr=+m,+v < %s | FileCheck %s --check-prefixes=CHECK,RV32
3 ; RUN: llc -mtriple=riscv64 -mattr=+m,+v < %s | FileCheck %s --check-prefixes=CHECK,RV64
5 ; Check that we correctly scale the split part indirect offsets by VSCALE.
6 define <vscale x 32 x i32> @callee_scalable_vector_split_indirect(<vscale x 32 x i32> %x, <vscale x 32 x i32> %y) {
7 ; CHECK-LABEL: callee_scalable_vector_split_indirect:
9 ; CHECK-NEXT: csrr a1, vlenb
10 ; CHECK-NEXT: slli a1, a1, 3
11 ; CHECK-NEXT: add a1, a0, a1
12 ; CHECK-NEXT: vl8re32.v v24, (a0)
13 ; CHECK-NEXT: vl8re32.v v0, (a1)
14 ; CHECK-NEXT: vsetvli a0, zero, e32, m8, ta, ma
15 ; CHECK-NEXT: vadd.vv v8, v8, v24
16 ; CHECK-NEXT: vadd.vv v16, v16, v0
18 %a = add <vscale x 32 x i32> %x, %y
19 ret <vscale x 32 x i32> %a
22 ; Call the function above. Check that we set the arguments correctly.
23 define <vscale x 32 x i32> @caller_scalable_vector_split_indirect(<vscale x 32 x i32> %x) {
24 ; RV32-LABEL: caller_scalable_vector_split_indirect:
26 ; RV32-NEXT: addi sp, sp, -144
27 ; RV32-NEXT: .cfi_def_cfa_offset 144
28 ; RV32-NEXT: sw ra, 140(sp) # 4-byte Folded Spill
29 ; RV32-NEXT: sw s0, 136(sp) # 4-byte Folded Spill
30 ; RV32-NEXT: .cfi_offset ra, -4
31 ; RV32-NEXT: .cfi_offset s0, -8
32 ; RV32-NEXT: addi s0, sp, 144
33 ; RV32-NEXT: .cfi_def_cfa s0, 0
34 ; RV32-NEXT: csrr a0, vlenb
35 ; RV32-NEXT: slli a0, a0, 4
36 ; RV32-NEXT: sub sp, sp, a0
37 ; RV32-NEXT: andi sp, sp, -128
38 ; RV32-NEXT: addi a0, sp, 128
39 ; RV32-NEXT: vs8r.v v8, (a0)
40 ; RV32-NEXT: csrr a1, vlenb
41 ; RV32-NEXT: slli a1, a1, 3
42 ; RV32-NEXT: add a0, a0, a1
43 ; RV32-NEXT: vs8r.v v16, (a0)
44 ; RV32-NEXT: vsetvli a0, zero, e32, m8, ta, ma
45 ; RV32-NEXT: vmv.v.i v8, 0
46 ; RV32-NEXT: addi a0, sp, 128
47 ; RV32-NEXT: vmv.v.i v16, 0
48 ; RV32-NEXT: call callee_scalable_vector_split_indirect@plt
49 ; RV32-NEXT: addi sp, s0, -144
50 ; RV32-NEXT: lw ra, 140(sp) # 4-byte Folded Reload
51 ; RV32-NEXT: lw s0, 136(sp) # 4-byte Folded Reload
52 ; RV32-NEXT: addi sp, sp, 144
55 ; RV64-LABEL: caller_scalable_vector_split_indirect:
57 ; RV64-NEXT: addi sp, sp, -144
58 ; RV64-NEXT: .cfi_def_cfa_offset 144
59 ; RV64-NEXT: sd ra, 136(sp) # 8-byte Folded Spill
60 ; RV64-NEXT: sd s0, 128(sp) # 8-byte Folded Spill
61 ; RV64-NEXT: .cfi_offset ra, -8
62 ; RV64-NEXT: .cfi_offset s0, -16
63 ; RV64-NEXT: addi s0, sp, 144
64 ; RV64-NEXT: .cfi_def_cfa s0, 0
65 ; RV64-NEXT: csrr a0, vlenb
66 ; RV64-NEXT: slli a0, a0, 4
67 ; RV64-NEXT: sub sp, sp, a0
68 ; RV64-NEXT: andi sp, sp, -128
69 ; RV64-NEXT: addi a0, sp, 128
70 ; RV64-NEXT: vs8r.v v8, (a0)
71 ; RV64-NEXT: csrr a1, vlenb
72 ; RV64-NEXT: slli a1, a1, 3
73 ; RV64-NEXT: add a0, a0, a1
74 ; RV64-NEXT: vs8r.v v16, (a0)
75 ; RV64-NEXT: vsetvli a0, zero, e32, m8, ta, ma
76 ; RV64-NEXT: vmv.v.i v8, 0
77 ; RV64-NEXT: addi a0, sp, 128
78 ; RV64-NEXT: vmv.v.i v16, 0
79 ; RV64-NEXT: call callee_scalable_vector_split_indirect@plt
80 ; RV64-NEXT: addi sp, s0, -144
81 ; RV64-NEXT: ld ra, 136(sp) # 8-byte Folded Reload
82 ; RV64-NEXT: ld s0, 128(sp) # 8-byte Folded Reload
83 ; RV64-NEXT: addi sp, sp, 144
86 %a = call <vscale x 32 x i32> @callee_scalable_vector_split_indirect(<vscale x 32 x i32> zeroinitializer, <vscale x 32 x i32> %x)
87 ret <vscale x 32 x i32> %a