1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -mattr=+m -mattr=+v -O2 < %s \
3 ; RUN: | FileCheck --check-prefix=SPILL-O2 %s
5 define <vscale x 1 x i32> @test_vector_std(<vscale x 1 x i32> %va) nounwind {
6 ; SPILL-O2-LABEL: test_vector_std:
7 ; SPILL-O2: # %bb.0: # %entry
8 ; SPILL-O2-NEXT: addi sp, sp, -16
9 ; SPILL-O2-NEXT: csrr a0, vlenb
10 ; SPILL-O2-NEXT: slli a0, a0, 1
11 ; SPILL-O2-NEXT: sub sp, sp, a0
12 ; SPILL-O2-NEXT: addi a0, sp, 16
13 ; SPILL-O2-NEXT: vs1r.v v8, (a0) # Unknown-size Folded Spill
15 ; SPILL-O2-NEXT: #NO_APP
16 ; SPILL-O2-NEXT: vl1r.v v8, (a0) # Unknown-size Folded Reload
17 ; SPILL-O2-NEXT: csrr a0, vlenb
18 ; SPILL-O2-NEXT: slli a0, a0, 1
19 ; SPILL-O2-NEXT: add sp, sp, a0
20 ; SPILL-O2-NEXT: addi sp, sp, 16
23 call void asm sideeffect "",
24 "~{v0},~{v1},~{v2},~{v3},~{v4},~{v5},~{v6},~{v7},~{v8},~{v9},~{v10},~{v11},~{v12},~{v13},~{v14},~{v15},~{v16},~{v17},~{v18},~{v19},~{v20},~{v21},~{v22},~{v23},~{v24},~{v25},~{v26},~{v27},~{v28},~{v29},~{v30},~{v31}"()
26 ret <vscale x 1 x i32> %va
29 define riscv_vector_cc <vscale x 1 x i32> @test_vector_callee(<vscale x 1 x i32> %va) nounwind {
30 ; SPILL-O2-LABEL: test_vector_callee:
31 ; SPILL-O2: # %bb.0: # %entry
32 ; SPILL-O2-NEXT: addi sp, sp, -16
33 ; SPILL-O2-NEXT: csrr a0, vlenb
34 ; SPILL-O2-NEXT: slli a0, a0, 4
35 ; SPILL-O2-NEXT: sub sp, sp, a0
36 ; SPILL-O2-NEXT: csrr a0, vlenb
37 ; SPILL-O2-NEXT: slli a1, a0, 4
38 ; SPILL-O2-NEXT: sub a0, a1, a0
39 ; SPILL-O2-NEXT: add a0, sp, a0
40 ; SPILL-O2-NEXT: addi a0, a0, 16
41 ; SPILL-O2-NEXT: vs1r.v v1, (a0) # Unknown-size Folded Spill
42 ; SPILL-O2-NEXT: csrr a0, vlenb
43 ; SPILL-O2-NEXT: li a1, 13
44 ; SPILL-O2-NEXT: mul a0, a0, a1
45 ; SPILL-O2-NEXT: add a0, sp, a0
46 ; SPILL-O2-NEXT: addi a0, a0, 16
47 ; SPILL-O2-NEXT: vs2r.v v2, (a0) # Unknown-size Folded Spill
48 ; SPILL-O2-NEXT: csrr a0, vlenb
49 ; SPILL-O2-NEXT: slli a1, a0, 3
50 ; SPILL-O2-NEXT: add a0, a1, a0
51 ; SPILL-O2-NEXT: add a0, sp, a0
52 ; SPILL-O2-NEXT: addi a0, a0, 16
53 ; SPILL-O2-NEXT: vs4r.v v4, (a0) # Unknown-size Folded Spill
54 ; SPILL-O2-NEXT: csrr a0, vlenb
55 ; SPILL-O2-NEXT: add a0, sp, a0
56 ; SPILL-O2-NEXT: addi a0, a0, 16
57 ; SPILL-O2-NEXT: vs8r.v v24, (a0) # Unknown-size Folded Spill
58 ; SPILL-O2-NEXT: addi a0, sp, 16
59 ; SPILL-O2-NEXT: vs1r.v v8, (a0) # Unknown-size Folded Spill
61 ; SPILL-O2-NEXT: #NO_APP
62 ; SPILL-O2-NEXT: vl1r.v v8, (a0) # Unknown-size Folded Reload
63 ; SPILL-O2-NEXT: csrr a0, vlenb
64 ; SPILL-O2-NEXT: slli a1, a0, 4
65 ; SPILL-O2-NEXT: sub a0, a1, a0
66 ; SPILL-O2-NEXT: add a0, sp, a0
67 ; SPILL-O2-NEXT: addi a0, a0, 16
68 ; SPILL-O2-NEXT: vl1r.v v1, (a0) # Unknown-size Folded Reload
69 ; SPILL-O2-NEXT: csrr a0, vlenb
70 ; SPILL-O2-NEXT: li a1, 13
71 ; SPILL-O2-NEXT: mul a0, a0, a1
72 ; SPILL-O2-NEXT: add a0, sp, a0
73 ; SPILL-O2-NEXT: addi a0, a0, 16
74 ; SPILL-O2-NEXT: vl2r.v v2, (a0) # Unknown-size Folded Reload
75 ; SPILL-O2-NEXT: csrr a0, vlenb
76 ; SPILL-O2-NEXT: slli a1, a0, 3
77 ; SPILL-O2-NEXT: add a0, a1, a0
78 ; SPILL-O2-NEXT: add a0, sp, a0
79 ; SPILL-O2-NEXT: addi a0, a0, 16
80 ; SPILL-O2-NEXT: vl4r.v v4, (a0) # Unknown-size Folded Reload
81 ; SPILL-O2-NEXT: csrr a0, vlenb
82 ; SPILL-O2-NEXT: add a0, sp, a0
83 ; SPILL-O2-NEXT: addi a0, a0, 16
84 ; SPILL-O2-NEXT: vl8r.v v24, (a0) # Unknown-size Folded Reload
85 ; SPILL-O2-NEXT: csrr a0, vlenb
86 ; SPILL-O2-NEXT: slli a0, a0, 4
87 ; SPILL-O2-NEXT: add sp, sp, a0
88 ; SPILL-O2-NEXT: addi sp, sp, 16
91 call void asm sideeffect "",
92 "~{v0},~{v1},~{v2},~{v3},~{v4},~{v5},~{v6},~{v7},~{v8},~{v9},~{v10},~{v11},~{v12},~{v13},~{v14},~{v15},~{v16},~{v17},~{v18},~{v19},~{v20},~{v21},~{v22},~{v23},~{v24},~{v25},~{v26},~{v27},~{v28},~{v29},~{v30},~{v31}"()
94 ret <vscale x 1 x i32> %va
97 ; Make sure the local stack allocation pass doesn't count vector registers. The
98 ; sizes are chosen to be on the edge of what RISCVRegister::needsFrameBaseReg
99 ; considers to need a virtual base register.
100 define riscv_vector_cc void @local_stack_allocation_frame_pointer() "frame-pointer"="all" {
101 ; SPILL-O2-LABEL: local_stack_allocation_frame_pointer:
103 ; SPILL-O2-NEXT: addi sp, sp, -2032
104 ; SPILL-O2-NEXT: .cfi_def_cfa_offset 2032
105 ; SPILL-O2-NEXT: sw ra, 2028(sp) # 4-byte Folded Spill
106 ; SPILL-O2-NEXT: sw s0, 2024(sp) # 4-byte Folded Spill
107 ; SPILL-O2-NEXT: .cfi_offset ra, -4
108 ; SPILL-O2-NEXT: .cfi_offset s0, -8
109 ; SPILL-O2-NEXT: addi s0, sp, 2032
110 ; SPILL-O2-NEXT: .cfi_def_cfa s0, 0
111 ; SPILL-O2-NEXT: addi sp, sp, -480
112 ; SPILL-O2-NEXT: lbu a0, -1912(s0)
113 ; SPILL-O2-NEXT: sb a0, -1912(s0)
114 ; SPILL-O2-NEXT: addi sp, s0, -2048
115 ; SPILL-O2-NEXT: addi sp, sp, -464
116 ; SPILL-O2-NEXT: addi sp, sp, 480
117 ; SPILL-O2-NEXT: lw ra, 2028(sp) # 4-byte Folded Reload
118 ; SPILL-O2-NEXT: lw s0, 2024(sp) # 4-byte Folded Reload
119 ; SPILL-O2-NEXT: addi sp, sp, 2032
121 %va = alloca [2500 x i8], align 4
122 %va_gep = getelementptr [2000 x i8], ptr %va, i64 0, i64 600
123 %load = load volatile i8, ptr %va_gep, align 4
124 store volatile i8 %load, ptr %va_gep, align 4