xref: /llvm-project/llvm/test/CodeGen/RISCV/stack-offset.ll (revision 97982a8c605fac7c86d02e641a6cd7898b3ca343)
1da675b92SPhilip Reames; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2da675b92SPhilip Reames; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s \
3da675b92SPhilip Reames; RUN:   | FileCheck %s -check-prefixes=RV32,RV32I
4da675b92SPhilip Reames; RUN: llc -mtriple=riscv32 -verify-machineinstrs -mattr=+zba < %s \
5da675b92SPhilip Reames; RUN:   | FileCheck %s -check-prefixes=RV32,RV32ZBA
6da675b92SPhilip Reames; RUN: llc -mtriple=riscv64 -verify-machineinstrs < %s \
7da675b92SPhilip Reames; RUN:   | FileCheck %s -check-prefixes=RV64,RV64I
8da675b92SPhilip Reames; RUN: llc -mtriple=riscv64 -verify-machineinstrs -mattr=+zba < %s \
9da675b92SPhilip Reames; RUN:   | FileCheck %s -check-prefixes=RV64,RV64ZBA
10da675b92SPhilip Reames
11da675b92SPhilip Reamesdeclare void @inspect(...)
12da675b92SPhilip Reames
13da675b92SPhilip Reamesdefine void @test() {
14eb26edbbSPhilip Reames; RV32I-LABEL: test:
15eb26edbbSPhilip Reames; RV32I:       # %bb.0:
16eb26edbbSPhilip Reames; RV32I-NEXT:    addi sp, sp, -2032
17eb26edbbSPhilip Reames; RV32I-NEXT:    .cfi_def_cfa_offset 2032
18eb26edbbSPhilip Reames; RV32I-NEXT:    sw ra, 2028(sp) # 4-byte Folded Spill
19eb26edbbSPhilip Reames; RV32I-NEXT:    .cfi_offset ra, -4
20eb26edbbSPhilip Reames; RV32I-NEXT:    addi sp, sp, -2048
21eb26edbbSPhilip Reames; RV32I-NEXT:    addi sp, sp, -1120
22eb26edbbSPhilip Reames; RV32I-NEXT:    .cfi_def_cfa_offset 5200
23eb26edbbSPhilip Reames; RV32I-NEXT:    addi a0, sp, 12
24eb26edbbSPhilip Reames; RV32I-NEXT:    addi a1, sp, 2047
25eb26edbbSPhilip Reames; RV32I-NEXT:    addi a1, a1, 13
26eb26edbbSPhilip Reames; RV32I-NEXT:    lui a2, 1
27eb26edbbSPhilip Reames; RV32I-NEXT:    addi a2, a2, 12
28eb26edbbSPhilip Reames; RV32I-NEXT:    add a2, sp, a2
29eb26edbbSPhilip Reames; RV32I-NEXT:    lui a3, 1
30eb26edbbSPhilip Reames; RV32I-NEXT:    addi a3, a3, 1036
31eb26edbbSPhilip Reames; RV32I-NEXT:    add a3, sp, a3
32eb26edbbSPhilip Reames; RV32I-NEXT:    call inspect
33eb26edbbSPhilip Reames; RV32I-NEXT:    addi sp, sp, 2032
34eb26edbbSPhilip Reames; RV32I-NEXT:    addi sp, sp, 1136
35*97982a8cSdlav-sc; RV32I-NEXT:    .cfi_def_cfa_offset 2032
36eb26edbbSPhilip Reames; RV32I-NEXT:    lw ra, 2028(sp) # 4-byte Folded Reload
37*97982a8cSdlav-sc; RV32I-NEXT:    .cfi_restore ra
38eb26edbbSPhilip Reames; RV32I-NEXT:    addi sp, sp, 2032
39*97982a8cSdlav-sc; RV32I-NEXT:    .cfi_def_cfa_offset 0
40eb26edbbSPhilip Reames; RV32I-NEXT:    ret
41da675b92SPhilip Reames;
42eb26edbbSPhilip Reames; RV32ZBA-LABEL: test:
43eb26edbbSPhilip Reames; RV32ZBA:       # %bb.0:
44eb26edbbSPhilip Reames; RV32ZBA-NEXT:    addi sp, sp, -2032
45eb26edbbSPhilip Reames; RV32ZBA-NEXT:    .cfi_def_cfa_offset 2032
46eb26edbbSPhilip Reames; RV32ZBA-NEXT:    sw ra, 2028(sp) # 4-byte Folded Spill
47eb26edbbSPhilip Reames; RV32ZBA-NEXT:    .cfi_offset ra, -4
48eb26edbbSPhilip Reames; RV32ZBA-NEXT:    addi sp, sp, -2048
49eb26edbbSPhilip Reames; RV32ZBA-NEXT:    addi sp, sp, -1120
50eb26edbbSPhilip Reames; RV32ZBA-NEXT:    .cfi_def_cfa_offset 5200
51eb26edbbSPhilip Reames; RV32ZBA-NEXT:    addi a0, sp, 12
52eb26edbbSPhilip Reames; RV32ZBA-NEXT:    addi a1, sp, 2047
53eb26edbbSPhilip Reames; RV32ZBA-NEXT:    addi a1, a1, 13
54eb26edbbSPhilip Reames; RV32ZBA-NEXT:    li a2, 1027
55eb26edbbSPhilip Reames; RV32ZBA-NEXT:    sh2add a2, a2, sp
56eb26edbbSPhilip Reames; RV32ZBA-NEXT:    li a3, 1283
57eb26edbbSPhilip Reames; RV32ZBA-NEXT:    sh2add a3, a3, sp
58eb26edbbSPhilip Reames; RV32ZBA-NEXT:    call inspect
59eb26edbbSPhilip Reames; RV32ZBA-NEXT:    addi sp, sp, 2032
60eb26edbbSPhilip Reames; RV32ZBA-NEXT:    addi sp, sp, 1136
61*97982a8cSdlav-sc; RV32ZBA-NEXT:    .cfi_def_cfa_offset 2032
62eb26edbbSPhilip Reames; RV32ZBA-NEXT:    lw ra, 2028(sp) # 4-byte Folded Reload
63*97982a8cSdlav-sc; RV32ZBA-NEXT:    .cfi_restore ra
64eb26edbbSPhilip Reames; RV32ZBA-NEXT:    addi sp, sp, 2032
65*97982a8cSdlav-sc; RV32ZBA-NEXT:    .cfi_def_cfa_offset 0
66eb26edbbSPhilip Reames; RV32ZBA-NEXT:    ret
67eb26edbbSPhilip Reames;
68eb26edbbSPhilip Reames; RV64I-LABEL: test:
69eb26edbbSPhilip Reames; RV64I:       # %bb.0:
70eb26edbbSPhilip Reames; RV64I-NEXT:    addi sp, sp, -2032
71eb26edbbSPhilip Reames; RV64I-NEXT:    .cfi_def_cfa_offset 2032
72eb26edbbSPhilip Reames; RV64I-NEXT:    sd ra, 2024(sp) # 8-byte Folded Spill
73eb26edbbSPhilip Reames; RV64I-NEXT:    .cfi_offset ra, -8
74eb26edbbSPhilip Reames; RV64I-NEXT:    addi sp, sp, -2048
75eb26edbbSPhilip Reames; RV64I-NEXT:    addi sp, sp, -1120
76eb26edbbSPhilip Reames; RV64I-NEXT:    .cfi_def_cfa_offset 5200
77eb26edbbSPhilip Reames; RV64I-NEXT:    addi a0, sp, 8
78eb26edbbSPhilip Reames; RV64I-NEXT:    addi a1, sp, 2047
79eb26edbbSPhilip Reames; RV64I-NEXT:    addi a1, a1, 9
80eb26edbbSPhilip Reames; RV64I-NEXT:    lui a2, 1
81eb26edbbSPhilip Reames; RV64I-NEXT:    addiw a2, a2, 8
82eb26edbbSPhilip Reames; RV64I-NEXT:    add a2, sp, a2
83eb26edbbSPhilip Reames; RV64I-NEXT:    lui a3, 1
84eb26edbbSPhilip Reames; RV64I-NEXT:    addiw a3, a3, 1032
85eb26edbbSPhilip Reames; RV64I-NEXT:    add a3, sp, a3
86eb26edbbSPhilip Reames; RV64I-NEXT:    call inspect
87eb26edbbSPhilip Reames; RV64I-NEXT:    addi sp, sp, 2032
88eb26edbbSPhilip Reames; RV64I-NEXT:    addi sp, sp, 1136
89*97982a8cSdlav-sc; RV64I-NEXT:    .cfi_def_cfa_offset 2032
90eb26edbbSPhilip Reames; RV64I-NEXT:    ld ra, 2024(sp) # 8-byte Folded Reload
91*97982a8cSdlav-sc; RV64I-NEXT:    .cfi_restore ra
92eb26edbbSPhilip Reames; RV64I-NEXT:    addi sp, sp, 2032
93*97982a8cSdlav-sc; RV64I-NEXT:    .cfi_def_cfa_offset 0
94eb26edbbSPhilip Reames; RV64I-NEXT:    ret
95eb26edbbSPhilip Reames;
96eb26edbbSPhilip Reames; RV64ZBA-LABEL: test:
97eb26edbbSPhilip Reames; RV64ZBA:       # %bb.0:
98eb26edbbSPhilip Reames; RV64ZBA-NEXT:    addi sp, sp, -2032
99eb26edbbSPhilip Reames; RV64ZBA-NEXT:    .cfi_def_cfa_offset 2032
100eb26edbbSPhilip Reames; RV64ZBA-NEXT:    sd ra, 2024(sp) # 8-byte Folded Spill
101eb26edbbSPhilip Reames; RV64ZBA-NEXT:    .cfi_offset ra, -8
102eb26edbbSPhilip Reames; RV64ZBA-NEXT:    addi sp, sp, -2048
103eb26edbbSPhilip Reames; RV64ZBA-NEXT:    addi sp, sp, -1120
104eb26edbbSPhilip Reames; RV64ZBA-NEXT:    .cfi_def_cfa_offset 5200
105eb26edbbSPhilip Reames; RV64ZBA-NEXT:    addi a0, sp, 8
106eb26edbbSPhilip Reames; RV64ZBA-NEXT:    addi a1, sp, 2047
107eb26edbbSPhilip Reames; RV64ZBA-NEXT:    addi a1, a1, 9
108eb26edbbSPhilip Reames; RV64ZBA-NEXT:    li a2, 513
109eb26edbbSPhilip Reames; RV64ZBA-NEXT:    sh3add a2, a2, sp
110eb26edbbSPhilip Reames; RV64ZBA-NEXT:    li a3, 641
111eb26edbbSPhilip Reames; RV64ZBA-NEXT:    sh3add a3, a3, sp
112eb26edbbSPhilip Reames; RV64ZBA-NEXT:    call inspect
113eb26edbbSPhilip Reames; RV64ZBA-NEXT:    addi sp, sp, 2032
114eb26edbbSPhilip Reames; RV64ZBA-NEXT:    addi sp, sp, 1136
115*97982a8cSdlav-sc; RV64ZBA-NEXT:    .cfi_def_cfa_offset 2032
116eb26edbbSPhilip Reames; RV64ZBA-NEXT:    ld ra, 2024(sp) # 8-byte Folded Reload
117*97982a8cSdlav-sc; RV64ZBA-NEXT:    .cfi_restore ra
118eb26edbbSPhilip Reames; RV64ZBA-NEXT:    addi sp, sp, 2032
119*97982a8cSdlav-sc; RV64ZBA-NEXT:    .cfi_def_cfa_offset 0
120eb26edbbSPhilip Reames; RV64ZBA-NEXT:    ret
121da675b92SPhilip Reames  %p4 = alloca [64 x i8], align 1
122da675b92SPhilip Reames  %p3 = alloca [1024 x i8], align 1
123da675b92SPhilip Reames  %p2 = alloca [2048 x i8], align 1
124da675b92SPhilip Reames  %p1 = alloca [2048 x i8], align 1
125da675b92SPhilip Reames  call void (...) @inspect(ptr %p1, ptr %p2, ptr %p3, ptr %p4)
126da675b92SPhilip Reames  ret void
127da675b92SPhilip Reames}
128da675b92SPhilip Reames
129da675b92SPhilip Reamesdefine void @align_8() {
130eb26edbbSPhilip Reames; RV32I-LABEL: align_8:
131eb26edbbSPhilip Reames; RV32I:       # %bb.0:
132eb26edbbSPhilip Reames; RV32I-NEXT:    addi sp, sp, -2032
133eb26edbbSPhilip Reames; RV32I-NEXT:    .cfi_def_cfa_offset 2032
134eb26edbbSPhilip Reames; RV32I-NEXT:    sw ra, 2028(sp) # 4-byte Folded Spill
135eb26edbbSPhilip Reames; RV32I-NEXT:    .cfi_offset ra, -4
136eb26edbbSPhilip Reames; RV32I-NEXT:    addi sp, sp, -2048
137eb26edbbSPhilip Reames; RV32I-NEXT:    addi sp, sp, -32
138eb26edbbSPhilip Reames; RV32I-NEXT:    .cfi_def_cfa_offset 4112
139eb26edbbSPhilip Reames; RV32I-NEXT:    addi a0, sp, 7
140eb26edbbSPhilip Reames; RV32I-NEXT:    lui a1, 1
141eb26edbbSPhilip Reames; RV32I-NEXT:    addi a1, a1, 8
142eb26edbbSPhilip Reames; RV32I-NEXT:    add a1, sp, a1
143eb26edbbSPhilip Reames; RV32I-NEXT:    call inspect
144eb26edbbSPhilip Reames; RV32I-NEXT:    addi sp, sp, 2032
145eb26edbbSPhilip Reames; RV32I-NEXT:    addi sp, sp, 48
146*97982a8cSdlav-sc; RV32I-NEXT:    .cfi_def_cfa_offset 2032
147eb26edbbSPhilip Reames; RV32I-NEXT:    lw ra, 2028(sp) # 4-byte Folded Reload
148*97982a8cSdlav-sc; RV32I-NEXT:    .cfi_restore ra
149eb26edbbSPhilip Reames; RV32I-NEXT:    addi sp, sp, 2032
150*97982a8cSdlav-sc; RV32I-NEXT:    .cfi_def_cfa_offset 0
151eb26edbbSPhilip Reames; RV32I-NEXT:    ret
152da675b92SPhilip Reames;
153eb26edbbSPhilip Reames; RV32ZBA-LABEL: align_8:
154eb26edbbSPhilip Reames; RV32ZBA:       # %bb.0:
155eb26edbbSPhilip Reames; RV32ZBA-NEXT:    addi sp, sp, -2032
156eb26edbbSPhilip Reames; RV32ZBA-NEXT:    .cfi_def_cfa_offset 2032
157eb26edbbSPhilip Reames; RV32ZBA-NEXT:    sw ra, 2028(sp) # 4-byte Folded Spill
158eb26edbbSPhilip Reames; RV32ZBA-NEXT:    .cfi_offset ra, -4
159eb26edbbSPhilip Reames; RV32ZBA-NEXT:    addi sp, sp, -2048
160eb26edbbSPhilip Reames; RV32ZBA-NEXT:    addi sp, sp, -32
161eb26edbbSPhilip Reames; RV32ZBA-NEXT:    .cfi_def_cfa_offset 4112
162eb26edbbSPhilip Reames; RV32ZBA-NEXT:    addi a0, sp, 7
163eb26edbbSPhilip Reames; RV32ZBA-NEXT:    li a1, 513
164eb26edbbSPhilip Reames; RV32ZBA-NEXT:    sh3add a1, a1, sp
165eb26edbbSPhilip Reames; RV32ZBA-NEXT:    call inspect
166eb26edbbSPhilip Reames; RV32ZBA-NEXT:    addi sp, sp, 2032
167eb26edbbSPhilip Reames; RV32ZBA-NEXT:    addi sp, sp, 48
168*97982a8cSdlav-sc; RV32ZBA-NEXT:    .cfi_def_cfa_offset 2032
169eb26edbbSPhilip Reames; RV32ZBA-NEXT:    lw ra, 2028(sp) # 4-byte Folded Reload
170*97982a8cSdlav-sc; RV32ZBA-NEXT:    .cfi_restore ra
171eb26edbbSPhilip Reames; RV32ZBA-NEXT:    addi sp, sp, 2032
172*97982a8cSdlav-sc; RV32ZBA-NEXT:    .cfi_def_cfa_offset 0
173eb26edbbSPhilip Reames; RV32ZBA-NEXT:    ret
174eb26edbbSPhilip Reames;
175eb26edbbSPhilip Reames; RV64I-LABEL: align_8:
176eb26edbbSPhilip Reames; RV64I:       # %bb.0:
177eb26edbbSPhilip Reames; RV64I-NEXT:    addi sp, sp, -2032
178eb26edbbSPhilip Reames; RV64I-NEXT:    .cfi_def_cfa_offset 2032
179eb26edbbSPhilip Reames; RV64I-NEXT:    sd ra, 2024(sp) # 8-byte Folded Spill
180eb26edbbSPhilip Reames; RV64I-NEXT:    .cfi_offset ra, -8
181eb26edbbSPhilip Reames; RV64I-NEXT:    addi sp, sp, -2048
182eb26edbbSPhilip Reames; RV64I-NEXT:    addi sp, sp, -48
183eb26edbbSPhilip Reames; RV64I-NEXT:    .cfi_def_cfa_offset 4128
184eb26edbbSPhilip Reames; RV64I-NEXT:    addi a0, sp, 15
185eb26edbbSPhilip Reames; RV64I-NEXT:    lui a1, 1
186eb26edbbSPhilip Reames; RV64I-NEXT:    addiw a1, a1, 16
187eb26edbbSPhilip Reames; RV64I-NEXT:    add a1, sp, a1
188eb26edbbSPhilip Reames; RV64I-NEXT:    call inspect
189eb26edbbSPhilip Reames; RV64I-NEXT:    addi sp, sp, 2032
190eb26edbbSPhilip Reames; RV64I-NEXT:    addi sp, sp, 64
191*97982a8cSdlav-sc; RV64I-NEXT:    .cfi_def_cfa_offset 2032
192eb26edbbSPhilip Reames; RV64I-NEXT:    ld ra, 2024(sp) # 8-byte Folded Reload
193*97982a8cSdlav-sc; RV64I-NEXT:    .cfi_restore ra
194eb26edbbSPhilip Reames; RV64I-NEXT:    addi sp, sp, 2032
195*97982a8cSdlav-sc; RV64I-NEXT:    .cfi_def_cfa_offset 0
196eb26edbbSPhilip Reames; RV64I-NEXT:    ret
197eb26edbbSPhilip Reames;
198eb26edbbSPhilip Reames; RV64ZBA-LABEL: align_8:
199eb26edbbSPhilip Reames; RV64ZBA:       # %bb.0:
200eb26edbbSPhilip Reames; RV64ZBA-NEXT:    addi sp, sp, -2032
201eb26edbbSPhilip Reames; RV64ZBA-NEXT:    .cfi_def_cfa_offset 2032
202eb26edbbSPhilip Reames; RV64ZBA-NEXT:    sd ra, 2024(sp) # 8-byte Folded Spill
203eb26edbbSPhilip Reames; RV64ZBA-NEXT:    .cfi_offset ra, -8
204eb26edbbSPhilip Reames; RV64ZBA-NEXT:    addi sp, sp, -2048
205eb26edbbSPhilip Reames; RV64ZBA-NEXT:    addi sp, sp, -48
206eb26edbbSPhilip Reames; RV64ZBA-NEXT:    .cfi_def_cfa_offset 4128
207eb26edbbSPhilip Reames; RV64ZBA-NEXT:    addi a0, sp, 15
208eb26edbbSPhilip Reames; RV64ZBA-NEXT:    li a1, 514
209eb26edbbSPhilip Reames; RV64ZBA-NEXT:    sh3add a1, a1, sp
210eb26edbbSPhilip Reames; RV64ZBA-NEXT:    call inspect
211eb26edbbSPhilip Reames; RV64ZBA-NEXT:    addi sp, sp, 2032
212eb26edbbSPhilip Reames; RV64ZBA-NEXT:    addi sp, sp, 64
213*97982a8cSdlav-sc; RV64ZBA-NEXT:    .cfi_def_cfa_offset 2032
214eb26edbbSPhilip Reames; RV64ZBA-NEXT:    ld ra, 2024(sp) # 8-byte Folded Reload
215*97982a8cSdlav-sc; RV64ZBA-NEXT:    .cfi_restore ra
216eb26edbbSPhilip Reames; RV64ZBA-NEXT:    addi sp, sp, 2032
217*97982a8cSdlav-sc; RV64ZBA-NEXT:    .cfi_def_cfa_offset 0
218eb26edbbSPhilip Reames; RV64ZBA-NEXT:    ret
219da675b92SPhilip Reames  %p2 = alloca i8, align 8
220da675b92SPhilip Reames  %p1 = alloca [4097 x i8], align 1
221da675b92SPhilip Reames  call void (...) @inspect(ptr %p1, ptr %p2)
222da675b92SPhilip Reames  ret void
223da675b92SPhilip Reames}
224da675b92SPhilip Reames
225da675b92SPhilip Reamesdefine void @align_4() {
226eb26edbbSPhilip Reames; RV32I-LABEL: align_4:
227eb26edbbSPhilip Reames; RV32I:       # %bb.0:
228eb26edbbSPhilip Reames; RV32I-NEXT:    addi sp, sp, -2032
229eb26edbbSPhilip Reames; RV32I-NEXT:    .cfi_def_cfa_offset 2032
230eb26edbbSPhilip Reames; RV32I-NEXT:    sw ra, 2028(sp) # 4-byte Folded Spill
231eb26edbbSPhilip Reames; RV32I-NEXT:    .cfi_offset ra, -4
232eb26edbbSPhilip Reames; RV32I-NEXT:    addi sp, sp, -2048
233eb26edbbSPhilip Reames; RV32I-NEXT:    addi sp, sp, -32
234eb26edbbSPhilip Reames; RV32I-NEXT:    .cfi_def_cfa_offset 4112
235eb26edbbSPhilip Reames; RV32I-NEXT:    addi a0, sp, 7
236eb26edbbSPhilip Reames; RV32I-NEXT:    lui a1, 1
237eb26edbbSPhilip Reames; RV32I-NEXT:    addi a1, a1, 8
238eb26edbbSPhilip Reames; RV32I-NEXT:    add a1, sp, a1
239eb26edbbSPhilip Reames; RV32I-NEXT:    call inspect
240eb26edbbSPhilip Reames; RV32I-NEXT:    addi sp, sp, 2032
241eb26edbbSPhilip Reames; RV32I-NEXT:    addi sp, sp, 48
242*97982a8cSdlav-sc; RV32I-NEXT:    .cfi_def_cfa_offset 2032
243eb26edbbSPhilip Reames; RV32I-NEXT:    lw ra, 2028(sp) # 4-byte Folded Reload
244*97982a8cSdlav-sc; RV32I-NEXT:    .cfi_restore ra
245eb26edbbSPhilip Reames; RV32I-NEXT:    addi sp, sp, 2032
246*97982a8cSdlav-sc; RV32I-NEXT:    .cfi_def_cfa_offset 0
247eb26edbbSPhilip Reames; RV32I-NEXT:    ret
248da675b92SPhilip Reames;
249eb26edbbSPhilip Reames; RV32ZBA-LABEL: align_4:
250eb26edbbSPhilip Reames; RV32ZBA:       # %bb.0:
251eb26edbbSPhilip Reames; RV32ZBA-NEXT:    addi sp, sp, -2032
252eb26edbbSPhilip Reames; RV32ZBA-NEXT:    .cfi_def_cfa_offset 2032
253eb26edbbSPhilip Reames; RV32ZBA-NEXT:    sw ra, 2028(sp) # 4-byte Folded Spill
254eb26edbbSPhilip Reames; RV32ZBA-NEXT:    .cfi_offset ra, -4
255eb26edbbSPhilip Reames; RV32ZBA-NEXT:    addi sp, sp, -2048
256eb26edbbSPhilip Reames; RV32ZBA-NEXT:    addi sp, sp, -32
257eb26edbbSPhilip Reames; RV32ZBA-NEXT:    .cfi_def_cfa_offset 4112
258eb26edbbSPhilip Reames; RV32ZBA-NEXT:    addi a0, sp, 7
259eb26edbbSPhilip Reames; RV32ZBA-NEXT:    li a1, 513
260eb26edbbSPhilip Reames; RV32ZBA-NEXT:    sh3add a1, a1, sp
261eb26edbbSPhilip Reames; RV32ZBA-NEXT:    call inspect
262eb26edbbSPhilip Reames; RV32ZBA-NEXT:    addi sp, sp, 2032
263eb26edbbSPhilip Reames; RV32ZBA-NEXT:    addi sp, sp, 48
264*97982a8cSdlav-sc; RV32ZBA-NEXT:    .cfi_def_cfa_offset 2032
265eb26edbbSPhilip Reames; RV32ZBA-NEXT:    lw ra, 2028(sp) # 4-byte Folded Reload
266*97982a8cSdlav-sc; RV32ZBA-NEXT:    .cfi_restore ra
267eb26edbbSPhilip Reames; RV32ZBA-NEXT:    addi sp, sp, 2032
268*97982a8cSdlav-sc; RV32ZBA-NEXT:    .cfi_def_cfa_offset 0
269eb26edbbSPhilip Reames; RV32ZBA-NEXT:    ret
270eb26edbbSPhilip Reames;
271eb26edbbSPhilip Reames; RV64I-LABEL: align_4:
272eb26edbbSPhilip Reames; RV64I:       # %bb.0:
273eb26edbbSPhilip Reames; RV64I-NEXT:    addi sp, sp, -2032
274eb26edbbSPhilip Reames; RV64I-NEXT:    .cfi_def_cfa_offset 2032
275eb26edbbSPhilip Reames; RV64I-NEXT:    sd ra, 2024(sp) # 8-byte Folded Spill
276eb26edbbSPhilip Reames; RV64I-NEXT:    .cfi_offset ra, -8
277eb26edbbSPhilip Reames; RV64I-NEXT:    addi sp, sp, -2048
278eb26edbbSPhilip Reames; RV64I-NEXT:    addi sp, sp, -48
279eb26edbbSPhilip Reames; RV64I-NEXT:    .cfi_def_cfa_offset 4128
280eb26edbbSPhilip Reames; RV64I-NEXT:    addi a0, sp, 19
281eb26edbbSPhilip Reames; RV64I-NEXT:    lui a1, 1
282eb26edbbSPhilip Reames; RV64I-NEXT:    addiw a1, a1, 20
283eb26edbbSPhilip Reames; RV64I-NEXT:    add a1, sp, a1
284eb26edbbSPhilip Reames; RV64I-NEXT:    call inspect
285eb26edbbSPhilip Reames; RV64I-NEXT:    addi sp, sp, 2032
286eb26edbbSPhilip Reames; RV64I-NEXT:    addi sp, sp, 64
287*97982a8cSdlav-sc; RV64I-NEXT:    .cfi_def_cfa_offset 2032
288eb26edbbSPhilip Reames; RV64I-NEXT:    ld ra, 2024(sp) # 8-byte Folded Reload
289*97982a8cSdlav-sc; RV64I-NEXT:    .cfi_restore ra
290eb26edbbSPhilip Reames; RV64I-NEXT:    addi sp, sp, 2032
291*97982a8cSdlav-sc; RV64I-NEXT:    .cfi_def_cfa_offset 0
292eb26edbbSPhilip Reames; RV64I-NEXT:    ret
293eb26edbbSPhilip Reames;
294eb26edbbSPhilip Reames; RV64ZBA-LABEL: align_4:
295eb26edbbSPhilip Reames; RV64ZBA:       # %bb.0:
296eb26edbbSPhilip Reames; RV64ZBA-NEXT:    addi sp, sp, -2032
297eb26edbbSPhilip Reames; RV64ZBA-NEXT:    .cfi_def_cfa_offset 2032
298eb26edbbSPhilip Reames; RV64ZBA-NEXT:    sd ra, 2024(sp) # 8-byte Folded Spill
299eb26edbbSPhilip Reames; RV64ZBA-NEXT:    .cfi_offset ra, -8
300eb26edbbSPhilip Reames; RV64ZBA-NEXT:    addi sp, sp, -2048
301eb26edbbSPhilip Reames; RV64ZBA-NEXT:    addi sp, sp, -48
302eb26edbbSPhilip Reames; RV64ZBA-NEXT:    .cfi_def_cfa_offset 4128
303eb26edbbSPhilip Reames; RV64ZBA-NEXT:    addi a0, sp, 19
304eb26edbbSPhilip Reames; RV64ZBA-NEXT:    li a1, 1029
305eb26edbbSPhilip Reames; RV64ZBA-NEXT:    sh2add a1, a1, sp
306eb26edbbSPhilip Reames; RV64ZBA-NEXT:    call inspect
307eb26edbbSPhilip Reames; RV64ZBA-NEXT:    addi sp, sp, 2032
308eb26edbbSPhilip Reames; RV64ZBA-NEXT:    addi sp, sp, 64
309*97982a8cSdlav-sc; RV64ZBA-NEXT:    .cfi_def_cfa_offset 2032
310eb26edbbSPhilip Reames; RV64ZBA-NEXT:    ld ra, 2024(sp) # 8-byte Folded Reload
311*97982a8cSdlav-sc; RV64ZBA-NEXT:    .cfi_restore ra
312eb26edbbSPhilip Reames; RV64ZBA-NEXT:    addi sp, sp, 2032
313*97982a8cSdlav-sc; RV64ZBA-NEXT:    .cfi_def_cfa_offset 0
314eb26edbbSPhilip Reames; RV64ZBA-NEXT:    ret
315da675b92SPhilip Reames  %p2 = alloca i8, align 4
316da675b92SPhilip Reames  %p1 = alloca [4097 x i8], align 1
317da675b92SPhilip Reames  call void (...) @inspect(ptr %p1, ptr %p2)
318da675b92SPhilip Reames  ret void
319da675b92SPhilip Reames}
320da675b92SPhilip Reames
321da675b92SPhilip Reamesdefine void @align_2() {
322da675b92SPhilip Reames; RV32-LABEL: align_2:
323da675b92SPhilip Reames; RV32:       # %bb.0:
324da675b92SPhilip Reames; RV32-NEXT:    addi sp, sp, -2032
325da675b92SPhilip Reames; RV32-NEXT:    .cfi_def_cfa_offset 2032
326da675b92SPhilip Reames; RV32-NEXT:    sw ra, 2028(sp) # 4-byte Folded Spill
327da675b92SPhilip Reames; RV32-NEXT:    .cfi_offset ra, -4
328da675b92SPhilip Reames; RV32-NEXT:    addi sp, sp, -2048
329da675b92SPhilip Reames; RV32-NEXT:    addi sp, sp, -32
330da675b92SPhilip Reames; RV32-NEXT:    .cfi_def_cfa_offset 4112
331da675b92SPhilip Reames; RV32-NEXT:    addi a0, sp, 9
332da675b92SPhilip Reames; RV32-NEXT:    lui a1, 1
333da675b92SPhilip Reames; RV32-NEXT:    addi a1, a1, 10
334da675b92SPhilip Reames; RV32-NEXT:    add a1, sp, a1
335da675b92SPhilip Reames; RV32-NEXT:    call inspect
336da675b92SPhilip Reames; RV32-NEXT:    addi sp, sp, 2032
337da675b92SPhilip Reames; RV32-NEXT:    addi sp, sp, 48
338*97982a8cSdlav-sc; RV32-NEXT:    .cfi_def_cfa_offset 2032
339da675b92SPhilip Reames; RV32-NEXT:    lw ra, 2028(sp) # 4-byte Folded Reload
340*97982a8cSdlav-sc; RV32-NEXT:    .cfi_restore ra
341da675b92SPhilip Reames; RV32-NEXT:    addi sp, sp, 2032
342*97982a8cSdlav-sc; RV32-NEXT:    .cfi_def_cfa_offset 0
343da675b92SPhilip Reames; RV32-NEXT:    ret
344da675b92SPhilip Reames;
345da675b92SPhilip Reames; RV64-LABEL: align_2:
346da675b92SPhilip Reames; RV64:       # %bb.0:
347da675b92SPhilip Reames; RV64-NEXT:    addi sp, sp, -2032
348da675b92SPhilip Reames; RV64-NEXT:    .cfi_def_cfa_offset 2032
349da675b92SPhilip Reames; RV64-NEXT:    sd ra, 2024(sp) # 8-byte Folded Spill
350da675b92SPhilip Reames; RV64-NEXT:    .cfi_offset ra, -8
351da675b92SPhilip Reames; RV64-NEXT:    addi sp, sp, -2048
352da675b92SPhilip Reames; RV64-NEXT:    addi sp, sp, -48
353da675b92SPhilip Reames; RV64-NEXT:    .cfi_def_cfa_offset 4128
354da675b92SPhilip Reames; RV64-NEXT:    addi a0, sp, 21
355da675b92SPhilip Reames; RV64-NEXT:    lui a1, 1
356da675b92SPhilip Reames; RV64-NEXT:    addiw a1, a1, 22
357da675b92SPhilip Reames; RV64-NEXT:    add a1, sp, a1
358da675b92SPhilip Reames; RV64-NEXT:    call inspect
359da675b92SPhilip Reames; RV64-NEXT:    addi sp, sp, 2032
360da675b92SPhilip Reames; RV64-NEXT:    addi sp, sp, 64
361*97982a8cSdlav-sc; RV64-NEXT:    .cfi_def_cfa_offset 2032
362da675b92SPhilip Reames; RV64-NEXT:    ld ra, 2024(sp) # 8-byte Folded Reload
363*97982a8cSdlav-sc; RV64-NEXT:    .cfi_restore ra
364da675b92SPhilip Reames; RV64-NEXT:    addi sp, sp, 2032
365*97982a8cSdlav-sc; RV64-NEXT:    .cfi_def_cfa_offset 0
366da675b92SPhilip Reames; RV64-NEXT:    ret
367da675b92SPhilip Reames  %p2 = alloca i8, align 2
368da675b92SPhilip Reames  %p1 = alloca [4097 x i8], align 1
369da675b92SPhilip Reames  call void (...) @inspect(ptr %p1, ptr %p2)
370da675b92SPhilip Reames  ret void
371da675b92SPhilip Reames}
372da675b92SPhilip Reames
373da675b92SPhilip Reames
374da675b92SPhilip Reamesdefine void @align_1() {
375da675b92SPhilip Reames; RV32-LABEL: align_1:
376da675b92SPhilip Reames; RV32:       # %bb.0:
377da675b92SPhilip Reames; RV32-NEXT:    addi sp, sp, -2032
378da675b92SPhilip Reames; RV32-NEXT:    .cfi_def_cfa_offset 2032
379da675b92SPhilip Reames; RV32-NEXT:    sw ra, 2028(sp) # 4-byte Folded Spill
380da675b92SPhilip Reames; RV32-NEXT:    .cfi_offset ra, -4
381da675b92SPhilip Reames; RV32-NEXT:    addi sp, sp, -2048
382da675b92SPhilip Reames; RV32-NEXT:    addi sp, sp, -32
383da675b92SPhilip Reames; RV32-NEXT:    .cfi_def_cfa_offset 4112
384da675b92SPhilip Reames; RV32-NEXT:    addi a0, sp, 10
385da675b92SPhilip Reames; RV32-NEXT:    lui a1, 1
386da675b92SPhilip Reames; RV32-NEXT:    addi a1, a1, 11
387da675b92SPhilip Reames; RV32-NEXT:    add a1, sp, a1
388da675b92SPhilip Reames; RV32-NEXT:    call inspect
389da675b92SPhilip Reames; RV32-NEXT:    addi sp, sp, 2032
390da675b92SPhilip Reames; RV32-NEXT:    addi sp, sp, 48
391*97982a8cSdlav-sc; RV32-NEXT:    .cfi_def_cfa_offset 2032
392da675b92SPhilip Reames; RV32-NEXT:    lw ra, 2028(sp) # 4-byte Folded Reload
393*97982a8cSdlav-sc; RV32-NEXT:    .cfi_restore ra
394da675b92SPhilip Reames; RV32-NEXT:    addi sp, sp, 2032
395*97982a8cSdlav-sc; RV32-NEXT:    .cfi_def_cfa_offset 0
396da675b92SPhilip Reames; RV32-NEXT:    ret
397da675b92SPhilip Reames;
398da675b92SPhilip Reames; RV64-LABEL: align_1:
399da675b92SPhilip Reames; RV64:       # %bb.0:
400da675b92SPhilip Reames; RV64-NEXT:    addi sp, sp, -2032
401da675b92SPhilip Reames; RV64-NEXT:    .cfi_def_cfa_offset 2032
402da675b92SPhilip Reames; RV64-NEXT:    sd ra, 2024(sp) # 8-byte Folded Spill
403da675b92SPhilip Reames; RV64-NEXT:    .cfi_offset ra, -8
404da675b92SPhilip Reames; RV64-NEXT:    addi sp, sp, -2048
405da675b92SPhilip Reames; RV64-NEXT:    addi sp, sp, -48
406da675b92SPhilip Reames; RV64-NEXT:    .cfi_def_cfa_offset 4128
407da675b92SPhilip Reames; RV64-NEXT:    addi a0, sp, 22
408da675b92SPhilip Reames; RV64-NEXT:    lui a1, 1
409da675b92SPhilip Reames; RV64-NEXT:    addiw a1, a1, 23
410da675b92SPhilip Reames; RV64-NEXT:    add a1, sp, a1
411da675b92SPhilip Reames; RV64-NEXT:    call inspect
412da675b92SPhilip Reames; RV64-NEXT:    addi sp, sp, 2032
413da675b92SPhilip Reames; RV64-NEXT:    addi sp, sp, 64
414*97982a8cSdlav-sc; RV64-NEXT:    .cfi_def_cfa_offset 2032
415da675b92SPhilip Reames; RV64-NEXT:    ld ra, 2024(sp) # 8-byte Folded Reload
416*97982a8cSdlav-sc; RV64-NEXT:    .cfi_restore ra
417da675b92SPhilip Reames; RV64-NEXT:    addi sp, sp, 2032
418*97982a8cSdlav-sc; RV64-NEXT:    .cfi_def_cfa_offset 0
419da675b92SPhilip Reames; RV64-NEXT:    ret
420da675b92SPhilip Reames  %p2 = alloca i8, align 1
421da675b92SPhilip Reames  %p1 = alloca [4097 x i8], align 1
422da675b92SPhilip Reames  call void (...) @inspect(ptr %p1, ptr %p2)
423da675b92SPhilip Reames  ret void
424da675b92SPhilip Reames}
425