1 # NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 # RUN: llc -mtriple=riscv32 -mattr=+m,+v -o - %s \
3 # RUN: -start-before=prologepilog | FileCheck %s
5 # These tests check that we are assigning the right stack slot to GPRs and to
6 # vector registers (VRs). If this test changes, make sure there is no overlap
7 # between slots for GPRs and VRs.
9 define void @foo() #0 {
11 ; CHECK: # %bb.0: # %entry
12 ; CHECK-NEXT: addi sp, sp, -32
13 ; CHECK-NEXT: sw s9, 28(sp) # 4-byte Folded Spill
14 ; CHECK-NEXT: csrr a1, vlenb
15 ; CHECK-NEXT: slli a1, a1, 1
16 ; CHECK-NEXT: sub sp, sp, a1
17 ; CHECK-NEXT: sw a0, 8(sp) # 4-byte Folded Spill
18 ; CHECK-NEXT: addi a0, sp, 16
19 ; CHECK-NEXT: vs2r.v v30, (a0) # Unknown-size Folded Spill
20 ; CHECK-NEXT: csrr a0, vlenb
21 ; CHECK-NEXT: slli a0, a0, 1
22 ; CHECK-NEXT: add sp, sp, a0
23 ; CHECK-NEXT: lw s9, 28(sp) # 4-byte Folded Reload
24 ; CHECK-NEXT: addi sp, sp, 32
30 define void @rvv_clobbers_callee_save() #0 {
31 ; CHECK-LABEL: rvv_clobbers_callee_save:
32 ; CHECK: # %bb.0: # %entry
33 ; CHECK-NEXT: addi sp, sp, -80
34 ; CHECK-NEXT: sw ra, 76(sp) # 4-byte Folded Spill
35 ; CHECK-NEXT: sw s0, 72(sp) # 4-byte Folded Spill
36 ; CHECK-NEXT: sw s9, 68(sp) # 4-byte Folded Spill
37 ; CHECK-NEXT: addi s0, sp, 80
38 ; CHECK-NEXT: csrr a1, vlenb
39 ; CHECK-NEXT: slli a1, a1, 1
40 ; CHECK-NEXT: sub sp, sp, a1
41 ; CHECK-NEXT: andi sp, sp, -32
42 ; CHECK-NEXT: sw a0, 32(sp) # 4-byte Folded Spill
43 ; CHECK-NEXT: addi a0, sp, 64
44 ; CHECK-NEXT: vs2r.v v30, (a0) # Unknown-size Folded Spill
45 ; CHECK-NEXT: addi sp, s0, -80
46 ; CHECK-NEXT: lw ra, 76(sp) # 4-byte Folded Reload
47 ; CHECK-NEXT: lw s0, 72(sp) # 4-byte Folded Reload
48 ; CHECK-NEXT: lw s9, 68(sp) # 4-byte Folded Reload
49 ; CHECK-NEXT: addi sp, sp, 80
55 attributes #0 = { nounwind }
63 - { id: 0, type: spill-slot, size: 4, alignment: 4 }
64 - { id: 1, type: spill-slot, size: 16, alignment: 8, stack-id: scalable-vector }
65 machineFunctionInfo: {}
71 SW renamable $x25, %stack.0, 0 :: (store (s32) into %stack.0)
72 VS2R_V renamable $v30m2, %stack.1 :: (store unknown-size into %stack.1, align 8)
77 name: rvv_clobbers_callee_save
82 - { id: 0, type: spill-slot, size: 4, alignment: 32 }
83 - { id: 1, type: spill-slot, size: 16, alignment: 8, stack-id: scalable-vector }
84 machineFunctionInfo: {}
90 SW renamable $x25, %stack.0, 0 :: (store (s32) into %stack.0)
91 VS2R_V renamable $v30m2, %stack.1 :: (store unknown-size into %stack.1, align 8)