1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -target-abi ilp32e -verify-machineinstrs < %s \
3 ; RUN: | FileCheck -check-prefix=ILP32E-FPELIM %s
4 ; RUN: llc -mtriple=riscv32 -target-abi ilp32e -frame-pointer=all \
5 ; RUN: -verify-machineinstrs < %s \
6 ; RUN: | FileCheck -check-prefix=ILP32E-WITHFP %s
7 ; RUN: llc -mtriple=riscv32 -target-abi ilp32e -mattr=+save-restore -verify-machineinstrs < %s \
8 ; RUN: | FileCheck -check-prefix=ILP32E-FPELIM-SAVE-RESTORE %s
9 ; RUN: llc -mtriple=riscv32 -target-abi ilp32e -mattr=+save-restore -frame-pointer=all \
10 ; RUN: -verify-machineinstrs < %s \
11 ; RUN: | FileCheck -check-prefix=ILP32E-WITHFP-SAVE-RESTORE %s
13 ; This file contains tests that will have differing output for the ilp32e ABIs.
15 define i32 @callee_float_in_regs(i32 %a, float %b) {
16 ; ILP32E-FPELIM-LABEL: callee_float_in_regs:
17 ; ILP32E-FPELIM: # %bb.0:
18 ; ILP32E-FPELIM-NEXT: addi sp, sp, -8
19 ; ILP32E-FPELIM-NEXT: .cfi_def_cfa_offset 8
20 ; ILP32E-FPELIM-NEXT: sw ra, 4(sp) # 4-byte Folded Spill
21 ; ILP32E-FPELIM-NEXT: sw s0, 0(sp) # 4-byte Folded Spill
22 ; ILP32E-FPELIM-NEXT: .cfi_offset ra, -4
23 ; ILP32E-FPELIM-NEXT: .cfi_offset s0, -8
24 ; ILP32E-FPELIM-NEXT: mv s0, a0
25 ; ILP32E-FPELIM-NEXT: mv a0, a1
26 ; ILP32E-FPELIM-NEXT: call __fixsfsi
27 ; ILP32E-FPELIM-NEXT: add a0, s0, a0
28 ; ILP32E-FPELIM-NEXT: lw ra, 4(sp) # 4-byte Folded Reload
29 ; ILP32E-FPELIM-NEXT: lw s0, 0(sp) # 4-byte Folded Reload
30 ; ILP32E-FPELIM-NEXT: .cfi_restore ra
31 ; ILP32E-FPELIM-NEXT: .cfi_restore s0
32 ; ILP32E-FPELIM-NEXT: addi sp, sp, 8
33 ; ILP32E-FPELIM-NEXT: .cfi_def_cfa_offset 0
34 ; ILP32E-FPELIM-NEXT: ret
36 ; ILP32E-WITHFP-LABEL: callee_float_in_regs:
37 ; ILP32E-WITHFP: # %bb.0:
38 ; ILP32E-WITHFP-NEXT: addi sp, sp, -12
39 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 12
40 ; ILP32E-WITHFP-NEXT: sw ra, 8(sp) # 4-byte Folded Spill
41 ; ILP32E-WITHFP-NEXT: sw s0, 4(sp) # 4-byte Folded Spill
42 ; ILP32E-WITHFP-NEXT: sw s1, 0(sp) # 4-byte Folded Spill
43 ; ILP32E-WITHFP-NEXT: .cfi_offset ra, -4
44 ; ILP32E-WITHFP-NEXT: .cfi_offset s0, -8
45 ; ILP32E-WITHFP-NEXT: .cfi_offset s1, -12
46 ; ILP32E-WITHFP-NEXT: addi s0, sp, 12
47 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0
48 ; ILP32E-WITHFP-NEXT: mv s1, a0
49 ; ILP32E-WITHFP-NEXT: mv a0, a1
50 ; ILP32E-WITHFP-NEXT: call __fixsfsi
51 ; ILP32E-WITHFP-NEXT: add a0, s1, a0
52 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 12
53 ; ILP32E-WITHFP-NEXT: lw ra, 8(sp) # 4-byte Folded Reload
54 ; ILP32E-WITHFP-NEXT: lw s0, 4(sp) # 4-byte Folded Reload
55 ; ILP32E-WITHFP-NEXT: lw s1, 0(sp) # 4-byte Folded Reload
56 ; ILP32E-WITHFP-NEXT: .cfi_restore ra
57 ; ILP32E-WITHFP-NEXT: .cfi_restore s0
58 ; ILP32E-WITHFP-NEXT: .cfi_restore s1
59 ; ILP32E-WITHFP-NEXT: addi sp, sp, 12
60 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 0
61 ; ILP32E-WITHFP-NEXT: ret
63 ; ILP32E-FPELIM-SAVE-RESTORE-LABEL: callee_float_in_regs:
64 ; ILP32E-FPELIM-SAVE-RESTORE: # %bb.0:
65 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: call t0, __riscv_save_1
66 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
67 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_offset ra, -4
68 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_offset s0, -8
69 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: mv s0, a0
70 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: mv a0, a1
71 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: call __fixsfsi
72 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: add a0, s0, a0
73 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: tail __riscv_restore_1
75 ; ILP32E-WITHFP-SAVE-RESTORE-LABEL: callee_float_in_regs:
76 ; ILP32E-WITHFP-SAVE-RESTORE: # %bb.0:
77 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call t0, __riscv_save_2
78 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 12
79 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset ra, -4
80 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset s0, -8
81 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset s1, -12
82 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi s0, sp, 12
83 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa s0, 0
84 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: mv s1, a0
85 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: mv a0, a1
86 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call __fixsfsi
87 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: add a0, s1, a0
88 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 12
89 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_2
90 %b_fptosi = fptosi float %b to i32
91 %1 = add i32 %a, %b_fptosi
95 define i32 @caller_float_in_regs() {
96 ; ILP32E-FPELIM-LABEL: caller_float_in_regs:
97 ; ILP32E-FPELIM: # %bb.0:
98 ; ILP32E-FPELIM-NEXT: addi sp, sp, -4
99 ; ILP32E-FPELIM-NEXT: .cfi_def_cfa_offset 4
100 ; ILP32E-FPELIM-NEXT: sw ra, 0(sp) # 4-byte Folded Spill
101 ; ILP32E-FPELIM-NEXT: .cfi_offset ra, -4
102 ; ILP32E-FPELIM-NEXT: li a0, 1
103 ; ILP32E-FPELIM-NEXT: lui a1, 262144
104 ; ILP32E-FPELIM-NEXT: call callee_float_in_regs
105 ; ILP32E-FPELIM-NEXT: lw ra, 0(sp) # 4-byte Folded Reload
106 ; ILP32E-FPELIM-NEXT: .cfi_restore ra
107 ; ILP32E-FPELIM-NEXT: addi sp, sp, 4
108 ; ILP32E-FPELIM-NEXT: .cfi_def_cfa_offset 0
109 ; ILP32E-FPELIM-NEXT: ret
111 ; ILP32E-WITHFP-LABEL: caller_float_in_regs:
112 ; ILP32E-WITHFP: # %bb.0:
113 ; ILP32E-WITHFP-NEXT: addi sp, sp, -8
114 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 8
115 ; ILP32E-WITHFP-NEXT: sw ra, 4(sp) # 4-byte Folded Spill
116 ; ILP32E-WITHFP-NEXT: sw s0, 0(sp) # 4-byte Folded Spill
117 ; ILP32E-WITHFP-NEXT: .cfi_offset ra, -4
118 ; ILP32E-WITHFP-NEXT: .cfi_offset s0, -8
119 ; ILP32E-WITHFP-NEXT: addi s0, sp, 8
120 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0
121 ; ILP32E-WITHFP-NEXT: li a0, 1
122 ; ILP32E-WITHFP-NEXT: lui a1, 262144
123 ; ILP32E-WITHFP-NEXT: call callee_float_in_regs
124 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 8
125 ; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload
126 ; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload
127 ; ILP32E-WITHFP-NEXT: .cfi_restore ra
128 ; ILP32E-WITHFP-NEXT: .cfi_restore s0
129 ; ILP32E-WITHFP-NEXT: addi sp, sp, 8
130 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 0
131 ; ILP32E-WITHFP-NEXT: ret
133 ; ILP32E-FPELIM-SAVE-RESTORE-LABEL: caller_float_in_regs:
134 ; ILP32E-FPELIM-SAVE-RESTORE: # %bb.0:
135 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: call t0, __riscv_save_0
136 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 4
137 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_offset ra, -4
138 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li a0, 1
139 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: lui a1, 262144
140 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: call callee_float_in_regs
141 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: tail __riscv_restore_0
143 ; ILP32E-WITHFP-SAVE-RESTORE-LABEL: caller_float_in_regs:
144 ; ILP32E-WITHFP-SAVE-RESTORE: # %bb.0:
145 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call t0, __riscv_save_1
146 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
147 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset ra, -4
148 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset s0, -8
149 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi s0, sp, 8
150 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa s0, 0
151 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a0, 1
152 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lui a1, 262144
153 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call callee_float_in_regs
154 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 8
155 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1
156 %1 = call i32 @callee_float_in_regs(i32 1, float 2.0)
160 define i32 @callee_float_on_stack(i64 %a, i64 %b, i64 %c, i64 %d, float %e) {
161 ; ILP32E-FPELIM-LABEL: callee_float_on_stack:
162 ; ILP32E-FPELIM: # %bb.0:
163 ; ILP32E-FPELIM-NEXT: lw a0, 8(sp)
164 ; ILP32E-FPELIM-NEXT: lw a1, 0(sp)
165 ; ILP32E-FPELIM-NEXT: add a0, a1, a0
166 ; ILP32E-FPELIM-NEXT: ret
168 ; ILP32E-WITHFP-LABEL: callee_float_on_stack:
169 ; ILP32E-WITHFP: # %bb.0:
170 ; ILP32E-WITHFP-NEXT: addi sp, sp, -8
171 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 8
172 ; ILP32E-WITHFP-NEXT: sw ra, 4(sp) # 4-byte Folded Spill
173 ; ILP32E-WITHFP-NEXT: sw s0, 0(sp) # 4-byte Folded Spill
174 ; ILP32E-WITHFP-NEXT: .cfi_offset ra, -4
175 ; ILP32E-WITHFP-NEXT: .cfi_offset s0, -8
176 ; ILP32E-WITHFP-NEXT: addi s0, sp, 8
177 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0
178 ; ILP32E-WITHFP-NEXT: lw a0, 8(s0)
179 ; ILP32E-WITHFP-NEXT: lw a1, 0(s0)
180 ; ILP32E-WITHFP-NEXT: add a0, a1, a0
181 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 8
182 ; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload
183 ; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload
184 ; ILP32E-WITHFP-NEXT: .cfi_restore ra
185 ; ILP32E-WITHFP-NEXT: .cfi_restore s0
186 ; ILP32E-WITHFP-NEXT: addi sp, sp, 8
187 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 0
188 ; ILP32E-WITHFP-NEXT: ret
190 ; ILP32E-FPELIM-SAVE-RESTORE-LABEL: callee_float_on_stack:
191 ; ILP32E-FPELIM-SAVE-RESTORE: # %bb.0:
192 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: lw a0, 8(sp)
193 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: lw a1, 0(sp)
194 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: add a0, a1, a0
195 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: ret
197 ; ILP32E-WITHFP-SAVE-RESTORE-LABEL: callee_float_on_stack:
198 ; ILP32E-WITHFP-SAVE-RESTORE: # %bb.0:
199 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call t0, __riscv_save_1
200 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
201 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset ra, -4
202 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset s0, -8
203 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi s0, sp, 8
204 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa s0, 0
205 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lw a0, 8(s0)
206 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lw a1, 0(s0)
207 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: add a0, a1, a0
208 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 8
209 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1
210 %1 = trunc i64 %d to i32
211 %2 = bitcast float %e to i32
216 define i32 @caller_float_on_stack() {
217 ; ILP32E-FPELIM-LABEL: caller_float_on_stack:
218 ; ILP32E-FPELIM: # %bb.0:
219 ; ILP32E-FPELIM-NEXT: addi sp, sp, -16
220 ; ILP32E-FPELIM-NEXT: .cfi_def_cfa_offset 16
221 ; ILP32E-FPELIM-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
222 ; ILP32E-FPELIM-NEXT: .cfi_offset ra, -4
223 ; ILP32E-FPELIM-NEXT: lui a1, 264704
224 ; ILP32E-FPELIM-NEXT: li a3, 4
225 ; ILP32E-FPELIM-NEXT: li a0, 1
226 ; ILP32E-FPELIM-NEXT: li a2, 2
227 ; ILP32E-FPELIM-NEXT: li a4, 3
228 ; ILP32E-FPELIM-NEXT: sw a3, 0(sp)
229 ; ILP32E-FPELIM-NEXT: sw zero, 4(sp)
230 ; ILP32E-FPELIM-NEXT: sw a1, 8(sp)
231 ; ILP32E-FPELIM-NEXT: li a1, 0
232 ; ILP32E-FPELIM-NEXT: li a3, 0
233 ; ILP32E-FPELIM-NEXT: li a5, 0
234 ; ILP32E-FPELIM-NEXT: call callee_float_on_stack
235 ; ILP32E-FPELIM-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
236 ; ILP32E-FPELIM-NEXT: .cfi_restore ra
237 ; ILP32E-FPELIM-NEXT: addi sp, sp, 16
238 ; ILP32E-FPELIM-NEXT: .cfi_def_cfa_offset 0
239 ; ILP32E-FPELIM-NEXT: ret
241 ; ILP32E-WITHFP-LABEL: caller_float_on_stack:
242 ; ILP32E-WITHFP: # %bb.0:
243 ; ILP32E-WITHFP-NEXT: addi sp, sp, -20
244 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 20
245 ; ILP32E-WITHFP-NEXT: sw ra, 16(sp) # 4-byte Folded Spill
246 ; ILP32E-WITHFP-NEXT: sw s0, 12(sp) # 4-byte Folded Spill
247 ; ILP32E-WITHFP-NEXT: .cfi_offset ra, -4
248 ; ILP32E-WITHFP-NEXT: .cfi_offset s0, -8
249 ; ILP32E-WITHFP-NEXT: addi s0, sp, 20
250 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0
251 ; ILP32E-WITHFP-NEXT: lui a1, 264704
252 ; ILP32E-WITHFP-NEXT: li a3, 4
253 ; ILP32E-WITHFP-NEXT: li a0, 1
254 ; ILP32E-WITHFP-NEXT: li a2, 2
255 ; ILP32E-WITHFP-NEXT: li a4, 3
256 ; ILP32E-WITHFP-NEXT: sw a3, 0(sp)
257 ; ILP32E-WITHFP-NEXT: sw zero, 4(sp)
258 ; ILP32E-WITHFP-NEXT: sw a1, 8(sp)
259 ; ILP32E-WITHFP-NEXT: li a1, 0
260 ; ILP32E-WITHFP-NEXT: li a3, 0
261 ; ILP32E-WITHFP-NEXT: li a5, 0
262 ; ILP32E-WITHFP-NEXT: call callee_float_on_stack
263 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 20
264 ; ILP32E-WITHFP-NEXT: lw ra, 16(sp) # 4-byte Folded Reload
265 ; ILP32E-WITHFP-NEXT: lw s0, 12(sp) # 4-byte Folded Reload
266 ; ILP32E-WITHFP-NEXT: .cfi_restore ra
267 ; ILP32E-WITHFP-NEXT: .cfi_restore s0
268 ; ILP32E-WITHFP-NEXT: addi sp, sp, 20
269 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 0
270 ; ILP32E-WITHFP-NEXT: ret
272 ; ILP32E-FPELIM-SAVE-RESTORE-LABEL: caller_float_on_stack:
273 ; ILP32E-FPELIM-SAVE-RESTORE: # %bb.0:
274 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: call t0, __riscv_save_0
275 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 4
276 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_offset ra, -4
277 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: addi sp, sp, -12
278 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 16
279 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: lui a1, 264704
280 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li a3, 4
281 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li a0, 1
282 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li a2, 2
283 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li a4, 3
284 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw a3, 0(sp)
285 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw zero, 4(sp)
286 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw a1, 8(sp)
287 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li a1, 0
288 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li a3, 0
289 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li a5, 0
290 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: call callee_float_on_stack
291 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: addi sp, sp, 12
292 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 4
293 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: tail __riscv_restore_0
295 ; ILP32E-WITHFP-SAVE-RESTORE-LABEL: caller_float_on_stack:
296 ; ILP32E-WITHFP-SAVE-RESTORE: # %bb.0:
297 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call t0, __riscv_save_1
298 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
299 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset ra, -4
300 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset s0, -8
301 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi sp, sp, -12
302 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 20
303 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi s0, sp, 20
304 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa s0, 0
305 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lui a1, 264704
306 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a3, 4
307 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a0, 1
308 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a2, 2
309 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a4, 3
310 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw a3, 0(sp)
311 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw zero, 4(sp)
312 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw a1, 8(sp)
313 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a1, 0
314 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a3, 0
315 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a5, 0
316 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call callee_float_on_stack
317 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 20
318 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi sp, sp, 12
319 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
320 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1
321 %1 = call i32 @callee_float_on_stack(i64 1, i64 2, i64 3, i64 4, float 5.0)
325 define float @callee_tiny_scalar_ret() {
326 ; ILP32E-FPELIM-LABEL: callee_tiny_scalar_ret:
327 ; ILP32E-FPELIM: # %bb.0:
328 ; ILP32E-FPELIM-NEXT: lui a0, 260096
329 ; ILP32E-FPELIM-NEXT: ret
331 ; ILP32E-WITHFP-LABEL: callee_tiny_scalar_ret:
332 ; ILP32E-WITHFP: # %bb.0:
333 ; ILP32E-WITHFP-NEXT: addi sp, sp, -8
334 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 8
335 ; ILP32E-WITHFP-NEXT: sw ra, 4(sp) # 4-byte Folded Spill
336 ; ILP32E-WITHFP-NEXT: sw s0, 0(sp) # 4-byte Folded Spill
337 ; ILP32E-WITHFP-NEXT: .cfi_offset ra, -4
338 ; ILP32E-WITHFP-NEXT: .cfi_offset s0, -8
339 ; ILP32E-WITHFP-NEXT: addi s0, sp, 8
340 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0
341 ; ILP32E-WITHFP-NEXT: lui a0, 260096
342 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 8
343 ; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload
344 ; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload
345 ; ILP32E-WITHFP-NEXT: .cfi_restore ra
346 ; ILP32E-WITHFP-NEXT: .cfi_restore s0
347 ; ILP32E-WITHFP-NEXT: addi sp, sp, 8
348 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 0
349 ; ILP32E-WITHFP-NEXT: ret
351 ; ILP32E-FPELIM-SAVE-RESTORE-LABEL: callee_tiny_scalar_ret:
352 ; ILP32E-FPELIM-SAVE-RESTORE: # %bb.0:
353 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: lui a0, 260096
354 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: ret
356 ; ILP32E-WITHFP-SAVE-RESTORE-LABEL: callee_tiny_scalar_ret:
357 ; ILP32E-WITHFP-SAVE-RESTORE: # %bb.0:
358 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call t0, __riscv_save_1
359 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
360 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset ra, -4
361 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset s0, -8
362 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi s0, sp, 8
363 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa s0, 0
364 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lui a0, 260096
365 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 8
366 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1
370 define i32 @caller_tiny_scalar_ret() {
371 ; ILP32E-FPELIM-LABEL: caller_tiny_scalar_ret:
372 ; ILP32E-FPELIM: # %bb.0:
373 ; ILP32E-FPELIM-NEXT: addi sp, sp, -4
374 ; ILP32E-FPELIM-NEXT: .cfi_def_cfa_offset 4
375 ; ILP32E-FPELIM-NEXT: sw ra, 0(sp) # 4-byte Folded Spill
376 ; ILP32E-FPELIM-NEXT: .cfi_offset ra, -4
377 ; ILP32E-FPELIM-NEXT: call callee_tiny_scalar_ret
378 ; ILP32E-FPELIM-NEXT: lw ra, 0(sp) # 4-byte Folded Reload
379 ; ILP32E-FPELIM-NEXT: .cfi_restore ra
380 ; ILP32E-FPELIM-NEXT: addi sp, sp, 4
381 ; ILP32E-FPELIM-NEXT: .cfi_def_cfa_offset 0
382 ; ILP32E-FPELIM-NEXT: ret
384 ; ILP32E-WITHFP-LABEL: caller_tiny_scalar_ret:
385 ; ILP32E-WITHFP: # %bb.0:
386 ; ILP32E-WITHFP-NEXT: addi sp, sp, -8
387 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 8
388 ; ILP32E-WITHFP-NEXT: sw ra, 4(sp) # 4-byte Folded Spill
389 ; ILP32E-WITHFP-NEXT: sw s0, 0(sp) # 4-byte Folded Spill
390 ; ILP32E-WITHFP-NEXT: .cfi_offset ra, -4
391 ; ILP32E-WITHFP-NEXT: .cfi_offset s0, -8
392 ; ILP32E-WITHFP-NEXT: addi s0, sp, 8
393 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0
394 ; ILP32E-WITHFP-NEXT: call callee_tiny_scalar_ret
395 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 8
396 ; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload
397 ; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload
398 ; ILP32E-WITHFP-NEXT: .cfi_restore ra
399 ; ILP32E-WITHFP-NEXT: .cfi_restore s0
400 ; ILP32E-WITHFP-NEXT: addi sp, sp, 8
401 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 0
402 ; ILP32E-WITHFP-NEXT: ret
404 ; ILP32E-FPELIM-SAVE-RESTORE-LABEL: caller_tiny_scalar_ret:
405 ; ILP32E-FPELIM-SAVE-RESTORE: # %bb.0:
406 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: call t0, __riscv_save_0
407 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 4
408 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_offset ra, -4
409 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: call callee_tiny_scalar_ret
410 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: tail __riscv_restore_0
412 ; ILP32E-WITHFP-SAVE-RESTORE-LABEL: caller_tiny_scalar_ret:
413 ; ILP32E-WITHFP-SAVE-RESTORE: # %bb.0:
414 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call t0, __riscv_save_1
415 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
416 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset ra, -4
417 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset s0, -8
418 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi s0, sp, 8
419 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa s0, 0
420 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call callee_tiny_scalar_ret
421 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 8
422 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1
423 %1 = call float @callee_tiny_scalar_ret()
424 %2 = bitcast float %1 to i32
428 ; Check that on RV32 ilp32e, double is passed in a pair of registers. Unlike
429 ; the convention for varargs, this need not be an aligned pair.
431 define i32 @callee_double_in_regs(i32 %a, double %b) {
432 ; ILP32E-FPELIM-LABEL: callee_double_in_regs:
433 ; ILP32E-FPELIM: # %bb.0:
434 ; ILP32E-FPELIM-NEXT: addi sp, sp, -8
435 ; ILP32E-FPELIM-NEXT: .cfi_def_cfa_offset 8
436 ; ILP32E-FPELIM-NEXT: sw ra, 4(sp) # 4-byte Folded Spill
437 ; ILP32E-FPELIM-NEXT: sw s0, 0(sp) # 4-byte Folded Spill
438 ; ILP32E-FPELIM-NEXT: .cfi_offset ra, -4
439 ; ILP32E-FPELIM-NEXT: .cfi_offset s0, -8
440 ; ILP32E-FPELIM-NEXT: mv s0, a0
441 ; ILP32E-FPELIM-NEXT: mv a0, a1
442 ; ILP32E-FPELIM-NEXT: mv a1, a2
443 ; ILP32E-FPELIM-NEXT: call __fixdfsi
444 ; ILP32E-FPELIM-NEXT: add a0, s0, a0
445 ; ILP32E-FPELIM-NEXT: lw ra, 4(sp) # 4-byte Folded Reload
446 ; ILP32E-FPELIM-NEXT: lw s0, 0(sp) # 4-byte Folded Reload
447 ; ILP32E-FPELIM-NEXT: .cfi_restore ra
448 ; ILP32E-FPELIM-NEXT: .cfi_restore s0
449 ; ILP32E-FPELIM-NEXT: addi sp, sp, 8
450 ; ILP32E-FPELIM-NEXT: .cfi_def_cfa_offset 0
451 ; ILP32E-FPELIM-NEXT: ret
453 ; ILP32E-WITHFP-LABEL: callee_double_in_regs:
454 ; ILP32E-WITHFP: # %bb.0:
455 ; ILP32E-WITHFP-NEXT: addi sp, sp, -12
456 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 12
457 ; ILP32E-WITHFP-NEXT: sw ra, 8(sp) # 4-byte Folded Spill
458 ; ILP32E-WITHFP-NEXT: sw s0, 4(sp) # 4-byte Folded Spill
459 ; ILP32E-WITHFP-NEXT: sw s1, 0(sp) # 4-byte Folded Spill
460 ; ILP32E-WITHFP-NEXT: .cfi_offset ra, -4
461 ; ILP32E-WITHFP-NEXT: .cfi_offset s0, -8
462 ; ILP32E-WITHFP-NEXT: .cfi_offset s1, -12
463 ; ILP32E-WITHFP-NEXT: addi s0, sp, 12
464 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0
465 ; ILP32E-WITHFP-NEXT: mv s1, a0
466 ; ILP32E-WITHFP-NEXT: mv a0, a1
467 ; ILP32E-WITHFP-NEXT: mv a1, a2
468 ; ILP32E-WITHFP-NEXT: call __fixdfsi
469 ; ILP32E-WITHFP-NEXT: add a0, s1, a0
470 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 12
471 ; ILP32E-WITHFP-NEXT: lw ra, 8(sp) # 4-byte Folded Reload
472 ; ILP32E-WITHFP-NEXT: lw s0, 4(sp) # 4-byte Folded Reload
473 ; ILP32E-WITHFP-NEXT: lw s1, 0(sp) # 4-byte Folded Reload
474 ; ILP32E-WITHFP-NEXT: .cfi_restore ra
475 ; ILP32E-WITHFP-NEXT: .cfi_restore s0
476 ; ILP32E-WITHFP-NEXT: .cfi_restore s1
477 ; ILP32E-WITHFP-NEXT: addi sp, sp, 12
478 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 0
479 ; ILP32E-WITHFP-NEXT: ret
481 ; ILP32E-FPELIM-SAVE-RESTORE-LABEL: callee_double_in_regs:
482 ; ILP32E-FPELIM-SAVE-RESTORE: # %bb.0:
483 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: call t0, __riscv_save_1
484 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
485 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_offset ra, -4
486 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_offset s0, -8
487 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: mv s0, a0
488 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: mv a0, a1
489 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: mv a1, a2
490 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: call __fixdfsi
491 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: add a0, s0, a0
492 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: tail __riscv_restore_1
494 ; ILP32E-WITHFP-SAVE-RESTORE-LABEL: callee_double_in_regs:
495 ; ILP32E-WITHFP-SAVE-RESTORE: # %bb.0:
496 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call t0, __riscv_save_2
497 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 12
498 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset ra, -4
499 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset s0, -8
500 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset s1, -12
501 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi s0, sp, 12
502 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa s0, 0
503 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: mv s1, a0
504 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: mv a0, a1
505 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: mv a1, a2
506 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call __fixdfsi
507 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: add a0, s1, a0
508 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 12
509 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_2
510 %b_fptosi = fptosi double %b to i32
511 %1 = add i32 %a, %b_fptosi
515 define i32 @caller_double_in_regs() {
516 ; ILP32E-FPELIM-LABEL: caller_double_in_regs:
517 ; ILP32E-FPELIM: # %bb.0:
518 ; ILP32E-FPELIM-NEXT: addi sp, sp, -4
519 ; ILP32E-FPELIM-NEXT: .cfi_def_cfa_offset 4
520 ; ILP32E-FPELIM-NEXT: sw ra, 0(sp) # 4-byte Folded Spill
521 ; ILP32E-FPELIM-NEXT: .cfi_offset ra, -4
522 ; ILP32E-FPELIM-NEXT: li a0, 1
523 ; ILP32E-FPELIM-NEXT: lui a2, 262144
524 ; ILP32E-FPELIM-NEXT: li a1, 0
525 ; ILP32E-FPELIM-NEXT: call callee_double_in_regs
526 ; ILP32E-FPELIM-NEXT: lw ra, 0(sp) # 4-byte Folded Reload
527 ; ILP32E-FPELIM-NEXT: .cfi_restore ra
528 ; ILP32E-FPELIM-NEXT: addi sp, sp, 4
529 ; ILP32E-FPELIM-NEXT: .cfi_def_cfa_offset 0
530 ; ILP32E-FPELIM-NEXT: ret
532 ; ILP32E-WITHFP-LABEL: caller_double_in_regs:
533 ; ILP32E-WITHFP: # %bb.0:
534 ; ILP32E-WITHFP-NEXT: addi sp, sp, -8
535 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 8
536 ; ILP32E-WITHFP-NEXT: sw ra, 4(sp) # 4-byte Folded Spill
537 ; ILP32E-WITHFP-NEXT: sw s0, 0(sp) # 4-byte Folded Spill
538 ; ILP32E-WITHFP-NEXT: .cfi_offset ra, -4
539 ; ILP32E-WITHFP-NEXT: .cfi_offset s0, -8
540 ; ILP32E-WITHFP-NEXT: addi s0, sp, 8
541 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0
542 ; ILP32E-WITHFP-NEXT: li a0, 1
543 ; ILP32E-WITHFP-NEXT: lui a2, 262144
544 ; ILP32E-WITHFP-NEXT: li a1, 0
545 ; ILP32E-WITHFP-NEXT: call callee_double_in_regs
546 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 8
547 ; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload
548 ; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload
549 ; ILP32E-WITHFP-NEXT: .cfi_restore ra
550 ; ILP32E-WITHFP-NEXT: .cfi_restore s0
551 ; ILP32E-WITHFP-NEXT: addi sp, sp, 8
552 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 0
553 ; ILP32E-WITHFP-NEXT: ret
555 ; ILP32E-FPELIM-SAVE-RESTORE-LABEL: caller_double_in_regs:
556 ; ILP32E-FPELIM-SAVE-RESTORE: # %bb.0:
557 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: call t0, __riscv_save_0
558 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 4
559 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_offset ra, -4
560 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li a0, 1
561 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: lui a2, 262144
562 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li a1, 0
563 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: call callee_double_in_regs
564 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: tail __riscv_restore_0
566 ; ILP32E-WITHFP-SAVE-RESTORE-LABEL: caller_double_in_regs:
567 ; ILP32E-WITHFP-SAVE-RESTORE: # %bb.0:
568 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call t0, __riscv_save_1
569 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
570 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset ra, -4
571 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset s0, -8
572 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi s0, sp, 8
573 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa s0, 0
574 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a0, 1
575 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lui a2, 262144
576 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a1, 0
577 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call callee_double_in_regs
578 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 8
579 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1
580 %1 = call i32 @callee_double_in_regs(i32 1, double 2.0)
584 ; Check 2x*xlen values are aligned appropriately when passed on the stack
585 ; Must keep define on a single line due to an update_llc_test_checks.py limitation
586 define i32 @callee_aligned_stack(i32 %a, i32 %b, fp128 %c, i32 %d, i32 %e, i64 %f, i32 %g, i32 %h, double %i, i32 %j, [2 x i32] %k) {
587 ; The double should be 8-byte aligned on the stack, but the two-element array
588 ; should only be 4-byte aligned
589 ; ILP32E-FPELIM-LABEL: callee_aligned_stack:
590 ; ILP32E-FPELIM: # %bb.0:
591 ; ILP32E-FPELIM-NEXT: lw a0, 0(a2)
592 ; ILP32E-FPELIM-NEXT: lw a1, 12(sp)
593 ; ILP32E-FPELIM-NEXT: lw a2, 4(sp)
594 ; ILP32E-FPELIM-NEXT: lw a3, 8(sp)
595 ; ILP32E-FPELIM-NEXT: lw a4, 24(sp)
596 ; ILP32E-FPELIM-NEXT: lw a5, 20(sp)
597 ; ILP32E-FPELIM-NEXT: add a0, a0, a2
598 ; ILP32E-FPELIM-NEXT: add a1, a3, a1
599 ; ILP32E-FPELIM-NEXT: add a0, a0, a1
600 ; ILP32E-FPELIM-NEXT: add a4, a5, a4
601 ; ILP32E-FPELIM-NEXT: add a0, a0, a4
602 ; ILP32E-FPELIM-NEXT: ret
604 ; ILP32E-WITHFP-LABEL: callee_aligned_stack:
605 ; ILP32E-WITHFP: # %bb.0:
606 ; ILP32E-WITHFP-NEXT: addi sp, sp, -8
607 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 8
608 ; ILP32E-WITHFP-NEXT: sw ra, 4(sp) # 4-byte Folded Spill
609 ; ILP32E-WITHFP-NEXT: sw s0, 0(sp) # 4-byte Folded Spill
610 ; ILP32E-WITHFP-NEXT: .cfi_offset ra, -4
611 ; ILP32E-WITHFP-NEXT: .cfi_offset s0, -8
612 ; ILP32E-WITHFP-NEXT: addi s0, sp, 8
613 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0
614 ; ILP32E-WITHFP-NEXT: lw a0, 0(a2)
615 ; ILP32E-WITHFP-NEXT: lw a1, 12(s0)
616 ; ILP32E-WITHFP-NEXT: lw a2, 4(s0)
617 ; ILP32E-WITHFP-NEXT: lw a3, 8(s0)
618 ; ILP32E-WITHFP-NEXT: lw a4, 24(s0)
619 ; ILP32E-WITHFP-NEXT: lw a5, 20(s0)
620 ; ILP32E-WITHFP-NEXT: add a0, a0, a2
621 ; ILP32E-WITHFP-NEXT: add a1, a3, a1
622 ; ILP32E-WITHFP-NEXT: add a0, a0, a1
623 ; ILP32E-WITHFP-NEXT: add a4, a5, a4
624 ; ILP32E-WITHFP-NEXT: add a0, a0, a4
625 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 8
626 ; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload
627 ; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload
628 ; ILP32E-WITHFP-NEXT: .cfi_restore ra
629 ; ILP32E-WITHFP-NEXT: .cfi_restore s0
630 ; ILP32E-WITHFP-NEXT: addi sp, sp, 8
631 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 0
632 ; ILP32E-WITHFP-NEXT: ret
634 ; ILP32E-FPELIM-SAVE-RESTORE-LABEL: callee_aligned_stack:
635 ; ILP32E-FPELIM-SAVE-RESTORE: # %bb.0:
636 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: lw a0, 0(a2)
637 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: lw a1, 12(sp)
638 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: lw a2, 4(sp)
639 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: lw a3, 8(sp)
640 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: lw a4, 24(sp)
641 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: lw a5, 20(sp)
642 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: add a0, a0, a2
643 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: add a1, a3, a1
644 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: add a0, a0, a1
645 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: add a4, a5, a4
646 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: add a0, a0, a4
647 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: ret
649 ; ILP32E-WITHFP-SAVE-RESTORE-LABEL: callee_aligned_stack:
650 ; ILP32E-WITHFP-SAVE-RESTORE: # %bb.0:
651 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call t0, __riscv_save_1
652 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
653 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset ra, -4
654 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset s0, -8
655 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi s0, sp, 8
656 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa s0, 0
657 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lw a0, 0(a2)
658 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lw a1, 12(s0)
659 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lw a2, 4(s0)
660 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lw a3, 8(s0)
661 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lw a4, 24(s0)
662 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lw a5, 20(s0)
663 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: add a0, a0, a2
664 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: add a1, a3, a1
665 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: add a0, a0, a1
666 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: add a4, a5, a4
667 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: add a0, a0, a4
668 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 8
669 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1
670 %1 = bitcast fp128 %c to i128
671 %2 = trunc i128 %1 to i32
674 %5 = bitcast double %i to i64
675 %6 = trunc i64 %5 to i32
678 %9 = extractvalue [2 x i32] %k, 0
683 define void @caller_aligned_stack() {
684 ; The double should be 8-byte aligned on the stack, but the two-element array
685 ; should only be 4-byte aligned
686 ; ILP32E-FPELIM-LABEL: caller_aligned_stack:
687 ; ILP32E-FPELIM: # %bb.0:
688 ; ILP32E-FPELIM-NEXT: addi sp, sp, -64
689 ; ILP32E-FPELIM-NEXT: .cfi_def_cfa_offset 64
690 ; ILP32E-FPELIM-NEXT: sw ra, 60(sp) # 4-byte Folded Spill
691 ; ILP32E-FPELIM-NEXT: sw s0, 56(sp) # 4-byte Folded Spill
692 ; ILP32E-FPELIM-NEXT: .cfi_offset ra, -4
693 ; ILP32E-FPELIM-NEXT: .cfi_offset s0, -8
694 ; ILP32E-FPELIM-NEXT: addi s0, sp, 64
695 ; ILP32E-FPELIM-NEXT: .cfi_def_cfa s0, 0
696 ; ILP32E-FPELIM-NEXT: andi sp, sp, -16
697 ; ILP32E-FPELIM-NEXT: li a3, 18
698 ; ILP32E-FPELIM-NEXT: li a4, 17
699 ; ILP32E-FPELIM-NEXT: li a5, 16
700 ; ILP32E-FPELIM-NEXT: lui a6, 262236
701 ; ILP32E-FPELIM-NEXT: lui a7, 377487
702 ; ILP32E-FPELIM-NEXT: li t0, 15
703 ; ILP32E-FPELIM-NEXT: li t1, 14
704 ; ILP32E-FPELIM-NEXT: li t2, 4
705 ; ILP32E-FPELIM-NEXT: lui t3, 262153
706 ; ILP32E-FPELIM-NEXT: lui t4, 545260
707 ; ILP32E-FPELIM-NEXT: lui t5, 964690
708 ; ILP32E-FPELIM-NEXT: lui t6, 335544
709 ; ILP32E-FPELIM-NEXT: lui s2, 688509
710 ; ILP32E-FPELIM-NEXT: li a0, 1
711 ; ILP32E-FPELIM-NEXT: li a1, 11
712 ; ILP32E-FPELIM-NEXT: addi a2, sp, 32
713 ; ILP32E-FPELIM-NEXT: addi a6, a6, 655
714 ; ILP32E-FPELIM-NEXT: sw a6, 16(sp)
715 ; ILP32E-FPELIM-NEXT: sw a5, 20(sp)
716 ; ILP32E-FPELIM-NEXT: sw a4, 24(sp)
717 ; ILP32E-FPELIM-NEXT: sw a3, 28(sp)
718 ; ILP32E-FPELIM-NEXT: li a3, 12
719 ; ILP32E-FPELIM-NEXT: addi a4, a7, 1475
720 ; ILP32E-FPELIM-NEXT: sw t2, 0(sp)
721 ; ILP32E-FPELIM-NEXT: sw t1, 4(sp)
722 ; ILP32E-FPELIM-NEXT: sw t0, 8(sp)
723 ; ILP32E-FPELIM-NEXT: sw a4, 12(sp)
724 ; ILP32E-FPELIM-NEXT: li a4, 13
725 ; ILP32E-FPELIM-NEXT: addi a6, t3, 491
726 ; ILP32E-FPELIM-NEXT: addi a7, t4, -1967
727 ; ILP32E-FPELIM-NEXT: addi t0, t5, -328
728 ; ILP32E-FPELIM-NEXT: addi t1, t6, 1311
729 ; ILP32E-FPELIM-NEXT: addi a5, s2, -2048
730 ; ILP32E-FPELIM-NEXT: sw t1, 32(sp)
731 ; ILP32E-FPELIM-NEXT: sw t0, 36(sp)
732 ; ILP32E-FPELIM-NEXT: sw a7, 40(sp)
733 ; ILP32E-FPELIM-NEXT: sw a6, 44(sp)
734 ; ILP32E-FPELIM-NEXT: call callee_aligned_stack
735 ; ILP32E-FPELIM-NEXT: addi sp, s0, -64
736 ; ILP32E-FPELIM-NEXT: .cfi_def_cfa sp, 64
737 ; ILP32E-FPELIM-NEXT: lw ra, 60(sp) # 4-byte Folded Reload
738 ; ILP32E-FPELIM-NEXT: lw s0, 56(sp) # 4-byte Folded Reload
739 ; ILP32E-FPELIM-NEXT: .cfi_restore ra
740 ; ILP32E-FPELIM-NEXT: .cfi_restore s0
741 ; ILP32E-FPELIM-NEXT: addi sp, sp, 64
742 ; ILP32E-FPELIM-NEXT: .cfi_def_cfa_offset 0
743 ; ILP32E-FPELIM-NEXT: ret
745 ; ILP32E-WITHFP-LABEL: caller_aligned_stack:
746 ; ILP32E-WITHFP: # %bb.0:
747 ; ILP32E-WITHFP-NEXT: addi sp, sp, -64
748 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 64
749 ; ILP32E-WITHFP-NEXT: sw ra, 60(sp) # 4-byte Folded Spill
750 ; ILP32E-WITHFP-NEXT: sw s0, 56(sp) # 4-byte Folded Spill
751 ; ILP32E-WITHFP-NEXT: .cfi_offset ra, -4
752 ; ILP32E-WITHFP-NEXT: .cfi_offset s0, -8
753 ; ILP32E-WITHFP-NEXT: addi s0, sp, 64
754 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0
755 ; ILP32E-WITHFP-NEXT: andi sp, sp, -16
756 ; ILP32E-WITHFP-NEXT: li a3, 18
757 ; ILP32E-WITHFP-NEXT: li a4, 17
758 ; ILP32E-WITHFP-NEXT: li a5, 16
759 ; ILP32E-WITHFP-NEXT: lui a6, 262236
760 ; ILP32E-WITHFP-NEXT: lui a7, 377487
761 ; ILP32E-WITHFP-NEXT: li t0, 15
762 ; ILP32E-WITHFP-NEXT: li t1, 14
763 ; ILP32E-WITHFP-NEXT: li t2, 4
764 ; ILP32E-WITHFP-NEXT: lui t3, 262153
765 ; ILP32E-WITHFP-NEXT: lui t4, 545260
766 ; ILP32E-WITHFP-NEXT: lui t5, 964690
767 ; ILP32E-WITHFP-NEXT: lui t6, 335544
768 ; ILP32E-WITHFP-NEXT: lui s2, 688509
769 ; ILP32E-WITHFP-NEXT: li a0, 1
770 ; ILP32E-WITHFP-NEXT: li a1, 11
771 ; ILP32E-WITHFP-NEXT: addi a2, sp, 32
772 ; ILP32E-WITHFP-NEXT: addi a6, a6, 655
773 ; ILP32E-WITHFP-NEXT: sw a6, 16(sp)
774 ; ILP32E-WITHFP-NEXT: sw a5, 20(sp)
775 ; ILP32E-WITHFP-NEXT: sw a4, 24(sp)
776 ; ILP32E-WITHFP-NEXT: sw a3, 28(sp)
777 ; ILP32E-WITHFP-NEXT: li a3, 12
778 ; ILP32E-WITHFP-NEXT: addi a4, a7, 1475
779 ; ILP32E-WITHFP-NEXT: sw t2, 0(sp)
780 ; ILP32E-WITHFP-NEXT: sw t1, 4(sp)
781 ; ILP32E-WITHFP-NEXT: sw t0, 8(sp)
782 ; ILP32E-WITHFP-NEXT: sw a4, 12(sp)
783 ; ILP32E-WITHFP-NEXT: li a4, 13
784 ; ILP32E-WITHFP-NEXT: addi a6, t3, 491
785 ; ILP32E-WITHFP-NEXT: addi a7, t4, -1967
786 ; ILP32E-WITHFP-NEXT: addi t0, t5, -328
787 ; ILP32E-WITHFP-NEXT: addi t1, t6, 1311
788 ; ILP32E-WITHFP-NEXT: addi a5, s2, -2048
789 ; ILP32E-WITHFP-NEXT: sw t1, 32(sp)
790 ; ILP32E-WITHFP-NEXT: sw t0, 36(sp)
791 ; ILP32E-WITHFP-NEXT: sw a7, 40(sp)
792 ; ILP32E-WITHFP-NEXT: sw a6, 44(sp)
793 ; ILP32E-WITHFP-NEXT: call callee_aligned_stack
794 ; ILP32E-WITHFP-NEXT: addi sp, s0, -64
795 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 64
796 ; ILP32E-WITHFP-NEXT: lw ra, 60(sp) # 4-byte Folded Reload
797 ; ILP32E-WITHFP-NEXT: lw s0, 56(sp) # 4-byte Folded Reload
798 ; ILP32E-WITHFP-NEXT: .cfi_restore ra
799 ; ILP32E-WITHFP-NEXT: .cfi_restore s0
800 ; ILP32E-WITHFP-NEXT: addi sp, sp, 64
801 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 0
802 ; ILP32E-WITHFP-NEXT: ret
804 ; ILP32E-FPELIM-SAVE-RESTORE-LABEL: caller_aligned_stack:
805 ; ILP32E-FPELIM-SAVE-RESTORE: # %bb.0:
806 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: call t0, __riscv_save_1
807 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
808 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_offset ra, -4
809 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_offset s0, -8
810 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: addi sp, sp, -56
811 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 64
812 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: addi s0, sp, 64
813 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_def_cfa s0, 0
814 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: andi sp, sp, -16
815 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li a3, 18
816 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li a4, 17
817 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li a5, 16
818 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: lui a6, 262236
819 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: lui a7, 377487
820 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li t0, 15
821 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li t1, 14
822 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li t2, 4
823 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: lui t3, 262153
824 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: lui t4, 545260
825 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: lui t5, 964690
826 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: lui t6, 335544
827 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: lui s2, 688509
828 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li a0, 1
829 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li a1, 11
830 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: addi a2, sp, 32
831 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: addi a6, a6, 655
832 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw a6, 16(sp)
833 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw a5, 20(sp)
834 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw a4, 24(sp)
835 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw a3, 28(sp)
836 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li a3, 12
837 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: addi a4, a7, 1475
838 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw t2, 0(sp)
839 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw t1, 4(sp)
840 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw t0, 8(sp)
841 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw a4, 12(sp)
842 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li a4, 13
843 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: addi a6, t3, 491
844 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: addi a7, t4, -1967
845 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: addi t0, t5, -328
846 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: addi t1, t6, 1311
847 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: addi a5, s2, -2048
848 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw t1, 32(sp)
849 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw t0, 36(sp)
850 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw a7, 40(sp)
851 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw a6, 44(sp)
852 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: call callee_aligned_stack
853 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: addi sp, s0, -64
854 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 64
855 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: addi sp, sp, 56
856 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
857 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: tail __riscv_restore_1
859 ; ILP32E-WITHFP-SAVE-RESTORE-LABEL: caller_aligned_stack:
860 ; ILP32E-WITHFP-SAVE-RESTORE: # %bb.0:
861 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call t0, __riscv_save_1
862 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
863 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset ra, -4
864 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset s0, -8
865 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi sp, sp, -56
866 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 64
867 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi s0, sp, 64
868 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa s0, 0
869 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: andi sp, sp, -16
870 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a3, 18
871 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a4, 17
872 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a5, 16
873 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lui a6, 262236
874 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lui a7, 377487
875 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li t0, 15
876 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li t1, 14
877 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li t2, 4
878 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lui t3, 262153
879 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lui t4, 545260
880 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lui t5, 964690
881 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lui t6, 335544
882 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lui s2, 688509
883 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a0, 1
884 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a1, 11
885 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi a2, sp, 32
886 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi a6, a6, 655
887 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw a6, 16(sp)
888 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw a5, 20(sp)
889 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw a4, 24(sp)
890 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw a3, 28(sp)
891 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a3, 12
892 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi a4, a7, 1475
893 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw t2, 0(sp)
894 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw t1, 4(sp)
895 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw t0, 8(sp)
896 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw a4, 12(sp)
897 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a4, 13
898 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi a6, t3, 491
899 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi a7, t4, -1967
900 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi t0, t5, -328
901 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi t1, t6, 1311
902 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi a5, s2, -2048
903 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw t1, 32(sp)
904 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw t0, 36(sp)
905 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw a7, 40(sp)
906 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw a6, 44(sp)
907 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call callee_aligned_stack
908 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi sp, s0, -64
909 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 64
910 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi sp, sp, 56
911 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
912 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1
913 %1 = call i32 @callee_aligned_stack(i32 1, i32 11,
914 fp128 0xLEB851EB851EB851F400091EB851EB851, i32 12, i32 13,
915 i64 20000000000, i32 14, i32 15, double 2.720000e+00, i32 16,
916 [2 x i32] [i32 17, i32 18])
920 define double @callee_small_scalar_ret() {
921 ; ILP32E-FPELIM-LABEL: callee_small_scalar_ret:
922 ; ILP32E-FPELIM: # %bb.0:
923 ; ILP32E-FPELIM-NEXT: lui a1, 261888
924 ; ILP32E-FPELIM-NEXT: li a0, 0
925 ; ILP32E-FPELIM-NEXT: ret
927 ; ILP32E-WITHFP-LABEL: callee_small_scalar_ret:
928 ; ILP32E-WITHFP: # %bb.0:
929 ; ILP32E-WITHFP-NEXT: addi sp, sp, -8
930 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 8
931 ; ILP32E-WITHFP-NEXT: sw ra, 4(sp) # 4-byte Folded Spill
932 ; ILP32E-WITHFP-NEXT: sw s0, 0(sp) # 4-byte Folded Spill
933 ; ILP32E-WITHFP-NEXT: .cfi_offset ra, -4
934 ; ILP32E-WITHFP-NEXT: .cfi_offset s0, -8
935 ; ILP32E-WITHFP-NEXT: addi s0, sp, 8
936 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0
937 ; ILP32E-WITHFP-NEXT: lui a1, 261888
938 ; ILP32E-WITHFP-NEXT: li a0, 0
939 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 8
940 ; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload
941 ; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload
942 ; ILP32E-WITHFP-NEXT: .cfi_restore ra
943 ; ILP32E-WITHFP-NEXT: .cfi_restore s0
944 ; ILP32E-WITHFP-NEXT: addi sp, sp, 8
945 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 0
946 ; ILP32E-WITHFP-NEXT: ret
948 ; ILP32E-FPELIM-SAVE-RESTORE-LABEL: callee_small_scalar_ret:
949 ; ILP32E-FPELIM-SAVE-RESTORE: # %bb.0:
950 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: lui a1, 261888
951 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li a0, 0
952 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: ret
954 ; ILP32E-WITHFP-SAVE-RESTORE-LABEL: callee_small_scalar_ret:
955 ; ILP32E-WITHFP-SAVE-RESTORE: # %bb.0:
956 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call t0, __riscv_save_1
957 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
958 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset ra, -4
959 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset s0, -8
960 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi s0, sp, 8
961 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa s0, 0
962 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lui a1, 261888
963 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a0, 0
964 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 8
965 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1
969 define i64 @caller_small_scalar_ret() {
970 ; ILP32E-FPELIM-LABEL: caller_small_scalar_ret:
971 ; ILP32E-FPELIM: # %bb.0:
972 ; ILP32E-FPELIM-NEXT: addi sp, sp, -4
973 ; ILP32E-FPELIM-NEXT: .cfi_def_cfa_offset 4
974 ; ILP32E-FPELIM-NEXT: sw ra, 0(sp) # 4-byte Folded Spill
975 ; ILP32E-FPELIM-NEXT: .cfi_offset ra, -4
976 ; ILP32E-FPELIM-NEXT: call callee_small_scalar_ret
977 ; ILP32E-FPELIM-NEXT: lw ra, 0(sp) # 4-byte Folded Reload
978 ; ILP32E-FPELIM-NEXT: .cfi_restore ra
979 ; ILP32E-FPELIM-NEXT: addi sp, sp, 4
980 ; ILP32E-FPELIM-NEXT: .cfi_def_cfa_offset 0
981 ; ILP32E-FPELIM-NEXT: ret
983 ; ILP32E-WITHFP-LABEL: caller_small_scalar_ret:
984 ; ILP32E-WITHFP: # %bb.0:
985 ; ILP32E-WITHFP-NEXT: addi sp, sp, -8
986 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 8
987 ; ILP32E-WITHFP-NEXT: sw ra, 4(sp) # 4-byte Folded Spill
988 ; ILP32E-WITHFP-NEXT: sw s0, 0(sp) # 4-byte Folded Spill
989 ; ILP32E-WITHFP-NEXT: .cfi_offset ra, -4
990 ; ILP32E-WITHFP-NEXT: .cfi_offset s0, -8
991 ; ILP32E-WITHFP-NEXT: addi s0, sp, 8
992 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0
993 ; ILP32E-WITHFP-NEXT: call callee_small_scalar_ret
994 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 8
995 ; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload
996 ; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload
997 ; ILP32E-WITHFP-NEXT: .cfi_restore ra
998 ; ILP32E-WITHFP-NEXT: .cfi_restore s0
999 ; ILP32E-WITHFP-NEXT: addi sp, sp, 8
1000 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 0
1001 ; ILP32E-WITHFP-NEXT: ret
1003 ; ILP32E-FPELIM-SAVE-RESTORE-LABEL: caller_small_scalar_ret:
1004 ; ILP32E-FPELIM-SAVE-RESTORE: # %bb.0:
1005 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: call t0, __riscv_save_0
1006 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 4
1007 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_offset ra, -4
1008 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: call callee_small_scalar_ret
1009 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: tail __riscv_restore_0
1011 ; ILP32E-WITHFP-SAVE-RESTORE-LABEL: caller_small_scalar_ret:
1012 ; ILP32E-WITHFP-SAVE-RESTORE: # %bb.0:
1013 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call t0, __riscv_save_1
1014 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
1015 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset ra, -4
1016 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset s0, -8
1017 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi s0, sp, 8
1018 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa s0, 0
1019 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call callee_small_scalar_ret
1020 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 8
1021 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1
1022 %1 = call double @callee_small_scalar_ret()
1023 %2 = bitcast double %1 to i64
1027 ; Check that on RV32, i64 is passed in a pair of registers. Unlike
1028 ; the convention for varargs, this need not be an aligned pair.
1030 define i32 @callee_i64_in_regs(i32 %a, i64 %b) {
1031 ; ILP32E-FPELIM-LABEL: callee_i64_in_regs:
1032 ; ILP32E-FPELIM: # %bb.0:
1033 ; ILP32E-FPELIM-NEXT: add a0, a0, a1
1034 ; ILP32E-FPELIM-NEXT: ret
1036 ; ILP32E-WITHFP-LABEL: callee_i64_in_regs:
1037 ; ILP32E-WITHFP: # %bb.0:
1038 ; ILP32E-WITHFP-NEXT: addi sp, sp, -8
1039 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 8
1040 ; ILP32E-WITHFP-NEXT: sw ra, 4(sp) # 4-byte Folded Spill
1041 ; ILP32E-WITHFP-NEXT: sw s0, 0(sp) # 4-byte Folded Spill
1042 ; ILP32E-WITHFP-NEXT: .cfi_offset ra, -4
1043 ; ILP32E-WITHFP-NEXT: .cfi_offset s0, -8
1044 ; ILP32E-WITHFP-NEXT: addi s0, sp, 8
1045 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0
1046 ; ILP32E-WITHFP-NEXT: add a0, a0, a1
1047 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 8
1048 ; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload
1049 ; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload
1050 ; ILP32E-WITHFP-NEXT: .cfi_restore ra
1051 ; ILP32E-WITHFP-NEXT: .cfi_restore s0
1052 ; ILP32E-WITHFP-NEXT: addi sp, sp, 8
1053 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 0
1054 ; ILP32E-WITHFP-NEXT: ret
1056 ; ILP32E-FPELIM-SAVE-RESTORE-LABEL: callee_i64_in_regs:
1057 ; ILP32E-FPELIM-SAVE-RESTORE: # %bb.0:
1058 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: add a0, a0, a1
1059 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: ret
1061 ; ILP32E-WITHFP-SAVE-RESTORE-LABEL: callee_i64_in_regs:
1062 ; ILP32E-WITHFP-SAVE-RESTORE: # %bb.0:
1063 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call t0, __riscv_save_1
1064 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
1065 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset ra, -4
1066 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset s0, -8
1067 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi s0, sp, 8
1068 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa s0, 0
1069 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: add a0, a0, a1
1070 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 8
1071 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1
1072 %b_trunc = trunc i64 %b to i32
1073 %1 = add i32 %a, %b_trunc
1077 define i32 @caller_i64_in_regs() {
1078 ; ILP32E-FPELIM-LABEL: caller_i64_in_regs:
1079 ; ILP32E-FPELIM: # %bb.0:
1080 ; ILP32E-FPELIM-NEXT: addi sp, sp, -4
1081 ; ILP32E-FPELIM-NEXT: .cfi_def_cfa_offset 4
1082 ; ILP32E-FPELIM-NEXT: sw ra, 0(sp) # 4-byte Folded Spill
1083 ; ILP32E-FPELIM-NEXT: .cfi_offset ra, -4
1084 ; ILP32E-FPELIM-NEXT: li a0, 1
1085 ; ILP32E-FPELIM-NEXT: li a1, 2
1086 ; ILP32E-FPELIM-NEXT: li a2, 0
1087 ; ILP32E-FPELIM-NEXT: call callee_i64_in_regs
1088 ; ILP32E-FPELIM-NEXT: lw ra, 0(sp) # 4-byte Folded Reload
1089 ; ILP32E-FPELIM-NEXT: .cfi_restore ra
1090 ; ILP32E-FPELIM-NEXT: addi sp, sp, 4
1091 ; ILP32E-FPELIM-NEXT: .cfi_def_cfa_offset 0
1092 ; ILP32E-FPELIM-NEXT: ret
1094 ; ILP32E-WITHFP-LABEL: caller_i64_in_regs:
1095 ; ILP32E-WITHFP: # %bb.0:
1096 ; ILP32E-WITHFP-NEXT: addi sp, sp, -8
1097 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 8
1098 ; ILP32E-WITHFP-NEXT: sw ra, 4(sp) # 4-byte Folded Spill
1099 ; ILP32E-WITHFP-NEXT: sw s0, 0(sp) # 4-byte Folded Spill
1100 ; ILP32E-WITHFP-NEXT: .cfi_offset ra, -4
1101 ; ILP32E-WITHFP-NEXT: .cfi_offset s0, -8
1102 ; ILP32E-WITHFP-NEXT: addi s0, sp, 8
1103 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0
1104 ; ILP32E-WITHFP-NEXT: li a0, 1
1105 ; ILP32E-WITHFP-NEXT: li a1, 2
1106 ; ILP32E-WITHFP-NEXT: li a2, 0
1107 ; ILP32E-WITHFP-NEXT: call callee_i64_in_regs
1108 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 8
1109 ; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload
1110 ; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload
1111 ; ILP32E-WITHFP-NEXT: .cfi_restore ra
1112 ; ILP32E-WITHFP-NEXT: .cfi_restore s0
1113 ; ILP32E-WITHFP-NEXT: addi sp, sp, 8
1114 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 0
1115 ; ILP32E-WITHFP-NEXT: ret
1117 ; ILP32E-FPELIM-SAVE-RESTORE-LABEL: caller_i64_in_regs:
1118 ; ILP32E-FPELIM-SAVE-RESTORE: # %bb.0:
1119 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: call t0, __riscv_save_0
1120 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 4
1121 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_offset ra, -4
1122 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li a0, 1
1123 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li a1, 2
1124 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li a2, 0
1125 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: call callee_i64_in_regs
1126 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: tail __riscv_restore_0
1128 ; ILP32E-WITHFP-SAVE-RESTORE-LABEL: caller_i64_in_regs:
1129 ; ILP32E-WITHFP-SAVE-RESTORE: # %bb.0:
1130 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call t0, __riscv_save_1
1131 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
1132 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset ra, -4
1133 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset s0, -8
1134 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi s0, sp, 8
1135 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa s0, 0
1136 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a0, 1
1137 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a1, 2
1138 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a2, 0
1139 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call callee_i64_in_regs
1140 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 8
1141 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1
1142 %1 = call i32 @callee_i64_in_regs(i32 1, i64 2)
1146 ; Check that the stack is used once the GPRs are exhausted
1148 define i32 @callee_many_scalars(i8 %a, i16 %b, i32 %c, i64 %d, i32 %e, i32 %f, i64 %g, i32 %h) {
1149 ; ILP32E-FPELIM-LABEL: callee_many_scalars:
1150 ; ILP32E-FPELIM: # %bb.0:
1151 ; ILP32E-FPELIM-NEXT: lw a6, 12(sp)
1152 ; ILP32E-FPELIM-NEXT: lw a7, 0(sp)
1153 ; ILP32E-FPELIM-NEXT: lw t0, 4(sp)
1154 ; ILP32E-FPELIM-NEXT: lw t1, 8(sp)
1155 ; ILP32E-FPELIM-NEXT: andi a0, a0, 255
1156 ; ILP32E-FPELIM-NEXT: slli a1, a1, 16
1157 ; ILP32E-FPELIM-NEXT: srli a1, a1, 16
1158 ; ILP32E-FPELIM-NEXT: add a0, a0, a2
1159 ; ILP32E-FPELIM-NEXT: add a0, a0, a1
1160 ; ILP32E-FPELIM-NEXT: add a0, a0, a5
1161 ; ILP32E-FPELIM-NEXT: xor a1, a4, t1
1162 ; ILP32E-FPELIM-NEXT: xor a2, a3, t0
1163 ; ILP32E-FPELIM-NEXT: add a0, a0, a7
1164 ; ILP32E-FPELIM-NEXT: or a1, a2, a1
1165 ; ILP32E-FPELIM-NEXT: seqz a1, a1
1166 ; ILP32E-FPELIM-NEXT: add a0, a0, a6
1167 ; ILP32E-FPELIM-NEXT: add a0, a1, a0
1168 ; ILP32E-FPELIM-NEXT: ret
1170 ; ILP32E-WITHFP-LABEL: callee_many_scalars:
1171 ; ILP32E-WITHFP: # %bb.0:
1172 ; ILP32E-WITHFP-NEXT: addi sp, sp, -8
1173 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 8
1174 ; ILP32E-WITHFP-NEXT: sw ra, 4(sp) # 4-byte Folded Spill
1175 ; ILP32E-WITHFP-NEXT: sw s0, 0(sp) # 4-byte Folded Spill
1176 ; ILP32E-WITHFP-NEXT: .cfi_offset ra, -4
1177 ; ILP32E-WITHFP-NEXT: .cfi_offset s0, -8
1178 ; ILP32E-WITHFP-NEXT: addi s0, sp, 8
1179 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0
1180 ; ILP32E-WITHFP-NEXT: lw a6, 12(s0)
1181 ; ILP32E-WITHFP-NEXT: lw a7, 0(s0)
1182 ; ILP32E-WITHFP-NEXT: lw t0, 4(s0)
1183 ; ILP32E-WITHFP-NEXT: lw t1, 8(s0)
1184 ; ILP32E-WITHFP-NEXT: andi a0, a0, 255
1185 ; ILP32E-WITHFP-NEXT: slli a1, a1, 16
1186 ; ILP32E-WITHFP-NEXT: srli a1, a1, 16
1187 ; ILP32E-WITHFP-NEXT: add a0, a0, a2
1188 ; ILP32E-WITHFP-NEXT: add a0, a0, a1
1189 ; ILP32E-WITHFP-NEXT: add a0, a0, a5
1190 ; ILP32E-WITHFP-NEXT: xor a1, a4, t1
1191 ; ILP32E-WITHFP-NEXT: xor a2, a3, t0
1192 ; ILP32E-WITHFP-NEXT: add a0, a0, a7
1193 ; ILP32E-WITHFP-NEXT: or a1, a2, a1
1194 ; ILP32E-WITHFP-NEXT: seqz a1, a1
1195 ; ILP32E-WITHFP-NEXT: add a0, a0, a6
1196 ; ILP32E-WITHFP-NEXT: add a0, a1, a0
1197 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 8
1198 ; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload
1199 ; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload
1200 ; ILP32E-WITHFP-NEXT: .cfi_restore ra
1201 ; ILP32E-WITHFP-NEXT: .cfi_restore s0
1202 ; ILP32E-WITHFP-NEXT: addi sp, sp, 8
1203 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 0
1204 ; ILP32E-WITHFP-NEXT: ret
1206 ; ILP32E-FPELIM-SAVE-RESTORE-LABEL: callee_many_scalars:
1207 ; ILP32E-FPELIM-SAVE-RESTORE: # %bb.0:
1208 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: lw a6, 12(sp)
1209 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: lw a7, 0(sp)
1210 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: lw t0, 4(sp)
1211 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: lw t1, 8(sp)
1212 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: andi a0, a0, 255
1213 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: slli a1, a1, 16
1214 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: srli a1, a1, 16
1215 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: add a0, a0, a2
1216 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: add a0, a0, a1
1217 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: add a0, a0, a5
1218 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: xor a1, a4, t1
1219 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: xor a2, a3, t0
1220 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: add a0, a0, a7
1221 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: or a1, a2, a1
1222 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: seqz a1, a1
1223 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: add a0, a0, a6
1224 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: add a0, a1, a0
1225 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: ret
1227 ; ILP32E-WITHFP-SAVE-RESTORE-LABEL: callee_many_scalars:
1228 ; ILP32E-WITHFP-SAVE-RESTORE: # %bb.0:
1229 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call t0, __riscv_save_1
1230 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
1231 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset ra, -4
1232 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset s0, -8
1233 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi s0, sp, 8
1234 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa s0, 0
1235 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lw a6, 12(s0)
1236 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lw a7, 0(s0)
1237 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lw t0, 4(s0)
1238 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lw t1, 8(s0)
1239 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: andi a0, a0, 255
1240 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: slli a1, a1, 16
1241 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: srli a1, a1, 16
1242 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: add a0, a0, a2
1243 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: add a0, a0, a1
1244 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: add a0, a0, a5
1245 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: xor a1, a4, t1
1246 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: xor a2, a3, t0
1247 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: add a0, a0, a7
1248 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: or a1, a2, a1
1249 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: seqz a1, a1
1250 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: add a0, a0, a6
1251 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: add a0, a1, a0
1252 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 8
1253 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1
1254 %a_ext = zext i8 %a to i32
1255 %b_ext = zext i16 %b to i32
1256 %1 = add i32 %a_ext, %b_ext
1258 %3 = icmp eq i64 %d, %g
1259 %4 = zext i1 %3 to i32
1267 define i32 @caller_many_scalars() {
1268 ; ILP32E-FPELIM-LABEL: caller_many_scalars:
1269 ; ILP32E-FPELIM: # %bb.0:
1270 ; ILP32E-FPELIM-NEXT: addi sp, sp, -20
1271 ; ILP32E-FPELIM-NEXT: .cfi_def_cfa_offset 20
1272 ; ILP32E-FPELIM-NEXT: sw ra, 16(sp) # 4-byte Folded Spill
1273 ; ILP32E-FPELIM-NEXT: .cfi_offset ra, -4
1274 ; ILP32E-FPELIM-NEXT: li a4, 8
1275 ; ILP32E-FPELIM-NEXT: li a6, 7
1276 ; ILP32E-FPELIM-NEXT: li a7, 6
1277 ; ILP32E-FPELIM-NEXT: li a0, 1
1278 ; ILP32E-FPELIM-NEXT: li a1, 2
1279 ; ILP32E-FPELIM-NEXT: li a2, 3
1280 ; ILP32E-FPELIM-NEXT: li a3, 4
1281 ; ILP32E-FPELIM-NEXT: li a5, 5
1282 ; ILP32E-FPELIM-NEXT: sw a7, 0(sp)
1283 ; ILP32E-FPELIM-NEXT: sw a6, 4(sp)
1284 ; ILP32E-FPELIM-NEXT: sw zero, 8(sp)
1285 ; ILP32E-FPELIM-NEXT: sw a4, 12(sp)
1286 ; ILP32E-FPELIM-NEXT: li a4, 0
1287 ; ILP32E-FPELIM-NEXT: call callee_many_scalars
1288 ; ILP32E-FPELIM-NEXT: lw ra, 16(sp) # 4-byte Folded Reload
1289 ; ILP32E-FPELIM-NEXT: .cfi_restore ra
1290 ; ILP32E-FPELIM-NEXT: addi sp, sp, 20
1291 ; ILP32E-FPELIM-NEXT: .cfi_def_cfa_offset 0
1292 ; ILP32E-FPELIM-NEXT: ret
1294 ; ILP32E-WITHFP-LABEL: caller_many_scalars:
1295 ; ILP32E-WITHFP: # %bb.0:
1296 ; ILP32E-WITHFP-NEXT: addi sp, sp, -24
1297 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 24
1298 ; ILP32E-WITHFP-NEXT: sw ra, 20(sp) # 4-byte Folded Spill
1299 ; ILP32E-WITHFP-NEXT: sw s0, 16(sp) # 4-byte Folded Spill
1300 ; ILP32E-WITHFP-NEXT: .cfi_offset ra, -4
1301 ; ILP32E-WITHFP-NEXT: .cfi_offset s0, -8
1302 ; ILP32E-WITHFP-NEXT: addi s0, sp, 24
1303 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0
1304 ; ILP32E-WITHFP-NEXT: li a4, 8
1305 ; ILP32E-WITHFP-NEXT: li a6, 7
1306 ; ILP32E-WITHFP-NEXT: li a7, 6
1307 ; ILP32E-WITHFP-NEXT: li a0, 1
1308 ; ILP32E-WITHFP-NEXT: li a1, 2
1309 ; ILP32E-WITHFP-NEXT: li a2, 3
1310 ; ILP32E-WITHFP-NEXT: li a3, 4
1311 ; ILP32E-WITHFP-NEXT: li a5, 5
1312 ; ILP32E-WITHFP-NEXT: sw a7, 0(sp)
1313 ; ILP32E-WITHFP-NEXT: sw a6, 4(sp)
1314 ; ILP32E-WITHFP-NEXT: sw zero, 8(sp)
1315 ; ILP32E-WITHFP-NEXT: sw a4, 12(sp)
1316 ; ILP32E-WITHFP-NEXT: li a4, 0
1317 ; ILP32E-WITHFP-NEXT: call callee_many_scalars
1318 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 24
1319 ; ILP32E-WITHFP-NEXT: lw ra, 20(sp) # 4-byte Folded Reload
1320 ; ILP32E-WITHFP-NEXT: lw s0, 16(sp) # 4-byte Folded Reload
1321 ; ILP32E-WITHFP-NEXT: .cfi_restore ra
1322 ; ILP32E-WITHFP-NEXT: .cfi_restore s0
1323 ; ILP32E-WITHFP-NEXT: addi sp, sp, 24
1324 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 0
1325 ; ILP32E-WITHFP-NEXT: ret
1327 ; ILP32E-FPELIM-SAVE-RESTORE-LABEL: caller_many_scalars:
1328 ; ILP32E-FPELIM-SAVE-RESTORE: # %bb.0:
1329 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: call t0, __riscv_save_0
1330 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 4
1331 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_offset ra, -4
1332 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: addi sp, sp, -16
1333 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 20
1334 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li a4, 8
1335 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li a6, 7
1336 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li a7, 6
1337 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li a0, 1
1338 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li a1, 2
1339 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li a2, 3
1340 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li a3, 4
1341 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li a5, 5
1342 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw a7, 0(sp)
1343 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw a6, 4(sp)
1344 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw zero, 8(sp)
1345 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw a4, 12(sp)
1346 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li a4, 0
1347 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: call callee_many_scalars
1348 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: addi sp, sp, 16
1349 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 4
1350 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: tail __riscv_restore_0
1352 ; ILP32E-WITHFP-SAVE-RESTORE-LABEL: caller_many_scalars:
1353 ; ILP32E-WITHFP-SAVE-RESTORE: # %bb.0:
1354 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call t0, __riscv_save_1
1355 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
1356 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset ra, -4
1357 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset s0, -8
1358 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi sp, sp, -16
1359 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 24
1360 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi s0, sp, 24
1361 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa s0, 0
1362 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a4, 8
1363 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a6, 7
1364 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a7, 6
1365 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a0, 1
1366 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a1, 2
1367 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a2, 3
1368 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a3, 4
1369 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a5, 5
1370 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw a7, 0(sp)
1371 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw a6, 4(sp)
1372 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw zero, 8(sp)
1373 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw a4, 12(sp)
1374 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a4, 0
1375 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call callee_many_scalars
1376 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 24
1377 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi sp, sp, 16
1378 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
1379 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1
1380 %1 = call i32 @callee_many_scalars(i8 1, i16 2, i32 3, i64 4, i32 5, i32 6, i64 7, i32 8)
1384 ; Check that i128 and fp128 are passed indirectly
1386 define i32 @callee_large_scalars(i128 %a, fp128 %b) {
1387 ; ILP32E-FPELIM-LABEL: callee_large_scalars:
1388 ; ILP32E-FPELIM: # %bb.0:
1389 ; ILP32E-FPELIM-NEXT: lw a2, 0(a1)
1390 ; ILP32E-FPELIM-NEXT: lw a3, 4(a1)
1391 ; ILP32E-FPELIM-NEXT: lw a4, 8(a1)
1392 ; ILP32E-FPELIM-NEXT: lw a1, 12(a1)
1393 ; ILP32E-FPELIM-NEXT: lw a5, 12(a0)
1394 ; ILP32E-FPELIM-NEXT: lw a6, 4(a0)
1395 ; ILP32E-FPELIM-NEXT: lw a7, 8(a0)
1396 ; ILP32E-FPELIM-NEXT: lw a0, 0(a0)
1397 ; ILP32E-FPELIM-NEXT: xor a1, a5, a1
1398 ; ILP32E-FPELIM-NEXT: xor a3, a6, a3
1399 ; ILP32E-FPELIM-NEXT: xor a4, a7, a4
1400 ; ILP32E-FPELIM-NEXT: xor a0, a0, a2
1401 ; ILP32E-FPELIM-NEXT: or a1, a3, a1
1402 ; ILP32E-FPELIM-NEXT: or a0, a0, a4
1403 ; ILP32E-FPELIM-NEXT: or a0, a0, a1
1404 ; ILP32E-FPELIM-NEXT: seqz a0, a0
1405 ; ILP32E-FPELIM-NEXT: ret
1407 ; ILP32E-WITHFP-LABEL: callee_large_scalars:
1408 ; ILP32E-WITHFP: # %bb.0:
1409 ; ILP32E-WITHFP-NEXT: addi sp, sp, -8
1410 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 8
1411 ; ILP32E-WITHFP-NEXT: sw ra, 4(sp) # 4-byte Folded Spill
1412 ; ILP32E-WITHFP-NEXT: sw s0, 0(sp) # 4-byte Folded Spill
1413 ; ILP32E-WITHFP-NEXT: .cfi_offset ra, -4
1414 ; ILP32E-WITHFP-NEXT: .cfi_offset s0, -8
1415 ; ILP32E-WITHFP-NEXT: addi s0, sp, 8
1416 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0
1417 ; ILP32E-WITHFP-NEXT: lw a2, 0(a1)
1418 ; ILP32E-WITHFP-NEXT: lw a3, 4(a1)
1419 ; ILP32E-WITHFP-NEXT: lw a4, 8(a1)
1420 ; ILP32E-WITHFP-NEXT: lw a1, 12(a1)
1421 ; ILP32E-WITHFP-NEXT: lw a5, 12(a0)
1422 ; ILP32E-WITHFP-NEXT: lw a6, 4(a0)
1423 ; ILP32E-WITHFP-NEXT: lw a7, 8(a0)
1424 ; ILP32E-WITHFP-NEXT: lw a0, 0(a0)
1425 ; ILP32E-WITHFP-NEXT: xor a1, a5, a1
1426 ; ILP32E-WITHFP-NEXT: xor a3, a6, a3
1427 ; ILP32E-WITHFP-NEXT: xor a4, a7, a4
1428 ; ILP32E-WITHFP-NEXT: xor a0, a0, a2
1429 ; ILP32E-WITHFP-NEXT: or a1, a3, a1
1430 ; ILP32E-WITHFP-NEXT: or a0, a0, a4
1431 ; ILP32E-WITHFP-NEXT: or a0, a0, a1
1432 ; ILP32E-WITHFP-NEXT: seqz a0, a0
1433 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 8
1434 ; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload
1435 ; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload
1436 ; ILP32E-WITHFP-NEXT: .cfi_restore ra
1437 ; ILP32E-WITHFP-NEXT: .cfi_restore s0
1438 ; ILP32E-WITHFP-NEXT: addi sp, sp, 8
1439 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 0
1440 ; ILP32E-WITHFP-NEXT: ret
1442 ; ILP32E-FPELIM-SAVE-RESTORE-LABEL: callee_large_scalars:
1443 ; ILP32E-FPELIM-SAVE-RESTORE: # %bb.0:
1444 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: lw a2, 0(a1)
1445 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: lw a3, 4(a1)
1446 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: lw a4, 8(a1)
1447 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: lw a1, 12(a1)
1448 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: lw a5, 12(a0)
1449 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: lw a6, 4(a0)
1450 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: lw a7, 8(a0)
1451 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: lw a0, 0(a0)
1452 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: xor a1, a5, a1
1453 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: xor a3, a6, a3
1454 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: xor a4, a7, a4
1455 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: xor a0, a0, a2
1456 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: or a1, a3, a1
1457 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: or a0, a0, a4
1458 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: or a0, a0, a1
1459 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: seqz a0, a0
1460 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: ret
1462 ; ILP32E-WITHFP-SAVE-RESTORE-LABEL: callee_large_scalars:
1463 ; ILP32E-WITHFP-SAVE-RESTORE: # %bb.0:
1464 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call t0, __riscv_save_1
1465 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
1466 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset ra, -4
1467 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset s0, -8
1468 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi s0, sp, 8
1469 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa s0, 0
1470 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lw a2, 0(a1)
1471 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lw a3, 4(a1)
1472 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lw a4, 8(a1)
1473 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lw a1, 12(a1)
1474 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lw a5, 12(a0)
1475 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lw a6, 4(a0)
1476 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lw a7, 8(a0)
1477 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lw a0, 0(a0)
1478 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: xor a1, a5, a1
1479 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: xor a3, a6, a3
1480 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: xor a4, a7, a4
1481 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: xor a0, a0, a2
1482 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: or a1, a3, a1
1483 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: or a0, a0, a4
1484 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: or a0, a0, a1
1485 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: seqz a0, a0
1486 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 8
1487 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1
1488 %b_bitcast = bitcast fp128 %b to i128
1489 %1 = icmp eq i128 %a, %b_bitcast
1490 %2 = zext i1 %1 to i32
1494 define i32 @caller_large_scalars() {
1495 ; ILP32E-FPELIM-LABEL: caller_large_scalars:
1496 ; ILP32E-FPELIM: # %bb.0:
1497 ; ILP32E-FPELIM-NEXT: addi sp, sp, -48
1498 ; ILP32E-FPELIM-NEXT: .cfi_def_cfa_offset 48
1499 ; ILP32E-FPELIM-NEXT: sw ra, 44(sp) # 4-byte Folded Spill
1500 ; ILP32E-FPELIM-NEXT: sw s0, 40(sp) # 4-byte Folded Spill
1501 ; ILP32E-FPELIM-NEXT: .cfi_offset ra, -4
1502 ; ILP32E-FPELIM-NEXT: .cfi_offset s0, -8
1503 ; ILP32E-FPELIM-NEXT: addi s0, sp, 48
1504 ; ILP32E-FPELIM-NEXT: .cfi_def_cfa s0, 0
1505 ; ILP32E-FPELIM-NEXT: andi sp, sp, -16
1506 ; ILP32E-FPELIM-NEXT: lui a1, 524272
1507 ; ILP32E-FPELIM-NEXT: li a2, 1
1508 ; ILP32E-FPELIM-NEXT: addi a0, sp, 24
1509 ; ILP32E-FPELIM-NEXT: sw zero, 0(sp)
1510 ; ILP32E-FPELIM-NEXT: sw zero, 4(sp)
1511 ; ILP32E-FPELIM-NEXT: sw zero, 8(sp)
1512 ; ILP32E-FPELIM-NEXT: sw a1, 12(sp)
1513 ; ILP32E-FPELIM-NEXT: mv a1, sp
1514 ; ILP32E-FPELIM-NEXT: sw a2, 24(sp)
1515 ; ILP32E-FPELIM-NEXT: sw zero, 28(sp)
1516 ; ILP32E-FPELIM-NEXT: sw zero, 32(sp)
1517 ; ILP32E-FPELIM-NEXT: sw zero, 36(sp)
1518 ; ILP32E-FPELIM-NEXT: call callee_large_scalars
1519 ; ILP32E-FPELIM-NEXT: addi sp, s0, -48
1520 ; ILP32E-FPELIM-NEXT: .cfi_def_cfa sp, 48
1521 ; ILP32E-FPELIM-NEXT: lw ra, 44(sp) # 4-byte Folded Reload
1522 ; ILP32E-FPELIM-NEXT: lw s0, 40(sp) # 4-byte Folded Reload
1523 ; ILP32E-FPELIM-NEXT: .cfi_restore ra
1524 ; ILP32E-FPELIM-NEXT: .cfi_restore s0
1525 ; ILP32E-FPELIM-NEXT: addi sp, sp, 48
1526 ; ILP32E-FPELIM-NEXT: .cfi_def_cfa_offset 0
1527 ; ILP32E-FPELIM-NEXT: ret
1529 ; ILP32E-WITHFP-LABEL: caller_large_scalars:
1530 ; ILP32E-WITHFP: # %bb.0:
1531 ; ILP32E-WITHFP-NEXT: addi sp, sp, -48
1532 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 48
1533 ; ILP32E-WITHFP-NEXT: sw ra, 44(sp) # 4-byte Folded Spill
1534 ; ILP32E-WITHFP-NEXT: sw s0, 40(sp) # 4-byte Folded Spill
1535 ; ILP32E-WITHFP-NEXT: .cfi_offset ra, -4
1536 ; ILP32E-WITHFP-NEXT: .cfi_offset s0, -8
1537 ; ILP32E-WITHFP-NEXT: addi s0, sp, 48
1538 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0
1539 ; ILP32E-WITHFP-NEXT: andi sp, sp, -16
1540 ; ILP32E-WITHFP-NEXT: lui a1, 524272
1541 ; ILP32E-WITHFP-NEXT: li a2, 1
1542 ; ILP32E-WITHFP-NEXT: addi a0, sp, 24
1543 ; ILP32E-WITHFP-NEXT: sw zero, 0(sp)
1544 ; ILP32E-WITHFP-NEXT: sw zero, 4(sp)
1545 ; ILP32E-WITHFP-NEXT: sw zero, 8(sp)
1546 ; ILP32E-WITHFP-NEXT: sw a1, 12(sp)
1547 ; ILP32E-WITHFP-NEXT: mv a1, sp
1548 ; ILP32E-WITHFP-NEXT: sw a2, 24(sp)
1549 ; ILP32E-WITHFP-NEXT: sw zero, 28(sp)
1550 ; ILP32E-WITHFP-NEXT: sw zero, 32(sp)
1551 ; ILP32E-WITHFP-NEXT: sw zero, 36(sp)
1552 ; ILP32E-WITHFP-NEXT: call callee_large_scalars
1553 ; ILP32E-WITHFP-NEXT: addi sp, s0, -48
1554 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 48
1555 ; ILP32E-WITHFP-NEXT: lw ra, 44(sp) # 4-byte Folded Reload
1556 ; ILP32E-WITHFP-NEXT: lw s0, 40(sp) # 4-byte Folded Reload
1557 ; ILP32E-WITHFP-NEXT: .cfi_restore ra
1558 ; ILP32E-WITHFP-NEXT: .cfi_restore s0
1559 ; ILP32E-WITHFP-NEXT: addi sp, sp, 48
1560 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 0
1561 ; ILP32E-WITHFP-NEXT: ret
1563 ; ILP32E-FPELIM-SAVE-RESTORE-LABEL: caller_large_scalars:
1564 ; ILP32E-FPELIM-SAVE-RESTORE: # %bb.0:
1565 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: call t0, __riscv_save_1
1566 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
1567 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_offset ra, -4
1568 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_offset s0, -8
1569 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: addi sp, sp, -40
1570 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 48
1571 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: addi s0, sp, 48
1572 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_def_cfa s0, 0
1573 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: andi sp, sp, -16
1574 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: lui a1, 524272
1575 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li a2, 1
1576 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: addi a0, sp, 24
1577 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw zero, 0(sp)
1578 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw zero, 4(sp)
1579 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw zero, 8(sp)
1580 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw a1, 12(sp)
1581 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: mv a1, sp
1582 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw a2, 24(sp)
1583 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw zero, 28(sp)
1584 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw zero, 32(sp)
1585 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw zero, 36(sp)
1586 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: call callee_large_scalars
1587 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: addi sp, s0, -48
1588 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 48
1589 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: addi sp, sp, 40
1590 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
1591 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: tail __riscv_restore_1
1593 ; ILP32E-WITHFP-SAVE-RESTORE-LABEL: caller_large_scalars:
1594 ; ILP32E-WITHFP-SAVE-RESTORE: # %bb.0:
1595 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call t0, __riscv_save_1
1596 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
1597 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset ra, -4
1598 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset s0, -8
1599 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi sp, sp, -40
1600 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 48
1601 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi s0, sp, 48
1602 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa s0, 0
1603 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: andi sp, sp, -16
1604 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lui a1, 524272
1605 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a2, 1
1606 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi a0, sp, 24
1607 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw zero, 0(sp)
1608 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw zero, 4(sp)
1609 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw zero, 8(sp)
1610 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw a1, 12(sp)
1611 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: mv a1, sp
1612 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw a2, 24(sp)
1613 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw zero, 28(sp)
1614 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw zero, 32(sp)
1615 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw zero, 36(sp)
1616 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call callee_large_scalars
1617 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi sp, s0, -48
1618 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 48
1619 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi sp, sp, 40
1620 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
1621 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1
1622 %1 = call i32 @callee_large_scalars(i128 1, fp128 0xL00000000000000007FFF000000000000)
1626 ; Check that arguments larger than 2*xlen are handled correctly when their
1627 ; address is passed on the stack rather than in memory
1629 ; Must keep define on a single line due to an update_llc_test_checks.py limitation
1630 define i32 @callee_large_scalars_exhausted_regs(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e, i32 %f, i32 %g, i128 %h, i32 %i, fp128 %j) {
1631 ; ILP32E-FPELIM-LABEL: callee_large_scalars_exhausted_regs:
1632 ; ILP32E-FPELIM: # %bb.0:
1633 ; ILP32E-FPELIM-NEXT: lw a0, 12(sp)
1634 ; ILP32E-FPELIM-NEXT: lw a1, 4(sp)
1635 ; ILP32E-FPELIM-NEXT: lw a2, 0(a0)
1636 ; ILP32E-FPELIM-NEXT: lw a3, 4(a0)
1637 ; ILP32E-FPELIM-NEXT: lw a4, 8(a0)
1638 ; ILP32E-FPELIM-NEXT: lw a0, 12(a0)
1639 ; ILP32E-FPELIM-NEXT: lw a5, 12(a1)
1640 ; ILP32E-FPELIM-NEXT: lw a6, 4(a1)
1641 ; ILP32E-FPELIM-NEXT: lw a7, 8(a1)
1642 ; ILP32E-FPELIM-NEXT: lw a1, 0(a1)
1643 ; ILP32E-FPELIM-NEXT: xor a0, a5, a0
1644 ; ILP32E-FPELIM-NEXT: xor a3, a6, a3
1645 ; ILP32E-FPELIM-NEXT: xor a4, a7, a4
1646 ; ILP32E-FPELIM-NEXT: xor a1, a1, a2
1647 ; ILP32E-FPELIM-NEXT: or a0, a3, a0
1648 ; ILP32E-FPELIM-NEXT: or a1, a1, a4
1649 ; ILP32E-FPELIM-NEXT: or a0, a1, a0
1650 ; ILP32E-FPELIM-NEXT: seqz a0, a0
1651 ; ILP32E-FPELIM-NEXT: ret
1653 ; ILP32E-WITHFP-LABEL: callee_large_scalars_exhausted_regs:
1654 ; ILP32E-WITHFP: # %bb.0:
1655 ; ILP32E-WITHFP-NEXT: addi sp, sp, -8
1656 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 8
1657 ; ILP32E-WITHFP-NEXT: sw ra, 4(sp) # 4-byte Folded Spill
1658 ; ILP32E-WITHFP-NEXT: sw s0, 0(sp) # 4-byte Folded Spill
1659 ; ILP32E-WITHFP-NEXT: .cfi_offset ra, -4
1660 ; ILP32E-WITHFP-NEXT: .cfi_offset s0, -8
1661 ; ILP32E-WITHFP-NEXT: addi s0, sp, 8
1662 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0
1663 ; ILP32E-WITHFP-NEXT: lw a0, 12(s0)
1664 ; ILP32E-WITHFP-NEXT: lw a1, 4(s0)
1665 ; ILP32E-WITHFP-NEXT: lw a2, 0(a0)
1666 ; ILP32E-WITHFP-NEXT: lw a3, 4(a0)
1667 ; ILP32E-WITHFP-NEXT: lw a4, 8(a0)
1668 ; ILP32E-WITHFP-NEXT: lw a0, 12(a0)
1669 ; ILP32E-WITHFP-NEXT: lw a5, 12(a1)
1670 ; ILP32E-WITHFP-NEXT: lw a6, 4(a1)
1671 ; ILP32E-WITHFP-NEXT: lw a7, 8(a1)
1672 ; ILP32E-WITHFP-NEXT: lw a1, 0(a1)
1673 ; ILP32E-WITHFP-NEXT: xor a0, a5, a0
1674 ; ILP32E-WITHFP-NEXT: xor a3, a6, a3
1675 ; ILP32E-WITHFP-NEXT: xor a4, a7, a4
1676 ; ILP32E-WITHFP-NEXT: xor a1, a1, a2
1677 ; ILP32E-WITHFP-NEXT: or a0, a3, a0
1678 ; ILP32E-WITHFP-NEXT: or a1, a1, a4
1679 ; ILP32E-WITHFP-NEXT: or a0, a1, a0
1680 ; ILP32E-WITHFP-NEXT: seqz a0, a0
1681 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 8
1682 ; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload
1683 ; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload
1684 ; ILP32E-WITHFP-NEXT: .cfi_restore ra
1685 ; ILP32E-WITHFP-NEXT: .cfi_restore s0
1686 ; ILP32E-WITHFP-NEXT: addi sp, sp, 8
1687 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 0
1688 ; ILP32E-WITHFP-NEXT: ret
1690 ; ILP32E-FPELIM-SAVE-RESTORE-LABEL: callee_large_scalars_exhausted_regs:
1691 ; ILP32E-FPELIM-SAVE-RESTORE: # %bb.0:
1692 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: lw a0, 12(sp)
1693 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: lw a1, 4(sp)
1694 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: lw a2, 0(a0)
1695 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: lw a3, 4(a0)
1696 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: lw a4, 8(a0)
1697 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: lw a0, 12(a0)
1698 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: lw a5, 12(a1)
1699 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: lw a6, 4(a1)
1700 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: lw a7, 8(a1)
1701 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: lw a1, 0(a1)
1702 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: xor a0, a5, a0
1703 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: xor a3, a6, a3
1704 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: xor a4, a7, a4
1705 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: xor a1, a1, a2
1706 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: or a0, a3, a0
1707 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: or a1, a1, a4
1708 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: or a0, a1, a0
1709 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: seqz a0, a0
1710 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: ret
1712 ; ILP32E-WITHFP-SAVE-RESTORE-LABEL: callee_large_scalars_exhausted_regs:
1713 ; ILP32E-WITHFP-SAVE-RESTORE: # %bb.0:
1714 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call t0, __riscv_save_1
1715 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
1716 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset ra, -4
1717 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset s0, -8
1718 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi s0, sp, 8
1719 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa s0, 0
1720 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lw a0, 12(s0)
1721 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lw a1, 4(s0)
1722 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lw a2, 0(a0)
1723 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lw a3, 4(a0)
1724 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lw a4, 8(a0)
1725 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lw a0, 12(a0)
1726 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lw a5, 12(a1)
1727 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lw a6, 4(a1)
1728 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lw a7, 8(a1)
1729 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lw a1, 0(a1)
1730 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: xor a0, a5, a0
1731 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: xor a3, a6, a3
1732 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: xor a4, a7, a4
1733 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: xor a1, a1, a2
1734 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: or a0, a3, a0
1735 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: or a1, a1, a4
1736 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: or a0, a1, a0
1737 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: seqz a0, a0
1738 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 8
1739 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1
1740 %j_bitcast = bitcast fp128 %j to i128
1741 %1 = icmp eq i128 %h, %j_bitcast
1742 %2 = zext i1 %1 to i32
1746 define i32 @caller_large_scalars_exhausted_regs() {
1747 ; ILP32E-FPELIM-LABEL: caller_large_scalars_exhausted_regs:
1748 ; ILP32E-FPELIM: # %bb.0:
1749 ; ILP32E-FPELIM-NEXT: addi sp, sp, -64
1750 ; ILP32E-FPELIM-NEXT: .cfi_def_cfa_offset 64
1751 ; ILP32E-FPELIM-NEXT: sw ra, 60(sp) # 4-byte Folded Spill
1752 ; ILP32E-FPELIM-NEXT: sw s0, 56(sp) # 4-byte Folded Spill
1753 ; ILP32E-FPELIM-NEXT: .cfi_offset ra, -4
1754 ; ILP32E-FPELIM-NEXT: .cfi_offset s0, -8
1755 ; ILP32E-FPELIM-NEXT: addi s0, sp, 64
1756 ; ILP32E-FPELIM-NEXT: .cfi_def_cfa s0, 0
1757 ; ILP32E-FPELIM-NEXT: andi sp, sp, -16
1758 ; ILP32E-FPELIM-NEXT: addi a4, sp, 16
1759 ; ILP32E-FPELIM-NEXT: li a5, 9
1760 ; ILP32E-FPELIM-NEXT: addi a6, sp, 40
1761 ; ILP32E-FPELIM-NEXT: li a7, 7
1762 ; ILP32E-FPELIM-NEXT: lui t0, 524272
1763 ; ILP32E-FPELIM-NEXT: li t1, 8
1764 ; ILP32E-FPELIM-NEXT: li a0, 1
1765 ; ILP32E-FPELIM-NEXT: li a1, 2
1766 ; ILP32E-FPELIM-NEXT: li a2, 3
1767 ; ILP32E-FPELIM-NEXT: li a3, 4
1768 ; ILP32E-FPELIM-NEXT: sw a7, 0(sp)
1769 ; ILP32E-FPELIM-NEXT: sw a6, 4(sp)
1770 ; ILP32E-FPELIM-NEXT: sw a5, 8(sp)
1771 ; ILP32E-FPELIM-NEXT: sw a4, 12(sp)
1772 ; ILP32E-FPELIM-NEXT: li a4, 5
1773 ; ILP32E-FPELIM-NEXT: sw zero, 16(sp)
1774 ; ILP32E-FPELIM-NEXT: sw zero, 20(sp)
1775 ; ILP32E-FPELIM-NEXT: sw zero, 24(sp)
1776 ; ILP32E-FPELIM-NEXT: sw t0, 28(sp)
1777 ; ILP32E-FPELIM-NEXT: li a5, 6
1778 ; ILP32E-FPELIM-NEXT: sw t1, 40(sp)
1779 ; ILP32E-FPELIM-NEXT: sw zero, 44(sp)
1780 ; ILP32E-FPELIM-NEXT: sw zero, 48(sp)
1781 ; ILP32E-FPELIM-NEXT: sw zero, 52(sp)
1782 ; ILP32E-FPELIM-NEXT: call callee_large_scalars_exhausted_regs
1783 ; ILP32E-FPELIM-NEXT: addi sp, s0, -64
1784 ; ILP32E-FPELIM-NEXT: .cfi_def_cfa sp, 64
1785 ; ILP32E-FPELIM-NEXT: lw ra, 60(sp) # 4-byte Folded Reload
1786 ; ILP32E-FPELIM-NEXT: lw s0, 56(sp) # 4-byte Folded Reload
1787 ; ILP32E-FPELIM-NEXT: .cfi_restore ra
1788 ; ILP32E-FPELIM-NEXT: .cfi_restore s0
1789 ; ILP32E-FPELIM-NEXT: addi sp, sp, 64
1790 ; ILP32E-FPELIM-NEXT: .cfi_def_cfa_offset 0
1791 ; ILP32E-FPELIM-NEXT: ret
1793 ; ILP32E-WITHFP-LABEL: caller_large_scalars_exhausted_regs:
1794 ; ILP32E-WITHFP: # %bb.0:
1795 ; ILP32E-WITHFP-NEXT: addi sp, sp, -64
1796 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 64
1797 ; ILP32E-WITHFP-NEXT: sw ra, 60(sp) # 4-byte Folded Spill
1798 ; ILP32E-WITHFP-NEXT: sw s0, 56(sp) # 4-byte Folded Spill
1799 ; ILP32E-WITHFP-NEXT: .cfi_offset ra, -4
1800 ; ILP32E-WITHFP-NEXT: .cfi_offset s0, -8
1801 ; ILP32E-WITHFP-NEXT: addi s0, sp, 64
1802 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0
1803 ; ILP32E-WITHFP-NEXT: andi sp, sp, -16
1804 ; ILP32E-WITHFP-NEXT: addi a4, sp, 16
1805 ; ILP32E-WITHFP-NEXT: li a5, 9
1806 ; ILP32E-WITHFP-NEXT: addi a6, sp, 40
1807 ; ILP32E-WITHFP-NEXT: li a7, 7
1808 ; ILP32E-WITHFP-NEXT: lui t0, 524272
1809 ; ILP32E-WITHFP-NEXT: li t1, 8
1810 ; ILP32E-WITHFP-NEXT: li a0, 1
1811 ; ILP32E-WITHFP-NEXT: li a1, 2
1812 ; ILP32E-WITHFP-NEXT: li a2, 3
1813 ; ILP32E-WITHFP-NEXT: li a3, 4
1814 ; ILP32E-WITHFP-NEXT: sw a7, 0(sp)
1815 ; ILP32E-WITHFP-NEXT: sw a6, 4(sp)
1816 ; ILP32E-WITHFP-NEXT: sw a5, 8(sp)
1817 ; ILP32E-WITHFP-NEXT: sw a4, 12(sp)
1818 ; ILP32E-WITHFP-NEXT: li a4, 5
1819 ; ILP32E-WITHFP-NEXT: sw zero, 16(sp)
1820 ; ILP32E-WITHFP-NEXT: sw zero, 20(sp)
1821 ; ILP32E-WITHFP-NEXT: sw zero, 24(sp)
1822 ; ILP32E-WITHFP-NEXT: sw t0, 28(sp)
1823 ; ILP32E-WITHFP-NEXT: li a5, 6
1824 ; ILP32E-WITHFP-NEXT: sw t1, 40(sp)
1825 ; ILP32E-WITHFP-NEXT: sw zero, 44(sp)
1826 ; ILP32E-WITHFP-NEXT: sw zero, 48(sp)
1827 ; ILP32E-WITHFP-NEXT: sw zero, 52(sp)
1828 ; ILP32E-WITHFP-NEXT: call callee_large_scalars_exhausted_regs
1829 ; ILP32E-WITHFP-NEXT: addi sp, s0, -64
1830 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 64
1831 ; ILP32E-WITHFP-NEXT: lw ra, 60(sp) # 4-byte Folded Reload
1832 ; ILP32E-WITHFP-NEXT: lw s0, 56(sp) # 4-byte Folded Reload
1833 ; ILP32E-WITHFP-NEXT: .cfi_restore ra
1834 ; ILP32E-WITHFP-NEXT: .cfi_restore s0
1835 ; ILP32E-WITHFP-NEXT: addi sp, sp, 64
1836 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 0
1837 ; ILP32E-WITHFP-NEXT: ret
1839 ; ILP32E-FPELIM-SAVE-RESTORE-LABEL: caller_large_scalars_exhausted_regs:
1840 ; ILP32E-FPELIM-SAVE-RESTORE: # %bb.0:
1841 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: call t0, __riscv_save_1
1842 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
1843 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_offset ra, -4
1844 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_offset s0, -8
1845 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: addi sp, sp, -56
1846 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 64
1847 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: addi s0, sp, 64
1848 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_def_cfa s0, 0
1849 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: andi sp, sp, -16
1850 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: addi a4, sp, 16
1851 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li a5, 9
1852 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: addi a6, sp, 40
1853 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li a7, 7
1854 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: lui t0, 524272
1855 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li t1, 8
1856 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li a0, 1
1857 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li a1, 2
1858 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li a2, 3
1859 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li a3, 4
1860 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw a7, 0(sp)
1861 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw a6, 4(sp)
1862 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw a5, 8(sp)
1863 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw a4, 12(sp)
1864 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li a4, 5
1865 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw zero, 16(sp)
1866 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw zero, 20(sp)
1867 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw zero, 24(sp)
1868 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw t0, 28(sp)
1869 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li a5, 6
1870 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw t1, 40(sp)
1871 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw zero, 44(sp)
1872 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw zero, 48(sp)
1873 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw zero, 52(sp)
1874 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: call callee_large_scalars_exhausted_regs
1875 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: addi sp, s0, -64
1876 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 64
1877 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: addi sp, sp, 56
1878 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
1879 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: tail __riscv_restore_1
1881 ; ILP32E-WITHFP-SAVE-RESTORE-LABEL: caller_large_scalars_exhausted_regs:
1882 ; ILP32E-WITHFP-SAVE-RESTORE: # %bb.0:
1883 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call t0, __riscv_save_1
1884 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
1885 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset ra, -4
1886 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset s0, -8
1887 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi sp, sp, -56
1888 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 64
1889 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi s0, sp, 64
1890 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa s0, 0
1891 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: andi sp, sp, -16
1892 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi a4, sp, 16
1893 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a5, 9
1894 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi a6, sp, 40
1895 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a7, 7
1896 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lui t0, 524272
1897 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li t1, 8
1898 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a0, 1
1899 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a1, 2
1900 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a2, 3
1901 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a3, 4
1902 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw a7, 0(sp)
1903 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw a6, 4(sp)
1904 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw a5, 8(sp)
1905 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw a4, 12(sp)
1906 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a4, 5
1907 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw zero, 16(sp)
1908 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw zero, 20(sp)
1909 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw zero, 24(sp)
1910 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw t0, 28(sp)
1911 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a5, 6
1912 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw t1, 40(sp)
1913 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw zero, 44(sp)
1914 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw zero, 48(sp)
1915 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw zero, 52(sp)
1916 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call callee_large_scalars_exhausted_regs
1917 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi sp, s0, -64
1918 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 64
1919 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi sp, sp, 56
1920 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
1921 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1
1922 %1 = call i32 @callee_large_scalars_exhausted_regs(
1923 i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i128 8, i32 9,
1924 fp128 0xL00000000000000007FFF000000000000)
1928 ; Ensure that libcalls generated in the middle-end obey the calling convention
1930 define i32 @caller_mixed_scalar_libcalls(i64 %a) {
1931 ; ILP32E-FPELIM-LABEL: caller_mixed_scalar_libcalls:
1932 ; ILP32E-FPELIM: # %bb.0:
1933 ; ILP32E-FPELIM-NEXT: addi sp, sp, -24
1934 ; ILP32E-FPELIM-NEXT: .cfi_def_cfa_offset 24
1935 ; ILP32E-FPELIM-NEXT: sw ra, 20(sp) # 4-byte Folded Spill
1936 ; ILP32E-FPELIM-NEXT: sw s0, 16(sp) # 4-byte Folded Spill
1937 ; ILP32E-FPELIM-NEXT: .cfi_offset ra, -4
1938 ; ILP32E-FPELIM-NEXT: .cfi_offset s0, -8
1939 ; ILP32E-FPELIM-NEXT: addi s0, sp, 24
1940 ; ILP32E-FPELIM-NEXT: .cfi_def_cfa s0, 0
1941 ; ILP32E-FPELIM-NEXT: andi sp, sp, -8
1942 ; ILP32E-FPELIM-NEXT: mv a2, a1
1943 ; ILP32E-FPELIM-NEXT: mv a1, a0
1944 ; ILP32E-FPELIM-NEXT: mv a0, sp
1945 ; ILP32E-FPELIM-NEXT: call __floatditf
1946 ; ILP32E-FPELIM-NEXT: lw a0, 0(sp)
1947 ; ILP32E-FPELIM-NEXT: addi sp, s0, -24
1948 ; ILP32E-FPELIM-NEXT: .cfi_def_cfa sp, 24
1949 ; ILP32E-FPELIM-NEXT: lw ra, 20(sp) # 4-byte Folded Reload
1950 ; ILP32E-FPELIM-NEXT: lw s0, 16(sp) # 4-byte Folded Reload
1951 ; ILP32E-FPELIM-NEXT: .cfi_restore ra
1952 ; ILP32E-FPELIM-NEXT: .cfi_restore s0
1953 ; ILP32E-FPELIM-NEXT: addi sp, sp, 24
1954 ; ILP32E-FPELIM-NEXT: .cfi_def_cfa_offset 0
1955 ; ILP32E-FPELIM-NEXT: ret
1957 ; ILP32E-WITHFP-LABEL: caller_mixed_scalar_libcalls:
1958 ; ILP32E-WITHFP: # %bb.0:
1959 ; ILP32E-WITHFP-NEXT: addi sp, sp, -24
1960 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 24
1961 ; ILP32E-WITHFP-NEXT: sw ra, 20(sp) # 4-byte Folded Spill
1962 ; ILP32E-WITHFP-NEXT: sw s0, 16(sp) # 4-byte Folded Spill
1963 ; ILP32E-WITHFP-NEXT: .cfi_offset ra, -4
1964 ; ILP32E-WITHFP-NEXT: .cfi_offset s0, -8
1965 ; ILP32E-WITHFP-NEXT: addi s0, sp, 24
1966 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0
1967 ; ILP32E-WITHFP-NEXT: andi sp, sp, -8
1968 ; ILP32E-WITHFP-NEXT: mv a2, a1
1969 ; ILP32E-WITHFP-NEXT: mv a1, a0
1970 ; ILP32E-WITHFP-NEXT: mv a0, sp
1971 ; ILP32E-WITHFP-NEXT: call __floatditf
1972 ; ILP32E-WITHFP-NEXT: lw a0, 0(sp)
1973 ; ILP32E-WITHFP-NEXT: addi sp, s0, -24
1974 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 24
1975 ; ILP32E-WITHFP-NEXT: lw ra, 20(sp) # 4-byte Folded Reload
1976 ; ILP32E-WITHFP-NEXT: lw s0, 16(sp) # 4-byte Folded Reload
1977 ; ILP32E-WITHFP-NEXT: .cfi_restore ra
1978 ; ILP32E-WITHFP-NEXT: .cfi_restore s0
1979 ; ILP32E-WITHFP-NEXT: addi sp, sp, 24
1980 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 0
1981 ; ILP32E-WITHFP-NEXT: ret
1983 ; ILP32E-FPELIM-SAVE-RESTORE-LABEL: caller_mixed_scalar_libcalls:
1984 ; ILP32E-FPELIM-SAVE-RESTORE: # %bb.0:
1985 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: call t0, __riscv_save_1
1986 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
1987 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_offset ra, -4
1988 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_offset s0, -8
1989 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: addi sp, sp, -16
1990 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 24
1991 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: addi s0, sp, 24
1992 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_def_cfa s0, 0
1993 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: andi sp, sp, -8
1994 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: mv a2, a1
1995 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: mv a1, a0
1996 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: mv a0, sp
1997 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: call __floatditf
1998 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: lw a0, 0(sp)
1999 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: addi sp, s0, -24
2000 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 24
2001 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: addi sp, sp, 16
2002 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
2003 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: tail __riscv_restore_1
2005 ; ILP32E-WITHFP-SAVE-RESTORE-LABEL: caller_mixed_scalar_libcalls:
2006 ; ILP32E-WITHFP-SAVE-RESTORE: # %bb.0:
2007 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call t0, __riscv_save_1
2008 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
2009 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset ra, -4
2010 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset s0, -8
2011 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi sp, sp, -16
2012 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 24
2013 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi s0, sp, 24
2014 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa s0, 0
2015 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: andi sp, sp, -8
2016 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: mv a2, a1
2017 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: mv a1, a0
2018 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: mv a0, sp
2019 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call __floatditf
2020 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lw a0, 0(sp)
2021 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi sp, s0, -24
2022 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 24
2023 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi sp, sp, 16
2024 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
2025 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1
2026 %1 = sitofp i64 %a to fp128
2027 %2 = bitcast fp128 %1 to i128
2028 %3 = trunc i128 %2 to i32
2033 ; Check passing of coerced integer arrays
2035 %struct.small = type { i32, ptr }
2037 define i32 @callee_small_coerced_struct([2 x i32] %a.coerce) {
2038 ; ILP32E-FPELIM-LABEL: callee_small_coerced_struct:
2039 ; ILP32E-FPELIM: # %bb.0:
2040 ; ILP32E-FPELIM-NEXT: xor a0, a0, a1
2041 ; ILP32E-FPELIM-NEXT: seqz a0, a0
2042 ; ILP32E-FPELIM-NEXT: ret
2044 ; ILP32E-WITHFP-LABEL: callee_small_coerced_struct:
2045 ; ILP32E-WITHFP: # %bb.0:
2046 ; ILP32E-WITHFP-NEXT: addi sp, sp, -8
2047 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 8
2048 ; ILP32E-WITHFP-NEXT: sw ra, 4(sp) # 4-byte Folded Spill
2049 ; ILP32E-WITHFP-NEXT: sw s0, 0(sp) # 4-byte Folded Spill
2050 ; ILP32E-WITHFP-NEXT: .cfi_offset ra, -4
2051 ; ILP32E-WITHFP-NEXT: .cfi_offset s0, -8
2052 ; ILP32E-WITHFP-NEXT: addi s0, sp, 8
2053 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0
2054 ; ILP32E-WITHFP-NEXT: xor a0, a0, a1
2055 ; ILP32E-WITHFP-NEXT: seqz a0, a0
2056 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 8
2057 ; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload
2058 ; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload
2059 ; ILP32E-WITHFP-NEXT: .cfi_restore ra
2060 ; ILP32E-WITHFP-NEXT: .cfi_restore s0
2061 ; ILP32E-WITHFP-NEXT: addi sp, sp, 8
2062 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 0
2063 ; ILP32E-WITHFP-NEXT: ret
2065 ; ILP32E-FPELIM-SAVE-RESTORE-LABEL: callee_small_coerced_struct:
2066 ; ILP32E-FPELIM-SAVE-RESTORE: # %bb.0:
2067 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: xor a0, a0, a1
2068 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: seqz a0, a0
2069 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: ret
2071 ; ILP32E-WITHFP-SAVE-RESTORE-LABEL: callee_small_coerced_struct:
2072 ; ILP32E-WITHFP-SAVE-RESTORE: # %bb.0:
2073 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call t0, __riscv_save_1
2074 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
2075 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset ra, -4
2076 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset s0, -8
2077 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi s0, sp, 8
2078 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa s0, 0
2079 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: xor a0, a0, a1
2080 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: seqz a0, a0
2081 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 8
2082 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1
2083 %1 = extractvalue [2 x i32] %a.coerce, 0
2084 %2 = extractvalue [2 x i32] %a.coerce, 1
2085 %3 = icmp eq i32 %1, %2
2086 %4 = zext i1 %3 to i32
2090 define i32 @caller_small_coerced_struct() {
2091 ; ILP32E-FPELIM-LABEL: caller_small_coerced_struct:
2092 ; ILP32E-FPELIM: # %bb.0:
2093 ; ILP32E-FPELIM-NEXT: addi sp, sp, -4
2094 ; ILP32E-FPELIM-NEXT: .cfi_def_cfa_offset 4
2095 ; ILP32E-FPELIM-NEXT: sw ra, 0(sp) # 4-byte Folded Spill
2096 ; ILP32E-FPELIM-NEXT: .cfi_offset ra, -4
2097 ; ILP32E-FPELIM-NEXT: li a0, 1
2098 ; ILP32E-FPELIM-NEXT: li a1, 2
2099 ; ILP32E-FPELIM-NEXT: call callee_small_coerced_struct
2100 ; ILP32E-FPELIM-NEXT: lw ra, 0(sp) # 4-byte Folded Reload
2101 ; ILP32E-FPELIM-NEXT: .cfi_restore ra
2102 ; ILP32E-FPELIM-NEXT: addi sp, sp, 4
2103 ; ILP32E-FPELIM-NEXT: .cfi_def_cfa_offset 0
2104 ; ILP32E-FPELIM-NEXT: ret
2106 ; ILP32E-WITHFP-LABEL: caller_small_coerced_struct:
2107 ; ILP32E-WITHFP: # %bb.0:
2108 ; ILP32E-WITHFP-NEXT: addi sp, sp, -8
2109 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 8
2110 ; ILP32E-WITHFP-NEXT: sw ra, 4(sp) # 4-byte Folded Spill
2111 ; ILP32E-WITHFP-NEXT: sw s0, 0(sp) # 4-byte Folded Spill
2112 ; ILP32E-WITHFP-NEXT: .cfi_offset ra, -4
2113 ; ILP32E-WITHFP-NEXT: .cfi_offset s0, -8
2114 ; ILP32E-WITHFP-NEXT: addi s0, sp, 8
2115 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0
2116 ; ILP32E-WITHFP-NEXT: li a0, 1
2117 ; ILP32E-WITHFP-NEXT: li a1, 2
2118 ; ILP32E-WITHFP-NEXT: call callee_small_coerced_struct
2119 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 8
2120 ; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload
2121 ; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload
2122 ; ILP32E-WITHFP-NEXT: .cfi_restore ra
2123 ; ILP32E-WITHFP-NEXT: .cfi_restore s0
2124 ; ILP32E-WITHFP-NEXT: addi sp, sp, 8
2125 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 0
2126 ; ILP32E-WITHFP-NEXT: ret
2128 ; ILP32E-FPELIM-SAVE-RESTORE-LABEL: caller_small_coerced_struct:
2129 ; ILP32E-FPELIM-SAVE-RESTORE: # %bb.0:
2130 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: call t0, __riscv_save_0
2131 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 4
2132 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_offset ra, -4
2133 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li a0, 1
2134 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li a1, 2
2135 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: call callee_small_coerced_struct
2136 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: tail __riscv_restore_0
2138 ; ILP32E-WITHFP-SAVE-RESTORE-LABEL: caller_small_coerced_struct:
2139 ; ILP32E-WITHFP-SAVE-RESTORE: # %bb.0:
2140 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call t0, __riscv_save_1
2141 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
2142 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset ra, -4
2143 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset s0, -8
2144 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi s0, sp, 8
2145 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa s0, 0
2146 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a0, 1
2147 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a1, 2
2148 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call callee_small_coerced_struct
2149 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 8
2150 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1
2151 %1 = call i32 @callee_small_coerced_struct([2 x i32] [i32 1, i32 2])
2155 ; Check large struct arguments, which are passed byval
2157 %struct.large = type { i32, i32, i32, i32 }
2159 define i32 @callee_large_struct(ptr byval(%struct.large) align 4 %a) {
2160 ; ILP32E-FPELIM-LABEL: callee_large_struct:
2161 ; ILP32E-FPELIM: # %bb.0:
2162 ; ILP32E-FPELIM-NEXT: lw a1, 0(a0)
2163 ; ILP32E-FPELIM-NEXT: lw a0, 12(a0)
2164 ; ILP32E-FPELIM-NEXT: add a0, a1, a0
2165 ; ILP32E-FPELIM-NEXT: ret
2167 ; ILP32E-WITHFP-LABEL: callee_large_struct:
2168 ; ILP32E-WITHFP: # %bb.0:
2169 ; ILP32E-WITHFP-NEXT: addi sp, sp, -8
2170 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 8
2171 ; ILP32E-WITHFP-NEXT: sw ra, 4(sp) # 4-byte Folded Spill
2172 ; ILP32E-WITHFP-NEXT: sw s0, 0(sp) # 4-byte Folded Spill
2173 ; ILP32E-WITHFP-NEXT: .cfi_offset ra, -4
2174 ; ILP32E-WITHFP-NEXT: .cfi_offset s0, -8
2175 ; ILP32E-WITHFP-NEXT: addi s0, sp, 8
2176 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0
2177 ; ILP32E-WITHFP-NEXT: lw a1, 0(a0)
2178 ; ILP32E-WITHFP-NEXT: lw a0, 12(a0)
2179 ; ILP32E-WITHFP-NEXT: add a0, a1, a0
2180 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 8
2181 ; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload
2182 ; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload
2183 ; ILP32E-WITHFP-NEXT: .cfi_restore ra
2184 ; ILP32E-WITHFP-NEXT: .cfi_restore s0
2185 ; ILP32E-WITHFP-NEXT: addi sp, sp, 8
2186 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 0
2187 ; ILP32E-WITHFP-NEXT: ret
2189 ; ILP32E-FPELIM-SAVE-RESTORE-LABEL: callee_large_struct:
2190 ; ILP32E-FPELIM-SAVE-RESTORE: # %bb.0:
2191 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: lw a1, 0(a0)
2192 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: lw a0, 12(a0)
2193 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: add a0, a1, a0
2194 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: ret
2196 ; ILP32E-WITHFP-SAVE-RESTORE-LABEL: callee_large_struct:
2197 ; ILP32E-WITHFP-SAVE-RESTORE: # %bb.0:
2198 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call t0, __riscv_save_1
2199 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
2200 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset ra, -4
2201 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset s0, -8
2202 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi s0, sp, 8
2203 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa s0, 0
2204 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lw a1, 0(a0)
2205 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lw a0, 12(a0)
2206 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: add a0, a1, a0
2207 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 8
2208 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1
2209 %1 = getelementptr inbounds %struct.large, ptr %a, i32 0, i32 0
2210 %2 = getelementptr inbounds %struct.large, ptr %a, i32 0, i32 3
2211 %3 = load i32, ptr %1
2212 %4 = load i32, ptr %2
2217 define i32 @caller_large_struct() {
2218 ; ILP32E-FPELIM-LABEL: caller_large_struct:
2219 ; ILP32E-FPELIM: # %bb.0:
2220 ; ILP32E-FPELIM-NEXT: addi sp, sp, -36
2221 ; ILP32E-FPELIM-NEXT: .cfi_def_cfa_offset 36
2222 ; ILP32E-FPELIM-NEXT: sw ra, 32(sp) # 4-byte Folded Spill
2223 ; ILP32E-FPELIM-NEXT: .cfi_offset ra, -4
2224 ; ILP32E-FPELIM-NEXT: li a0, 1
2225 ; ILP32E-FPELIM-NEXT: li a1, 2
2226 ; ILP32E-FPELIM-NEXT: li a2, 3
2227 ; ILP32E-FPELIM-NEXT: li a3, 4
2228 ; ILP32E-FPELIM-NEXT: sw a0, 16(sp)
2229 ; ILP32E-FPELIM-NEXT: sw a1, 20(sp)
2230 ; ILP32E-FPELIM-NEXT: sw a2, 24(sp)
2231 ; ILP32E-FPELIM-NEXT: sw a3, 28(sp)
2232 ; ILP32E-FPELIM-NEXT: sw a0, 0(sp)
2233 ; ILP32E-FPELIM-NEXT: sw a1, 4(sp)
2234 ; ILP32E-FPELIM-NEXT: sw a2, 8(sp)
2235 ; ILP32E-FPELIM-NEXT: sw a3, 12(sp)
2236 ; ILP32E-FPELIM-NEXT: mv a0, sp
2237 ; ILP32E-FPELIM-NEXT: call callee_large_struct
2238 ; ILP32E-FPELIM-NEXT: lw ra, 32(sp) # 4-byte Folded Reload
2239 ; ILP32E-FPELIM-NEXT: .cfi_restore ra
2240 ; ILP32E-FPELIM-NEXT: addi sp, sp, 36
2241 ; ILP32E-FPELIM-NEXT: .cfi_def_cfa_offset 0
2242 ; ILP32E-FPELIM-NEXT: ret
2244 ; ILP32E-WITHFP-LABEL: caller_large_struct:
2245 ; ILP32E-WITHFP: # %bb.0:
2246 ; ILP32E-WITHFP-NEXT: addi sp, sp, -40
2247 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 40
2248 ; ILP32E-WITHFP-NEXT: sw ra, 36(sp) # 4-byte Folded Spill
2249 ; ILP32E-WITHFP-NEXT: sw s0, 32(sp) # 4-byte Folded Spill
2250 ; ILP32E-WITHFP-NEXT: .cfi_offset ra, -4
2251 ; ILP32E-WITHFP-NEXT: .cfi_offset s0, -8
2252 ; ILP32E-WITHFP-NEXT: addi s0, sp, 40
2253 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0
2254 ; ILP32E-WITHFP-NEXT: li a0, 1
2255 ; ILP32E-WITHFP-NEXT: li a1, 2
2256 ; ILP32E-WITHFP-NEXT: li a2, 3
2257 ; ILP32E-WITHFP-NEXT: li a3, 4
2258 ; ILP32E-WITHFP-NEXT: sw a0, -24(s0)
2259 ; ILP32E-WITHFP-NEXT: sw a1, -20(s0)
2260 ; ILP32E-WITHFP-NEXT: sw a2, -16(s0)
2261 ; ILP32E-WITHFP-NEXT: sw a3, -12(s0)
2262 ; ILP32E-WITHFP-NEXT: sw a0, -40(s0)
2263 ; ILP32E-WITHFP-NEXT: sw a1, -36(s0)
2264 ; ILP32E-WITHFP-NEXT: sw a2, -32(s0)
2265 ; ILP32E-WITHFP-NEXT: sw a3, -28(s0)
2266 ; ILP32E-WITHFP-NEXT: addi a0, s0, -40
2267 ; ILP32E-WITHFP-NEXT: call callee_large_struct
2268 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 40
2269 ; ILP32E-WITHFP-NEXT: lw ra, 36(sp) # 4-byte Folded Reload
2270 ; ILP32E-WITHFP-NEXT: lw s0, 32(sp) # 4-byte Folded Reload
2271 ; ILP32E-WITHFP-NEXT: .cfi_restore ra
2272 ; ILP32E-WITHFP-NEXT: .cfi_restore s0
2273 ; ILP32E-WITHFP-NEXT: addi sp, sp, 40
2274 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 0
2275 ; ILP32E-WITHFP-NEXT: ret
2277 ; ILP32E-FPELIM-SAVE-RESTORE-LABEL: caller_large_struct:
2278 ; ILP32E-FPELIM-SAVE-RESTORE: # %bb.0:
2279 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: call t0, __riscv_save_0
2280 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 4
2281 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_offset ra, -4
2282 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: addi sp, sp, -32
2283 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 36
2284 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li a0, 1
2285 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li a1, 2
2286 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li a2, 3
2287 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li a3, 4
2288 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw a0, 16(sp)
2289 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw a1, 20(sp)
2290 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw a2, 24(sp)
2291 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw a3, 28(sp)
2292 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw a0, 0(sp)
2293 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw a1, 4(sp)
2294 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw a2, 8(sp)
2295 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw a3, 12(sp)
2296 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: mv a0, sp
2297 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: call callee_large_struct
2298 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: addi sp, sp, 32
2299 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 4
2300 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: tail __riscv_restore_0
2302 ; ILP32E-WITHFP-SAVE-RESTORE-LABEL: caller_large_struct:
2303 ; ILP32E-WITHFP-SAVE-RESTORE: # %bb.0:
2304 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call t0, __riscv_save_1
2305 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
2306 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset ra, -4
2307 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset s0, -8
2308 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi sp, sp, -32
2309 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 40
2310 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi s0, sp, 40
2311 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa s0, 0
2312 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a0, 1
2313 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a1, 2
2314 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a2, 3
2315 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a3, 4
2316 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw a0, -24(s0)
2317 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw a1, -20(s0)
2318 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw a2, -16(s0)
2319 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw a3, -12(s0)
2320 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw a0, -40(s0)
2321 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw a1, -36(s0)
2322 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw a2, -32(s0)
2323 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw a3, -28(s0)
2324 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi a0, s0, -40
2325 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call callee_large_struct
2326 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 40
2327 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi sp, sp, 32
2328 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
2329 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1
2330 %ls = alloca %struct.large, align 4
2331 %1 = bitcast ptr %ls to ptr
2332 %a = getelementptr inbounds %struct.large, ptr %ls, i32 0, i32 0
2334 %b = getelementptr inbounds %struct.large, ptr %ls, i32 0, i32 1
2336 %c = getelementptr inbounds %struct.large, ptr %ls, i32 0, i32 2
2338 %d = getelementptr inbounds %struct.large, ptr %ls, i32 0, i32 3
2340 %2 = call i32 @callee_large_struct(ptr byval(%struct.large) align 4 %ls)
2344 ; Check return of 2x xlen structs
2346 define %struct.small @callee_small_struct_ret() {
2347 ; ILP32E-FPELIM-LABEL: callee_small_struct_ret:
2348 ; ILP32E-FPELIM: # %bb.0:
2349 ; ILP32E-FPELIM-NEXT: li a0, 1
2350 ; ILP32E-FPELIM-NEXT: li a1, 0
2351 ; ILP32E-FPELIM-NEXT: ret
2353 ; ILP32E-WITHFP-LABEL: callee_small_struct_ret:
2354 ; ILP32E-WITHFP: # %bb.0:
2355 ; ILP32E-WITHFP-NEXT: addi sp, sp, -8
2356 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 8
2357 ; ILP32E-WITHFP-NEXT: sw ra, 4(sp) # 4-byte Folded Spill
2358 ; ILP32E-WITHFP-NEXT: sw s0, 0(sp) # 4-byte Folded Spill
2359 ; ILP32E-WITHFP-NEXT: .cfi_offset ra, -4
2360 ; ILP32E-WITHFP-NEXT: .cfi_offset s0, -8
2361 ; ILP32E-WITHFP-NEXT: addi s0, sp, 8
2362 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0
2363 ; ILP32E-WITHFP-NEXT: li a0, 1
2364 ; ILP32E-WITHFP-NEXT: li a1, 0
2365 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 8
2366 ; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload
2367 ; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload
2368 ; ILP32E-WITHFP-NEXT: .cfi_restore ra
2369 ; ILP32E-WITHFP-NEXT: .cfi_restore s0
2370 ; ILP32E-WITHFP-NEXT: addi sp, sp, 8
2371 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 0
2372 ; ILP32E-WITHFP-NEXT: ret
2374 ; ILP32E-FPELIM-SAVE-RESTORE-LABEL: callee_small_struct_ret:
2375 ; ILP32E-FPELIM-SAVE-RESTORE: # %bb.0:
2376 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li a0, 1
2377 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li a1, 0
2378 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: ret
2380 ; ILP32E-WITHFP-SAVE-RESTORE-LABEL: callee_small_struct_ret:
2381 ; ILP32E-WITHFP-SAVE-RESTORE: # %bb.0:
2382 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call t0, __riscv_save_1
2383 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
2384 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset ra, -4
2385 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset s0, -8
2386 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi s0, sp, 8
2387 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa s0, 0
2388 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a0, 1
2389 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a1, 0
2390 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 8
2391 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1
2392 ret %struct.small { i32 1, ptr null }
2395 define i32 @caller_small_struct_ret() {
2396 ; ILP32E-FPELIM-LABEL: caller_small_struct_ret:
2397 ; ILP32E-FPELIM: # %bb.0:
2398 ; ILP32E-FPELIM-NEXT: addi sp, sp, -4
2399 ; ILP32E-FPELIM-NEXT: .cfi_def_cfa_offset 4
2400 ; ILP32E-FPELIM-NEXT: sw ra, 0(sp) # 4-byte Folded Spill
2401 ; ILP32E-FPELIM-NEXT: .cfi_offset ra, -4
2402 ; ILP32E-FPELIM-NEXT: call callee_small_struct_ret
2403 ; ILP32E-FPELIM-NEXT: add a0, a0, a1
2404 ; ILP32E-FPELIM-NEXT: lw ra, 0(sp) # 4-byte Folded Reload
2405 ; ILP32E-FPELIM-NEXT: .cfi_restore ra
2406 ; ILP32E-FPELIM-NEXT: addi sp, sp, 4
2407 ; ILP32E-FPELIM-NEXT: .cfi_def_cfa_offset 0
2408 ; ILP32E-FPELIM-NEXT: ret
2410 ; ILP32E-WITHFP-LABEL: caller_small_struct_ret:
2411 ; ILP32E-WITHFP: # %bb.0:
2412 ; ILP32E-WITHFP-NEXT: addi sp, sp, -8
2413 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 8
2414 ; ILP32E-WITHFP-NEXT: sw ra, 4(sp) # 4-byte Folded Spill
2415 ; ILP32E-WITHFP-NEXT: sw s0, 0(sp) # 4-byte Folded Spill
2416 ; ILP32E-WITHFP-NEXT: .cfi_offset ra, -4
2417 ; ILP32E-WITHFP-NEXT: .cfi_offset s0, -8
2418 ; ILP32E-WITHFP-NEXT: addi s0, sp, 8
2419 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0
2420 ; ILP32E-WITHFP-NEXT: call callee_small_struct_ret
2421 ; ILP32E-WITHFP-NEXT: add a0, a0, a1
2422 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 8
2423 ; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload
2424 ; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload
2425 ; ILP32E-WITHFP-NEXT: .cfi_restore ra
2426 ; ILP32E-WITHFP-NEXT: .cfi_restore s0
2427 ; ILP32E-WITHFP-NEXT: addi sp, sp, 8
2428 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 0
2429 ; ILP32E-WITHFP-NEXT: ret
2431 ; ILP32E-FPELIM-SAVE-RESTORE-LABEL: caller_small_struct_ret:
2432 ; ILP32E-FPELIM-SAVE-RESTORE: # %bb.0:
2433 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: call t0, __riscv_save_0
2434 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 4
2435 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_offset ra, -4
2436 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: call callee_small_struct_ret
2437 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: add a0, a0, a1
2438 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: tail __riscv_restore_0
2440 ; ILP32E-WITHFP-SAVE-RESTORE-LABEL: caller_small_struct_ret:
2441 ; ILP32E-WITHFP-SAVE-RESTORE: # %bb.0:
2442 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call t0, __riscv_save_1
2443 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
2444 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset ra, -4
2445 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset s0, -8
2446 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi s0, sp, 8
2447 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa s0, 0
2448 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call callee_small_struct_ret
2449 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: add a0, a0, a1
2450 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 8
2451 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1
2452 %1 = call %struct.small @callee_small_struct_ret()
2453 %2 = extractvalue %struct.small %1, 0
2454 %3 = extractvalue %struct.small %1, 1
2455 %4 = ptrtoint ptr %3 to i32
2460 ; Check return of >2x xlen scalars
2462 define fp128 @callee_large_scalar_ret() {
2463 ; ILP32E-FPELIM-LABEL: callee_large_scalar_ret:
2464 ; ILP32E-FPELIM: # %bb.0:
2465 ; ILP32E-FPELIM-NEXT: lui a1, 524272
2466 ; ILP32E-FPELIM-NEXT: sw zero, 0(a0)
2467 ; ILP32E-FPELIM-NEXT: sw zero, 4(a0)
2468 ; ILP32E-FPELIM-NEXT: sw zero, 8(a0)
2469 ; ILP32E-FPELIM-NEXT: sw a1, 12(a0)
2470 ; ILP32E-FPELIM-NEXT: ret
2472 ; ILP32E-WITHFP-LABEL: callee_large_scalar_ret:
2473 ; ILP32E-WITHFP: # %bb.0:
2474 ; ILP32E-WITHFP-NEXT: addi sp, sp, -8
2475 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 8
2476 ; ILP32E-WITHFP-NEXT: sw ra, 4(sp) # 4-byte Folded Spill
2477 ; ILP32E-WITHFP-NEXT: sw s0, 0(sp) # 4-byte Folded Spill
2478 ; ILP32E-WITHFP-NEXT: .cfi_offset ra, -4
2479 ; ILP32E-WITHFP-NEXT: .cfi_offset s0, -8
2480 ; ILP32E-WITHFP-NEXT: addi s0, sp, 8
2481 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0
2482 ; ILP32E-WITHFP-NEXT: lui a1, 524272
2483 ; ILP32E-WITHFP-NEXT: sw zero, 0(a0)
2484 ; ILP32E-WITHFP-NEXT: sw zero, 4(a0)
2485 ; ILP32E-WITHFP-NEXT: sw zero, 8(a0)
2486 ; ILP32E-WITHFP-NEXT: sw a1, 12(a0)
2487 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 8
2488 ; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload
2489 ; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload
2490 ; ILP32E-WITHFP-NEXT: .cfi_restore ra
2491 ; ILP32E-WITHFP-NEXT: .cfi_restore s0
2492 ; ILP32E-WITHFP-NEXT: addi sp, sp, 8
2493 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 0
2494 ; ILP32E-WITHFP-NEXT: ret
2496 ; ILP32E-FPELIM-SAVE-RESTORE-LABEL: callee_large_scalar_ret:
2497 ; ILP32E-FPELIM-SAVE-RESTORE: # %bb.0:
2498 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: lui a1, 524272
2499 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw zero, 0(a0)
2500 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw zero, 4(a0)
2501 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw zero, 8(a0)
2502 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw a1, 12(a0)
2503 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: ret
2505 ; ILP32E-WITHFP-SAVE-RESTORE-LABEL: callee_large_scalar_ret:
2506 ; ILP32E-WITHFP-SAVE-RESTORE: # %bb.0:
2507 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call t0, __riscv_save_1
2508 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
2509 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset ra, -4
2510 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset s0, -8
2511 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi s0, sp, 8
2512 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa s0, 0
2513 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lui a1, 524272
2514 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw zero, 0(a0)
2515 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw zero, 4(a0)
2516 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw zero, 8(a0)
2517 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw a1, 12(a0)
2518 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 8
2519 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1
2520 ret fp128 0xL00000000000000007FFF000000000000
2523 define void @caller_large_scalar_ret() {
2524 ; ILP32E-FPELIM-LABEL: caller_large_scalar_ret:
2525 ; ILP32E-FPELIM: # %bb.0:
2526 ; ILP32E-FPELIM-NEXT: addi sp, sp, -32
2527 ; ILP32E-FPELIM-NEXT: .cfi_def_cfa_offset 32
2528 ; ILP32E-FPELIM-NEXT: sw ra, 28(sp) # 4-byte Folded Spill
2529 ; ILP32E-FPELIM-NEXT: sw s0, 24(sp) # 4-byte Folded Spill
2530 ; ILP32E-FPELIM-NEXT: .cfi_offset ra, -4
2531 ; ILP32E-FPELIM-NEXT: .cfi_offset s0, -8
2532 ; ILP32E-FPELIM-NEXT: addi s0, sp, 32
2533 ; ILP32E-FPELIM-NEXT: .cfi_def_cfa s0, 0
2534 ; ILP32E-FPELIM-NEXT: andi sp, sp, -16
2535 ; ILP32E-FPELIM-NEXT: mv a0, sp
2536 ; ILP32E-FPELIM-NEXT: call callee_large_scalar_ret
2537 ; ILP32E-FPELIM-NEXT: addi sp, s0, -32
2538 ; ILP32E-FPELIM-NEXT: .cfi_def_cfa sp, 32
2539 ; ILP32E-FPELIM-NEXT: lw ra, 28(sp) # 4-byte Folded Reload
2540 ; ILP32E-FPELIM-NEXT: lw s0, 24(sp) # 4-byte Folded Reload
2541 ; ILP32E-FPELIM-NEXT: .cfi_restore ra
2542 ; ILP32E-FPELIM-NEXT: .cfi_restore s0
2543 ; ILP32E-FPELIM-NEXT: addi sp, sp, 32
2544 ; ILP32E-FPELIM-NEXT: .cfi_def_cfa_offset 0
2545 ; ILP32E-FPELIM-NEXT: ret
2547 ; ILP32E-WITHFP-LABEL: caller_large_scalar_ret:
2548 ; ILP32E-WITHFP: # %bb.0:
2549 ; ILP32E-WITHFP-NEXT: addi sp, sp, -32
2550 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 32
2551 ; ILP32E-WITHFP-NEXT: sw ra, 28(sp) # 4-byte Folded Spill
2552 ; ILP32E-WITHFP-NEXT: sw s0, 24(sp) # 4-byte Folded Spill
2553 ; ILP32E-WITHFP-NEXT: .cfi_offset ra, -4
2554 ; ILP32E-WITHFP-NEXT: .cfi_offset s0, -8
2555 ; ILP32E-WITHFP-NEXT: addi s0, sp, 32
2556 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0
2557 ; ILP32E-WITHFP-NEXT: andi sp, sp, -16
2558 ; ILP32E-WITHFP-NEXT: mv a0, sp
2559 ; ILP32E-WITHFP-NEXT: call callee_large_scalar_ret
2560 ; ILP32E-WITHFP-NEXT: addi sp, s0, -32
2561 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 32
2562 ; ILP32E-WITHFP-NEXT: lw ra, 28(sp) # 4-byte Folded Reload
2563 ; ILP32E-WITHFP-NEXT: lw s0, 24(sp) # 4-byte Folded Reload
2564 ; ILP32E-WITHFP-NEXT: .cfi_restore ra
2565 ; ILP32E-WITHFP-NEXT: .cfi_restore s0
2566 ; ILP32E-WITHFP-NEXT: addi sp, sp, 32
2567 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 0
2568 ; ILP32E-WITHFP-NEXT: ret
2570 ; ILP32E-FPELIM-SAVE-RESTORE-LABEL: caller_large_scalar_ret:
2571 ; ILP32E-FPELIM-SAVE-RESTORE: # %bb.0:
2572 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: call t0, __riscv_save_1
2573 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
2574 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_offset ra, -4
2575 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_offset s0, -8
2576 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: addi sp, sp, -24
2577 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 32
2578 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: addi s0, sp, 32
2579 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_def_cfa s0, 0
2580 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: andi sp, sp, -16
2581 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: mv a0, sp
2582 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: call callee_large_scalar_ret
2583 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: addi sp, s0, -32
2584 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 32
2585 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: addi sp, sp, 24
2586 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
2587 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: tail __riscv_restore_1
2589 ; ILP32E-WITHFP-SAVE-RESTORE-LABEL: caller_large_scalar_ret:
2590 ; ILP32E-WITHFP-SAVE-RESTORE: # %bb.0:
2591 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call t0, __riscv_save_1
2592 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
2593 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset ra, -4
2594 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset s0, -8
2595 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi sp, sp, -24
2596 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 32
2597 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi s0, sp, 32
2598 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa s0, 0
2599 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: andi sp, sp, -16
2600 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: mv a0, sp
2601 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call callee_large_scalar_ret
2602 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi sp, s0, -32
2603 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 32
2604 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi sp, sp, 24
2605 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
2606 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1
2607 %1 = call fp128 @callee_large_scalar_ret()
2611 ; Check return of >2x xlen structs
2613 define void @callee_large_struct_ret(ptr noalias sret(%struct.large) %agg.result) {
2614 ; ILP32E-FPELIM-LABEL: callee_large_struct_ret:
2615 ; ILP32E-FPELIM: # %bb.0:
2616 ; ILP32E-FPELIM-NEXT: li a1, 1
2617 ; ILP32E-FPELIM-NEXT: li a2, 2
2618 ; ILP32E-FPELIM-NEXT: li a3, 3
2619 ; ILP32E-FPELIM-NEXT: li a4, 4
2620 ; ILP32E-FPELIM-NEXT: sw a1, 0(a0)
2621 ; ILP32E-FPELIM-NEXT: sw a2, 4(a0)
2622 ; ILP32E-FPELIM-NEXT: sw a3, 8(a0)
2623 ; ILP32E-FPELIM-NEXT: sw a4, 12(a0)
2624 ; ILP32E-FPELIM-NEXT: ret
2626 ; ILP32E-WITHFP-LABEL: callee_large_struct_ret:
2627 ; ILP32E-WITHFP: # %bb.0:
2628 ; ILP32E-WITHFP-NEXT: addi sp, sp, -8
2629 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 8
2630 ; ILP32E-WITHFP-NEXT: sw ra, 4(sp) # 4-byte Folded Spill
2631 ; ILP32E-WITHFP-NEXT: sw s0, 0(sp) # 4-byte Folded Spill
2632 ; ILP32E-WITHFP-NEXT: .cfi_offset ra, -4
2633 ; ILP32E-WITHFP-NEXT: .cfi_offset s0, -8
2634 ; ILP32E-WITHFP-NEXT: addi s0, sp, 8
2635 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0
2636 ; ILP32E-WITHFP-NEXT: li a1, 1
2637 ; ILP32E-WITHFP-NEXT: li a2, 2
2638 ; ILP32E-WITHFP-NEXT: li a3, 3
2639 ; ILP32E-WITHFP-NEXT: li a4, 4
2640 ; ILP32E-WITHFP-NEXT: sw a1, 0(a0)
2641 ; ILP32E-WITHFP-NEXT: sw a2, 4(a0)
2642 ; ILP32E-WITHFP-NEXT: sw a3, 8(a0)
2643 ; ILP32E-WITHFP-NEXT: sw a4, 12(a0)
2644 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 8
2645 ; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload
2646 ; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload
2647 ; ILP32E-WITHFP-NEXT: .cfi_restore ra
2648 ; ILP32E-WITHFP-NEXT: .cfi_restore s0
2649 ; ILP32E-WITHFP-NEXT: addi sp, sp, 8
2650 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 0
2651 ; ILP32E-WITHFP-NEXT: ret
2653 ; ILP32E-FPELIM-SAVE-RESTORE-LABEL: callee_large_struct_ret:
2654 ; ILP32E-FPELIM-SAVE-RESTORE: # %bb.0:
2655 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li a1, 1
2656 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li a2, 2
2657 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li a3, 3
2658 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: li a4, 4
2659 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw a1, 0(a0)
2660 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw a2, 4(a0)
2661 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw a3, 8(a0)
2662 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: sw a4, 12(a0)
2663 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: ret
2665 ; ILP32E-WITHFP-SAVE-RESTORE-LABEL: callee_large_struct_ret:
2666 ; ILP32E-WITHFP-SAVE-RESTORE: # %bb.0:
2667 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call t0, __riscv_save_1
2668 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
2669 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset ra, -4
2670 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset s0, -8
2671 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi s0, sp, 8
2672 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa s0, 0
2673 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a1, 1
2674 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a2, 2
2675 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a3, 3
2676 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a4, 4
2677 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw a1, 0(a0)
2678 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw a2, 4(a0)
2679 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw a3, 8(a0)
2680 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw a4, 12(a0)
2681 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 8
2682 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1
2683 %a = getelementptr inbounds %struct.large, ptr %agg.result, i32 0, i32 0
2684 store i32 1, ptr %a, align 4
2685 %b = getelementptr inbounds %struct.large, ptr %agg.result, i32 0, i32 1
2686 store i32 2, ptr %b, align 4
2687 %c = getelementptr inbounds %struct.large, ptr %agg.result, i32 0, i32 2
2688 store i32 3, ptr %c, align 4
2689 %d = getelementptr inbounds %struct.large, ptr %agg.result, i32 0, i32 3
2690 store i32 4, ptr %d, align 4
2694 define i32 @caller_large_struct_ret() {
2695 ; ILP32E-FPELIM-LABEL: caller_large_struct_ret:
2696 ; ILP32E-FPELIM: # %bb.0:
2697 ; ILP32E-FPELIM-NEXT: addi sp, sp, -24
2698 ; ILP32E-FPELIM-NEXT: .cfi_def_cfa_offset 24
2699 ; ILP32E-FPELIM-NEXT: sw ra, 20(sp) # 4-byte Folded Spill
2700 ; ILP32E-FPELIM-NEXT: sw s0, 16(sp) # 4-byte Folded Spill
2701 ; ILP32E-FPELIM-NEXT: .cfi_offset ra, -4
2702 ; ILP32E-FPELIM-NEXT: .cfi_offset s0, -8
2703 ; ILP32E-FPELIM-NEXT: addi s0, sp, 24
2704 ; ILP32E-FPELIM-NEXT: .cfi_def_cfa s0, 0
2705 ; ILP32E-FPELIM-NEXT: andi sp, sp, -8
2706 ; ILP32E-FPELIM-NEXT: mv a0, sp
2707 ; ILP32E-FPELIM-NEXT: call callee_large_struct_ret
2708 ; ILP32E-FPELIM-NEXT: lw a0, 0(sp)
2709 ; ILP32E-FPELIM-NEXT: lw a1, 12(sp)
2710 ; ILP32E-FPELIM-NEXT: add a0, a0, a1
2711 ; ILP32E-FPELIM-NEXT: addi sp, s0, -24
2712 ; ILP32E-FPELIM-NEXT: .cfi_def_cfa sp, 24
2713 ; ILP32E-FPELIM-NEXT: lw ra, 20(sp) # 4-byte Folded Reload
2714 ; ILP32E-FPELIM-NEXT: lw s0, 16(sp) # 4-byte Folded Reload
2715 ; ILP32E-FPELIM-NEXT: .cfi_restore ra
2716 ; ILP32E-FPELIM-NEXT: .cfi_restore s0
2717 ; ILP32E-FPELIM-NEXT: addi sp, sp, 24
2718 ; ILP32E-FPELIM-NEXT: .cfi_def_cfa_offset 0
2719 ; ILP32E-FPELIM-NEXT: ret
2721 ; ILP32E-WITHFP-LABEL: caller_large_struct_ret:
2722 ; ILP32E-WITHFP: # %bb.0:
2723 ; ILP32E-WITHFP-NEXT: addi sp, sp, -24
2724 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 24
2725 ; ILP32E-WITHFP-NEXT: sw ra, 20(sp) # 4-byte Folded Spill
2726 ; ILP32E-WITHFP-NEXT: sw s0, 16(sp) # 4-byte Folded Spill
2727 ; ILP32E-WITHFP-NEXT: .cfi_offset ra, -4
2728 ; ILP32E-WITHFP-NEXT: .cfi_offset s0, -8
2729 ; ILP32E-WITHFP-NEXT: addi s0, sp, 24
2730 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0
2731 ; ILP32E-WITHFP-NEXT: andi sp, sp, -8
2732 ; ILP32E-WITHFP-NEXT: mv a0, sp
2733 ; ILP32E-WITHFP-NEXT: call callee_large_struct_ret
2734 ; ILP32E-WITHFP-NEXT: lw a0, 0(sp)
2735 ; ILP32E-WITHFP-NEXT: lw a1, 12(sp)
2736 ; ILP32E-WITHFP-NEXT: add a0, a0, a1
2737 ; ILP32E-WITHFP-NEXT: addi sp, s0, -24
2738 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 24
2739 ; ILP32E-WITHFP-NEXT: lw ra, 20(sp) # 4-byte Folded Reload
2740 ; ILP32E-WITHFP-NEXT: lw s0, 16(sp) # 4-byte Folded Reload
2741 ; ILP32E-WITHFP-NEXT: .cfi_restore ra
2742 ; ILP32E-WITHFP-NEXT: .cfi_restore s0
2743 ; ILP32E-WITHFP-NEXT: addi sp, sp, 24
2744 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 0
2745 ; ILP32E-WITHFP-NEXT: ret
2747 ; ILP32E-FPELIM-SAVE-RESTORE-LABEL: caller_large_struct_ret:
2748 ; ILP32E-FPELIM-SAVE-RESTORE: # %bb.0:
2749 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: call t0, __riscv_save_1
2750 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
2751 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_offset ra, -4
2752 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_offset s0, -8
2753 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: addi sp, sp, -16
2754 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 24
2755 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: addi s0, sp, 24
2756 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_def_cfa s0, 0
2757 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: andi sp, sp, -8
2758 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: mv a0, sp
2759 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: call callee_large_struct_ret
2760 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: lw a0, 0(sp)
2761 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: lw a1, 12(sp)
2762 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: add a0, a0, a1
2763 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: addi sp, s0, -24
2764 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 24
2765 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: addi sp, sp, 16
2766 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
2767 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT: tail __riscv_restore_1
2769 ; ILP32E-WITHFP-SAVE-RESTORE-LABEL: caller_large_struct_ret:
2770 ; ILP32E-WITHFP-SAVE-RESTORE: # %bb.0:
2771 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call t0, __riscv_save_1
2772 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
2773 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset ra, -4
2774 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_offset s0, -8
2775 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi sp, sp, -16
2776 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 24
2777 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi s0, sp, 24
2778 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa s0, 0
2779 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: andi sp, sp, -8
2780 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: mv a0, sp
2781 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call callee_large_struct_ret
2782 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lw a0, 0(sp)
2783 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lw a1, 12(sp)
2784 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: add a0, a0, a1
2785 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi sp, s0, -24
2786 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 24
2787 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi sp, sp, 16
2788 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8
2789 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1
2790 %1 = alloca %struct.large
2791 call void @callee_large_struct_ret(ptr sret(%struct.large) %1)
2792 %2 = getelementptr inbounds %struct.large, ptr %1, i32 0, i32 0
2793 %3 = load i32, ptr %2
2794 %4 = getelementptr inbounds %struct.large, ptr %1, i32 0, i32 3
2795 %5 = load i32, ptr %4