1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s \
3 ; RUN: | FileCheck -check-prefix=ILP32-ILP32F-FPELIM %s
4 ; RUN: llc -mtriple=riscv32 -verify-machineinstrs -frame-pointer=all < %s \
5 ; RUN: | FileCheck -check-prefix=ILP32-ILP32F-WITHFP %s
6 ; RUN: llc -mtriple=riscv32 -mattr=+d -verify-machineinstrs < %s \
7 ; RUN: | FileCheck -check-prefix=RV32D-ILP32-ILP32F-ILP32D-FPELIM %s
8 ; RUN: llc -mtriple=riscv32 -mattr=+d -target-abi ilp32f \
9 ; RUN: -verify-machineinstrs < %s \
10 ; RUN: | FileCheck -check-prefix=RV32D-ILP32-ILP32F-ILP32D-FPELIM %s
11 ; RUN: llc -mtriple=riscv32 -mattr=+d -target-abi ilp32d \
12 ; RUN: -verify-machineinstrs < %s \
13 ; RUN: | FileCheck -check-prefix=RV32D-ILP32-ILP32F-ILP32D-FPELIM %s
14 ; RUN: llc -mtriple=riscv64 -verify-machineinstrs < %s \
15 ; RUN: | FileCheck -check-prefix=LP64-LP64F-LP64D-FPELIM %s
16 ; RUN: llc -mtriple=riscv64 -mattr=+d -target-abi lp64f \
17 ; RUN: -verify-machineinstrs < %s \
18 ; RUN: | FileCheck -check-prefix=LP64-LP64F-LP64D-FPELIM %s
19 ; RUN: llc -mtriple=riscv64 -mattr=+d -target-abi lp64d \
20 ; RUN: -verify-machineinstrs < %s \
21 ; RUN: | FileCheck -check-prefix=LP64-LP64F-LP64D-FPELIM %s
22 ; RUN: llc -mtriple=riscv64 -verify-machineinstrs -frame-pointer=all < %s \
23 ; RUN: | FileCheck -check-prefix=LP64-LP64F-LP64D-WITHFP %s
25 ; The same vararg calling convention is used for ilp32/ilp32f/ilp32d and for
26 ; lp64/lp64f/lp64d. Different CHECK lines are required for RV32D due to slight
27 ; codegen differences due to the way the f64 load operations are lowered.
28 ; The nounwind attribute is omitted for some of the tests, to check that CFI
29 ; directives are correctly generated.
31 declare void @llvm.va_start(ptr)
32 declare void @llvm.va_end(ptr)
34 declare void @notdead(ptr)
36 ; Although frontends are recommended to not generate va_arg due to the lack of
37 ; support for aggregate types, we test simple cases here to ensure they are
40 define i32 @va1(ptr %fmt, ...) {
41 ; ILP32-ILP32F-FPELIM-LABEL: va1:
42 ; ILP32-ILP32F-FPELIM: # %bb.0:
43 ; ILP32-ILP32F-FPELIM-NEXT: addi sp, sp, -48
44 ; ILP32-ILP32F-FPELIM-NEXT: .cfi_def_cfa_offset 48
45 ; ILP32-ILP32F-FPELIM-NEXT: mv a0, a1
46 ; ILP32-ILP32F-FPELIM-NEXT: sw a7, 44(sp)
47 ; ILP32-ILP32F-FPELIM-NEXT: sw a6, 40(sp)
48 ; ILP32-ILP32F-FPELIM-NEXT: sw a5, 36(sp)
49 ; ILP32-ILP32F-FPELIM-NEXT: sw a4, 32(sp)
50 ; ILP32-ILP32F-FPELIM-NEXT: sw a3, 28(sp)
51 ; ILP32-ILP32F-FPELIM-NEXT: sw a2, 24(sp)
52 ; ILP32-ILP32F-FPELIM-NEXT: sw a1, 20(sp)
53 ; ILP32-ILP32F-FPELIM-NEXT: addi a1, sp, 24
54 ; ILP32-ILP32F-FPELIM-NEXT: sw a1, 12(sp)
55 ; ILP32-ILP32F-FPELIM-NEXT: addi sp, sp, 48
56 ; ILP32-ILP32F-FPELIM-NEXT: ret
58 ; ILP32-ILP32F-WITHFP-LABEL: va1:
59 ; ILP32-ILP32F-WITHFP: # %bb.0:
60 ; ILP32-ILP32F-WITHFP-NEXT: addi sp, sp, -48
61 ; ILP32-ILP32F-WITHFP-NEXT: .cfi_def_cfa_offset 48
62 ; ILP32-ILP32F-WITHFP-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
63 ; ILP32-ILP32F-WITHFP-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
64 ; ILP32-ILP32F-WITHFP-NEXT: .cfi_offset ra, -36
65 ; ILP32-ILP32F-WITHFP-NEXT: .cfi_offset s0, -40
66 ; ILP32-ILP32F-WITHFP-NEXT: addi s0, sp, 16
67 ; ILP32-ILP32F-WITHFP-NEXT: .cfi_def_cfa s0, 32
68 ; ILP32-ILP32F-WITHFP-NEXT: mv a0, a1
69 ; ILP32-ILP32F-WITHFP-NEXT: sw a7, 28(s0)
70 ; ILP32-ILP32F-WITHFP-NEXT: sw a6, 24(s0)
71 ; ILP32-ILP32F-WITHFP-NEXT: sw a5, 20(s0)
72 ; ILP32-ILP32F-WITHFP-NEXT: sw a4, 16(s0)
73 ; ILP32-ILP32F-WITHFP-NEXT: sw a3, 12(s0)
74 ; ILP32-ILP32F-WITHFP-NEXT: sw a2, 8(s0)
75 ; ILP32-ILP32F-WITHFP-NEXT: sw a1, 4(s0)
76 ; ILP32-ILP32F-WITHFP-NEXT: addi a1, s0, 8
77 ; ILP32-ILP32F-WITHFP-NEXT: sw a1, -12(s0)
78 ; ILP32-ILP32F-WITHFP-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
79 ; ILP32-ILP32F-WITHFP-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
80 ; ILP32-ILP32F-WITHFP-NEXT: addi sp, sp, 48
81 ; ILP32-ILP32F-WITHFP-NEXT: ret
83 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-LABEL: va1:
84 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM: # %bb.0:
85 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi sp, sp, -48
86 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: .cfi_def_cfa_offset 48
87 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: mv a0, a1
88 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a7, 44(sp)
89 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a6, 40(sp)
90 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a5, 36(sp)
91 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a4, 32(sp)
92 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a3, 28(sp)
93 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a2, 24(sp)
94 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a1, 20(sp)
95 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi a1, sp, 24
96 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a1, 12(sp)
97 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi sp, sp, 48
98 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: ret
100 ; LP64-LP64F-LP64D-FPELIM-LABEL: va1:
101 ; LP64-LP64F-LP64D-FPELIM: # %bb.0:
102 ; LP64-LP64F-LP64D-FPELIM-NEXT: addi sp, sp, -80
103 ; LP64-LP64F-LP64D-FPELIM-NEXT: .cfi_def_cfa_offset 80
104 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a1, 24(sp)
105 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a7, 72(sp)
106 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a6, 64(sp)
107 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a5, 56(sp)
108 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a4, 48(sp)
109 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a3, 40(sp)
110 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a2, 32(sp)
111 ; LP64-LP64F-LP64D-FPELIM-NEXT: addi a0, sp, 28
112 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a0, 8(sp)
113 ; LP64-LP64F-LP64D-FPELIM-NEXT: lw a0, 24(sp)
114 ; LP64-LP64F-LP64D-FPELIM-NEXT: addi sp, sp, 80
115 ; LP64-LP64F-LP64D-FPELIM-NEXT: ret
117 ; LP64-LP64F-LP64D-WITHFP-LABEL: va1:
118 ; LP64-LP64F-LP64D-WITHFP: # %bb.0:
119 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi sp, sp, -96
120 ; LP64-LP64F-LP64D-WITHFP-NEXT: .cfi_def_cfa_offset 96
121 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd ra, 24(sp) # 8-byte Folded Spill
122 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd s0, 16(sp) # 8-byte Folded Spill
123 ; LP64-LP64F-LP64D-WITHFP-NEXT: .cfi_offset ra, -72
124 ; LP64-LP64F-LP64D-WITHFP-NEXT: .cfi_offset s0, -80
125 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi s0, sp, 32
126 ; LP64-LP64F-LP64D-WITHFP-NEXT: .cfi_def_cfa s0, 64
127 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a1, 8(s0)
128 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a7, 56(s0)
129 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a6, 48(s0)
130 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a5, 40(s0)
131 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a4, 32(s0)
132 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a3, 24(s0)
133 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a2, 16(s0)
134 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi a0, s0, 12
135 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a0, -24(s0)
136 ; LP64-LP64F-LP64D-WITHFP-NEXT: lw a0, 8(s0)
137 ; LP64-LP64F-LP64D-WITHFP-NEXT: ld ra, 24(sp) # 8-byte Folded Reload
138 ; LP64-LP64F-LP64D-WITHFP-NEXT: ld s0, 16(sp) # 8-byte Folded Reload
139 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi sp, sp, 96
140 ; LP64-LP64F-LP64D-WITHFP-NEXT: ret
142 call void @llvm.va_start(ptr %va)
143 %argp.cur = load ptr, ptr %va, align 4
144 %argp.next = getelementptr inbounds i8, ptr %argp.cur, i32 4
145 store ptr %argp.next, ptr %va, align 4
146 %1 = load i32, ptr %argp.cur, align 4
147 call void @llvm.va_end(ptr %va)
151 define i32 @va1_va_arg(ptr %fmt, ...) nounwind {
152 ; ILP32-ILP32F-FPELIM-LABEL: va1_va_arg:
153 ; ILP32-ILP32F-FPELIM: # %bb.0:
154 ; ILP32-ILP32F-FPELIM-NEXT: addi sp, sp, -48
155 ; ILP32-ILP32F-FPELIM-NEXT: mv a0, a1
156 ; ILP32-ILP32F-FPELIM-NEXT: sw a7, 44(sp)
157 ; ILP32-ILP32F-FPELIM-NEXT: sw a6, 40(sp)
158 ; ILP32-ILP32F-FPELIM-NEXT: sw a5, 36(sp)
159 ; ILP32-ILP32F-FPELIM-NEXT: sw a4, 32(sp)
160 ; ILP32-ILP32F-FPELIM-NEXT: sw a3, 28(sp)
161 ; ILP32-ILP32F-FPELIM-NEXT: sw a2, 24(sp)
162 ; ILP32-ILP32F-FPELIM-NEXT: sw a1, 20(sp)
163 ; ILP32-ILP32F-FPELIM-NEXT: addi a1, sp, 24
164 ; ILP32-ILP32F-FPELIM-NEXT: sw a1, 12(sp)
165 ; ILP32-ILP32F-FPELIM-NEXT: addi sp, sp, 48
166 ; ILP32-ILP32F-FPELIM-NEXT: ret
168 ; ILP32-ILP32F-WITHFP-LABEL: va1_va_arg:
169 ; ILP32-ILP32F-WITHFP: # %bb.0:
170 ; ILP32-ILP32F-WITHFP-NEXT: addi sp, sp, -48
171 ; ILP32-ILP32F-WITHFP-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
172 ; ILP32-ILP32F-WITHFP-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
173 ; ILP32-ILP32F-WITHFP-NEXT: addi s0, sp, 16
174 ; ILP32-ILP32F-WITHFP-NEXT: mv a0, a1
175 ; ILP32-ILP32F-WITHFP-NEXT: sw a7, 28(s0)
176 ; ILP32-ILP32F-WITHFP-NEXT: sw a6, 24(s0)
177 ; ILP32-ILP32F-WITHFP-NEXT: sw a5, 20(s0)
178 ; ILP32-ILP32F-WITHFP-NEXT: sw a4, 16(s0)
179 ; ILP32-ILP32F-WITHFP-NEXT: sw a3, 12(s0)
180 ; ILP32-ILP32F-WITHFP-NEXT: sw a2, 8(s0)
181 ; ILP32-ILP32F-WITHFP-NEXT: sw a1, 4(s0)
182 ; ILP32-ILP32F-WITHFP-NEXT: addi a1, s0, 8
183 ; ILP32-ILP32F-WITHFP-NEXT: sw a1, -12(s0)
184 ; ILP32-ILP32F-WITHFP-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
185 ; ILP32-ILP32F-WITHFP-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
186 ; ILP32-ILP32F-WITHFP-NEXT: addi sp, sp, 48
187 ; ILP32-ILP32F-WITHFP-NEXT: ret
189 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-LABEL: va1_va_arg:
190 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM: # %bb.0:
191 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi sp, sp, -48
192 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: mv a0, a1
193 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a7, 44(sp)
194 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a6, 40(sp)
195 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a5, 36(sp)
196 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a4, 32(sp)
197 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a3, 28(sp)
198 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a2, 24(sp)
199 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a1, 20(sp)
200 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi a1, sp, 24
201 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a1, 12(sp)
202 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi sp, sp, 48
203 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: ret
205 ; LP64-LP64F-LP64D-FPELIM-LABEL: va1_va_arg:
206 ; LP64-LP64F-LP64D-FPELIM: # %bb.0:
207 ; LP64-LP64F-LP64D-FPELIM-NEXT: addi sp, sp, -80
208 ; LP64-LP64F-LP64D-FPELIM-NEXT: mv a0, a1
209 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a7, 72(sp)
210 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a6, 64(sp)
211 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a5, 56(sp)
212 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a4, 48(sp)
213 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a3, 40(sp)
214 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a2, 32(sp)
215 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a1, 24(sp)
216 ; LP64-LP64F-LP64D-FPELIM-NEXT: addi a1, sp, 32
217 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a1, 8(sp)
218 ; LP64-LP64F-LP64D-FPELIM-NEXT: addi sp, sp, 80
219 ; LP64-LP64F-LP64D-FPELIM-NEXT: ret
221 ; LP64-LP64F-LP64D-WITHFP-LABEL: va1_va_arg:
222 ; LP64-LP64F-LP64D-WITHFP: # %bb.0:
223 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi sp, sp, -96
224 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd ra, 24(sp) # 8-byte Folded Spill
225 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd s0, 16(sp) # 8-byte Folded Spill
226 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi s0, sp, 32
227 ; LP64-LP64F-LP64D-WITHFP-NEXT: mv a0, a1
228 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a7, 56(s0)
229 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a6, 48(s0)
230 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a5, 40(s0)
231 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a4, 32(s0)
232 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a3, 24(s0)
233 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a2, 16(s0)
234 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a1, 8(s0)
235 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi a1, s0, 16
236 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a1, -24(s0)
237 ; LP64-LP64F-LP64D-WITHFP-NEXT: ld ra, 24(sp) # 8-byte Folded Reload
238 ; LP64-LP64F-LP64D-WITHFP-NEXT: ld s0, 16(sp) # 8-byte Folded Reload
239 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi sp, sp, 96
240 ; LP64-LP64F-LP64D-WITHFP-NEXT: ret
242 call void @llvm.va_start(ptr %va)
243 %1 = va_arg ptr %va, i32
244 call void @llvm.va_end(ptr %va)
248 ; Ensure the adjustment when restoring the stack pointer using the frame
250 define i32 @va1_va_arg_alloca(ptr %fmt, ...) nounwind {
251 ; ILP32-ILP32F-FPELIM-LABEL: va1_va_arg_alloca:
252 ; ILP32-ILP32F-FPELIM: # %bb.0:
253 ; ILP32-ILP32F-FPELIM-NEXT: addi sp, sp, -48
254 ; ILP32-ILP32F-FPELIM-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
255 ; ILP32-ILP32F-FPELIM-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
256 ; ILP32-ILP32F-FPELIM-NEXT: sw s1, 4(sp) # 4-byte Folded Spill
257 ; ILP32-ILP32F-FPELIM-NEXT: addi s0, sp, 16
258 ; ILP32-ILP32F-FPELIM-NEXT: mv s1, a1
259 ; ILP32-ILP32F-FPELIM-NEXT: sw a7, 28(s0)
260 ; ILP32-ILP32F-FPELIM-NEXT: sw a6, 24(s0)
261 ; ILP32-ILP32F-FPELIM-NEXT: sw a5, 20(s0)
262 ; ILP32-ILP32F-FPELIM-NEXT: sw a4, 16(s0)
263 ; ILP32-ILP32F-FPELIM-NEXT: sw a3, 12(s0)
264 ; ILP32-ILP32F-FPELIM-NEXT: sw a2, 8(s0)
265 ; ILP32-ILP32F-FPELIM-NEXT: sw a1, 4(s0)
266 ; ILP32-ILP32F-FPELIM-NEXT: addi a0, s0, 8
267 ; ILP32-ILP32F-FPELIM-NEXT: sw a0, -16(s0)
268 ; ILP32-ILP32F-FPELIM-NEXT: addi a0, a1, 15
269 ; ILP32-ILP32F-FPELIM-NEXT: andi a0, a0, -16
270 ; ILP32-ILP32F-FPELIM-NEXT: sub a0, sp, a0
271 ; ILP32-ILP32F-FPELIM-NEXT: mv sp, a0
272 ; ILP32-ILP32F-FPELIM-NEXT: call notdead@plt
273 ; ILP32-ILP32F-FPELIM-NEXT: mv a0, s1
274 ; ILP32-ILP32F-FPELIM-NEXT: addi sp, s0, -16
275 ; ILP32-ILP32F-FPELIM-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
276 ; ILP32-ILP32F-FPELIM-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
277 ; ILP32-ILP32F-FPELIM-NEXT: lw s1, 4(sp) # 4-byte Folded Reload
278 ; ILP32-ILP32F-FPELIM-NEXT: addi sp, sp, 48
279 ; ILP32-ILP32F-FPELIM-NEXT: ret
281 ; ILP32-ILP32F-WITHFP-LABEL: va1_va_arg_alloca:
282 ; ILP32-ILP32F-WITHFP: # %bb.0:
283 ; ILP32-ILP32F-WITHFP-NEXT: addi sp, sp, -48
284 ; ILP32-ILP32F-WITHFP-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
285 ; ILP32-ILP32F-WITHFP-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
286 ; ILP32-ILP32F-WITHFP-NEXT: sw s1, 4(sp) # 4-byte Folded Spill
287 ; ILP32-ILP32F-WITHFP-NEXT: addi s0, sp, 16
288 ; ILP32-ILP32F-WITHFP-NEXT: mv s1, a1
289 ; ILP32-ILP32F-WITHFP-NEXT: sw a7, 28(s0)
290 ; ILP32-ILP32F-WITHFP-NEXT: sw a6, 24(s0)
291 ; ILP32-ILP32F-WITHFP-NEXT: sw a5, 20(s0)
292 ; ILP32-ILP32F-WITHFP-NEXT: sw a4, 16(s0)
293 ; ILP32-ILP32F-WITHFP-NEXT: sw a3, 12(s0)
294 ; ILP32-ILP32F-WITHFP-NEXT: sw a2, 8(s0)
295 ; ILP32-ILP32F-WITHFP-NEXT: sw a1, 4(s0)
296 ; ILP32-ILP32F-WITHFP-NEXT: addi a0, s0, 8
297 ; ILP32-ILP32F-WITHFP-NEXT: sw a0, -16(s0)
298 ; ILP32-ILP32F-WITHFP-NEXT: addi a0, a1, 15
299 ; ILP32-ILP32F-WITHFP-NEXT: andi a0, a0, -16
300 ; ILP32-ILP32F-WITHFP-NEXT: sub a0, sp, a0
301 ; ILP32-ILP32F-WITHFP-NEXT: mv sp, a0
302 ; ILP32-ILP32F-WITHFP-NEXT: call notdead@plt
303 ; ILP32-ILP32F-WITHFP-NEXT: mv a0, s1
304 ; ILP32-ILP32F-WITHFP-NEXT: addi sp, s0, -16
305 ; ILP32-ILP32F-WITHFP-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
306 ; ILP32-ILP32F-WITHFP-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
307 ; ILP32-ILP32F-WITHFP-NEXT: lw s1, 4(sp) # 4-byte Folded Reload
308 ; ILP32-ILP32F-WITHFP-NEXT: addi sp, sp, 48
309 ; ILP32-ILP32F-WITHFP-NEXT: ret
311 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-LABEL: va1_va_arg_alloca:
312 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM: # %bb.0:
313 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi sp, sp, -48
314 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
315 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
316 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw s1, 4(sp) # 4-byte Folded Spill
317 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi s0, sp, 16
318 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: mv s1, a1
319 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a7, 28(s0)
320 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a6, 24(s0)
321 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a5, 20(s0)
322 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a4, 16(s0)
323 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a3, 12(s0)
324 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a2, 8(s0)
325 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a1, 4(s0)
326 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi a0, s0, 8
327 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a0, -16(s0)
328 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi a0, a1, 15
329 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: andi a0, a0, -16
330 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sub a0, sp, a0
331 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: mv sp, a0
332 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: call notdead@plt
333 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: mv a0, s1
334 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi sp, s0, -16
335 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
336 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
337 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: lw s1, 4(sp) # 4-byte Folded Reload
338 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi sp, sp, 48
339 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: ret
341 ; LP64-LP64F-LP64D-FPELIM-LABEL: va1_va_arg_alloca:
342 ; LP64-LP64F-LP64D-FPELIM: # %bb.0:
343 ; LP64-LP64F-LP64D-FPELIM-NEXT: addi sp, sp, -96
344 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd ra, 24(sp) # 8-byte Folded Spill
345 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd s0, 16(sp) # 8-byte Folded Spill
346 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd s1, 8(sp) # 8-byte Folded Spill
347 ; LP64-LP64F-LP64D-FPELIM-NEXT: addi s0, sp, 32
348 ; LP64-LP64F-LP64D-FPELIM-NEXT: mv s1, a1
349 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a7, 56(s0)
350 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a6, 48(s0)
351 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a5, 40(s0)
352 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a4, 32(s0)
353 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a3, 24(s0)
354 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a2, 16(s0)
355 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a1, 8(s0)
356 ; LP64-LP64F-LP64D-FPELIM-NEXT: addi a0, s0, 16
357 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a0, -32(s0)
358 ; LP64-LP64F-LP64D-FPELIM-NEXT: slli a0, a1, 32
359 ; LP64-LP64F-LP64D-FPELIM-NEXT: srli a0, a0, 32
360 ; LP64-LP64F-LP64D-FPELIM-NEXT: addi a0, a0, 15
361 ; LP64-LP64F-LP64D-FPELIM-NEXT: andi a0, a0, -16
362 ; LP64-LP64F-LP64D-FPELIM-NEXT: sub a0, sp, a0
363 ; LP64-LP64F-LP64D-FPELIM-NEXT: mv sp, a0
364 ; LP64-LP64F-LP64D-FPELIM-NEXT: call notdead@plt
365 ; LP64-LP64F-LP64D-FPELIM-NEXT: mv a0, s1
366 ; LP64-LP64F-LP64D-FPELIM-NEXT: addi sp, s0, -32
367 ; LP64-LP64F-LP64D-FPELIM-NEXT: ld ra, 24(sp) # 8-byte Folded Reload
368 ; LP64-LP64F-LP64D-FPELIM-NEXT: ld s0, 16(sp) # 8-byte Folded Reload
369 ; LP64-LP64F-LP64D-FPELIM-NEXT: ld s1, 8(sp) # 8-byte Folded Reload
370 ; LP64-LP64F-LP64D-FPELIM-NEXT: addi sp, sp, 96
371 ; LP64-LP64F-LP64D-FPELIM-NEXT: ret
373 ; LP64-LP64F-LP64D-WITHFP-LABEL: va1_va_arg_alloca:
374 ; LP64-LP64F-LP64D-WITHFP: # %bb.0:
375 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi sp, sp, -96
376 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd ra, 24(sp) # 8-byte Folded Spill
377 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd s0, 16(sp) # 8-byte Folded Spill
378 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd s1, 8(sp) # 8-byte Folded Spill
379 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi s0, sp, 32
380 ; LP64-LP64F-LP64D-WITHFP-NEXT: mv s1, a1
381 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a7, 56(s0)
382 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a6, 48(s0)
383 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a5, 40(s0)
384 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a4, 32(s0)
385 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a3, 24(s0)
386 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a2, 16(s0)
387 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a1, 8(s0)
388 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi a0, s0, 16
389 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a0, -32(s0)
390 ; LP64-LP64F-LP64D-WITHFP-NEXT: slli a0, a1, 32
391 ; LP64-LP64F-LP64D-WITHFP-NEXT: srli a0, a0, 32
392 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi a0, a0, 15
393 ; LP64-LP64F-LP64D-WITHFP-NEXT: andi a0, a0, -16
394 ; LP64-LP64F-LP64D-WITHFP-NEXT: sub a0, sp, a0
395 ; LP64-LP64F-LP64D-WITHFP-NEXT: mv sp, a0
396 ; LP64-LP64F-LP64D-WITHFP-NEXT: call notdead@plt
397 ; LP64-LP64F-LP64D-WITHFP-NEXT: mv a0, s1
398 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi sp, s0, -32
399 ; LP64-LP64F-LP64D-WITHFP-NEXT: ld ra, 24(sp) # 8-byte Folded Reload
400 ; LP64-LP64F-LP64D-WITHFP-NEXT: ld s0, 16(sp) # 8-byte Folded Reload
401 ; LP64-LP64F-LP64D-WITHFP-NEXT: ld s1, 8(sp) # 8-byte Folded Reload
402 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi sp, sp, 96
403 ; LP64-LP64F-LP64D-WITHFP-NEXT: ret
405 call void @llvm.va_start(ptr %va)
406 %1 = va_arg ptr %va, i32
407 %2 = alloca i8, i32 %1
408 call void @notdead(ptr %2)
409 call void @llvm.va_end(ptr %va)
413 define void @va1_caller() nounwind {
414 ; Pass a double, as a float would be promoted by a C/C++ frontend
415 ; ILP32-ILP32F-FPELIM-LABEL: va1_caller:
416 ; ILP32-ILP32F-FPELIM: # %bb.0:
417 ; ILP32-ILP32F-FPELIM-NEXT: addi sp, sp, -16
418 ; ILP32-ILP32F-FPELIM-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
419 ; ILP32-ILP32F-FPELIM-NEXT: lui a3, 261888
420 ; ILP32-ILP32F-FPELIM-NEXT: li a4, 2
421 ; ILP32-ILP32F-FPELIM-NEXT: li a2, 0
422 ; ILP32-ILP32F-FPELIM-NEXT: call va1@plt
423 ; ILP32-ILP32F-FPELIM-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
424 ; ILP32-ILP32F-FPELIM-NEXT: addi sp, sp, 16
425 ; ILP32-ILP32F-FPELIM-NEXT: ret
427 ; ILP32-ILP32F-WITHFP-LABEL: va1_caller:
428 ; ILP32-ILP32F-WITHFP: # %bb.0:
429 ; ILP32-ILP32F-WITHFP-NEXT: addi sp, sp, -16
430 ; ILP32-ILP32F-WITHFP-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
431 ; ILP32-ILP32F-WITHFP-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
432 ; ILP32-ILP32F-WITHFP-NEXT: addi s0, sp, 16
433 ; ILP32-ILP32F-WITHFP-NEXT: lui a3, 261888
434 ; ILP32-ILP32F-WITHFP-NEXT: li a4, 2
435 ; ILP32-ILP32F-WITHFP-NEXT: li a2, 0
436 ; ILP32-ILP32F-WITHFP-NEXT: call va1@plt
437 ; ILP32-ILP32F-WITHFP-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
438 ; ILP32-ILP32F-WITHFP-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
439 ; ILP32-ILP32F-WITHFP-NEXT: addi sp, sp, 16
440 ; ILP32-ILP32F-WITHFP-NEXT: ret
442 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-LABEL: va1_caller:
443 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM: # %bb.0:
444 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi sp, sp, -16
445 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
446 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: lui a3, 261888
447 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: li a4, 2
448 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: li a2, 0
449 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: call va1@plt
450 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
451 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi sp, sp, 16
452 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: ret
454 ; LP64-LP64F-LP64D-FPELIM-LABEL: va1_caller:
455 ; LP64-LP64F-LP64D-FPELIM: # %bb.0:
456 ; LP64-LP64F-LP64D-FPELIM-NEXT: addi sp, sp, -16
457 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
458 ; LP64-LP64F-LP64D-FPELIM-NEXT: li a1, 1023
459 ; LP64-LP64F-LP64D-FPELIM-NEXT: slli a1, a1, 52
460 ; LP64-LP64F-LP64D-FPELIM-NEXT: li a2, 2
461 ; LP64-LP64F-LP64D-FPELIM-NEXT: call va1@plt
462 ; LP64-LP64F-LP64D-FPELIM-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
463 ; LP64-LP64F-LP64D-FPELIM-NEXT: addi sp, sp, 16
464 ; LP64-LP64F-LP64D-FPELIM-NEXT: ret
466 ; LP64-LP64F-LP64D-WITHFP-LABEL: va1_caller:
467 ; LP64-LP64F-LP64D-WITHFP: # %bb.0:
468 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi sp, sp, -16
469 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
470 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd s0, 0(sp) # 8-byte Folded Spill
471 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi s0, sp, 16
472 ; LP64-LP64F-LP64D-WITHFP-NEXT: li a1, 1023
473 ; LP64-LP64F-LP64D-WITHFP-NEXT: slli a1, a1, 52
474 ; LP64-LP64F-LP64D-WITHFP-NEXT: li a2, 2
475 ; LP64-LP64F-LP64D-WITHFP-NEXT: call va1@plt
476 ; LP64-LP64F-LP64D-WITHFP-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
477 ; LP64-LP64F-LP64D-WITHFP-NEXT: ld s0, 0(sp) # 8-byte Folded Reload
478 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi sp, sp, 16
479 ; LP64-LP64F-LP64D-WITHFP-NEXT: ret
480 %1 = call i32 (ptr, ...) @va1(ptr undef, double 1.0, i32 2)
484 ; Ensure that 2x xlen size+alignment varargs are accessed via an "aligned"
485 ; register pair (where the first register is even-numbered).
487 define i64 @va2(ptr %fmt, ...) nounwind {
488 ; ILP32-ILP32F-FPELIM-LABEL: va2:
489 ; ILP32-ILP32F-FPELIM: # %bb.0:
490 ; ILP32-ILP32F-FPELIM-NEXT: addi sp, sp, -48
491 ; ILP32-ILP32F-FPELIM-NEXT: sw a7, 44(sp)
492 ; ILP32-ILP32F-FPELIM-NEXT: sw a5, 36(sp)
493 ; ILP32-ILP32F-FPELIM-NEXT: sw a4, 32(sp)
494 ; ILP32-ILP32F-FPELIM-NEXT: sw a3, 28(sp)
495 ; ILP32-ILP32F-FPELIM-NEXT: sw a1, 20(sp)
496 ; ILP32-ILP32F-FPELIM-NEXT: sw a6, 40(sp)
497 ; ILP32-ILP32F-FPELIM-NEXT: sw a2, 24(sp)
498 ; ILP32-ILP32F-FPELIM-NEXT: addi a0, sp, 20
499 ; ILP32-ILP32F-FPELIM-NEXT: sw a0, 12(sp)
500 ; ILP32-ILP32F-FPELIM-NEXT: addi a0, sp, 27
501 ; ILP32-ILP32F-FPELIM-NEXT: andi a0, a0, -8
502 ; ILP32-ILP32F-FPELIM-NEXT: addi a1, sp, 35
503 ; ILP32-ILP32F-FPELIM-NEXT: sw a1, 12(sp)
504 ; ILP32-ILP32F-FPELIM-NEXT: lw a1, 4(a0)
505 ; ILP32-ILP32F-FPELIM-NEXT: lw a0, 0(a0)
506 ; ILP32-ILP32F-FPELIM-NEXT: addi sp, sp, 48
507 ; ILP32-ILP32F-FPELIM-NEXT: ret
509 ; ILP32-ILP32F-WITHFP-LABEL: va2:
510 ; ILP32-ILP32F-WITHFP: # %bb.0:
511 ; ILP32-ILP32F-WITHFP-NEXT: addi sp, sp, -48
512 ; ILP32-ILP32F-WITHFP-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
513 ; ILP32-ILP32F-WITHFP-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
514 ; ILP32-ILP32F-WITHFP-NEXT: addi s0, sp, 16
515 ; ILP32-ILP32F-WITHFP-NEXT: sw a7, 28(s0)
516 ; ILP32-ILP32F-WITHFP-NEXT: sw a5, 20(s0)
517 ; ILP32-ILP32F-WITHFP-NEXT: sw a4, 16(s0)
518 ; ILP32-ILP32F-WITHFP-NEXT: sw a3, 12(s0)
519 ; ILP32-ILP32F-WITHFP-NEXT: sw a1, 4(s0)
520 ; ILP32-ILP32F-WITHFP-NEXT: sw a6, 24(s0)
521 ; ILP32-ILP32F-WITHFP-NEXT: sw a2, 8(s0)
522 ; ILP32-ILP32F-WITHFP-NEXT: addi a0, s0, 4
523 ; ILP32-ILP32F-WITHFP-NEXT: sw a0, -12(s0)
524 ; ILP32-ILP32F-WITHFP-NEXT: addi a0, s0, 11
525 ; ILP32-ILP32F-WITHFP-NEXT: andi a0, a0, -8
526 ; ILP32-ILP32F-WITHFP-NEXT: addi a1, s0, 19
527 ; ILP32-ILP32F-WITHFP-NEXT: sw a1, -12(s0)
528 ; ILP32-ILP32F-WITHFP-NEXT: lw a1, 4(a0)
529 ; ILP32-ILP32F-WITHFP-NEXT: lw a0, 0(a0)
530 ; ILP32-ILP32F-WITHFP-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
531 ; ILP32-ILP32F-WITHFP-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
532 ; ILP32-ILP32F-WITHFP-NEXT: addi sp, sp, 48
533 ; ILP32-ILP32F-WITHFP-NEXT: ret
535 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-LABEL: va2:
536 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM: # %bb.0:
537 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi sp, sp, -48
538 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a7, 44(sp)
539 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a5, 36(sp)
540 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a4, 32(sp)
541 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a3, 28(sp)
542 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a1, 20(sp)
543 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a6, 40(sp)
544 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a2, 24(sp)
545 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi a0, sp, 20
546 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a0, 12(sp)
547 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi a0, sp, 27
548 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: andi a0, a0, -8
549 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi a1, sp, 35
550 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a1, 12(sp)
551 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: lw a1, 4(a0)
552 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: lw a0, 0(a0)
553 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi sp, sp, 48
554 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: ret
556 ; LP64-LP64F-LP64D-FPELIM-LABEL: va2:
557 ; LP64-LP64F-LP64D-FPELIM: # %bb.0:
558 ; LP64-LP64F-LP64D-FPELIM-NEXT: addi sp, sp, -80
559 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a7, 72(sp)
560 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a6, 64(sp)
561 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a5, 56(sp)
562 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a4, 48(sp)
563 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a3, 40(sp)
564 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a2, 32(sp)
565 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a1, 24(sp)
566 ; LP64-LP64F-LP64D-FPELIM-NEXT: addi a0, sp, 24
567 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a0, 8(sp)
568 ; LP64-LP64F-LP64D-FPELIM-NEXT: lw a0, 8(sp)
569 ; LP64-LP64F-LP64D-FPELIM-NEXT: addi a0, a0, 7
570 ; LP64-LP64F-LP64D-FPELIM-NEXT: slli a1, a0, 32
571 ; LP64-LP64F-LP64D-FPELIM-NEXT: srli a1, a1, 32
572 ; LP64-LP64F-LP64D-FPELIM-NEXT: addi a1, a1, 8
573 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a1, 8(sp)
574 ; LP64-LP64F-LP64D-FPELIM-NEXT: srliw a0, a0, 3
575 ; LP64-LP64F-LP64D-FPELIM-NEXT: slli a0, a0, 3
576 ; LP64-LP64F-LP64D-FPELIM-NEXT: ld a0, 0(a0)
577 ; LP64-LP64F-LP64D-FPELIM-NEXT: addi sp, sp, 80
578 ; LP64-LP64F-LP64D-FPELIM-NEXT: ret
580 ; LP64-LP64F-LP64D-WITHFP-LABEL: va2:
581 ; LP64-LP64F-LP64D-WITHFP: # %bb.0:
582 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi sp, sp, -96
583 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd ra, 24(sp) # 8-byte Folded Spill
584 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd s0, 16(sp) # 8-byte Folded Spill
585 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi s0, sp, 32
586 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a7, 56(s0)
587 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a6, 48(s0)
588 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a5, 40(s0)
589 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a4, 32(s0)
590 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a3, 24(s0)
591 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a2, 16(s0)
592 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a1, 8(s0)
593 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi a0, s0, 8
594 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a0, -24(s0)
595 ; LP64-LP64F-LP64D-WITHFP-NEXT: lw a0, -24(s0)
596 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi a0, a0, 7
597 ; LP64-LP64F-LP64D-WITHFP-NEXT: slli a1, a0, 32
598 ; LP64-LP64F-LP64D-WITHFP-NEXT: srli a1, a1, 32
599 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi a1, a1, 8
600 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a1, -24(s0)
601 ; LP64-LP64F-LP64D-WITHFP-NEXT: srliw a0, a0, 3
602 ; LP64-LP64F-LP64D-WITHFP-NEXT: slli a0, a0, 3
603 ; LP64-LP64F-LP64D-WITHFP-NEXT: ld a0, 0(a0)
604 ; LP64-LP64F-LP64D-WITHFP-NEXT: ld ra, 24(sp) # 8-byte Folded Reload
605 ; LP64-LP64F-LP64D-WITHFP-NEXT: ld s0, 16(sp) # 8-byte Folded Reload
606 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi sp, sp, 96
607 ; LP64-LP64F-LP64D-WITHFP-NEXT: ret
609 call void @llvm.va_start(ptr %va)
610 %argp.cur = load i32, ptr %va, align 4
611 %1 = add i32 %argp.cur, 7
613 %argp.cur.aligned = inttoptr i32 %1 to ptr
614 %argp.next = getelementptr inbounds i8, ptr %argp.cur.aligned, i32 8
615 store ptr %argp.next, ptr %va, align 4
616 %3 = inttoptr i32 %2 to ptr
617 %4 = load double, ptr %3, align 8
618 %5 = bitcast double %4 to i64
619 call void @llvm.va_end(ptr %va)
623 define i64 @va2_va_arg(ptr %fmt, ...) nounwind {
624 ; ILP32-ILP32F-FPELIM-LABEL: va2_va_arg:
625 ; ILP32-ILP32F-FPELIM: # %bb.0:
626 ; ILP32-ILP32F-FPELIM-NEXT: addi sp, sp, -48
627 ; ILP32-ILP32F-FPELIM-NEXT: sw a7, 44(sp)
628 ; ILP32-ILP32F-FPELIM-NEXT: sw a6, 40(sp)
629 ; ILP32-ILP32F-FPELIM-NEXT: sw a5, 36(sp)
630 ; ILP32-ILP32F-FPELIM-NEXT: sw a4, 32(sp)
631 ; ILP32-ILP32F-FPELIM-NEXT: sw a3, 28(sp)
632 ; ILP32-ILP32F-FPELIM-NEXT: sw a2, 24(sp)
633 ; ILP32-ILP32F-FPELIM-NEXT: sw a1, 20(sp)
634 ; ILP32-ILP32F-FPELIM-NEXT: addi a0, sp, 27
635 ; ILP32-ILP32F-FPELIM-NEXT: andi a1, a0, -8
636 ; ILP32-ILP32F-FPELIM-NEXT: addi a0, a1, 4
637 ; ILP32-ILP32F-FPELIM-NEXT: sw a0, 12(sp)
638 ; ILP32-ILP32F-FPELIM-NEXT: lw a0, 0(a1)
639 ; ILP32-ILP32F-FPELIM-NEXT: addi a2, a1, 8
640 ; ILP32-ILP32F-FPELIM-NEXT: sw a2, 12(sp)
641 ; ILP32-ILP32F-FPELIM-NEXT: lw a1, 4(a1)
642 ; ILP32-ILP32F-FPELIM-NEXT: addi sp, sp, 48
643 ; ILP32-ILP32F-FPELIM-NEXT: ret
645 ; ILP32-ILP32F-WITHFP-LABEL: va2_va_arg:
646 ; ILP32-ILP32F-WITHFP: # %bb.0:
647 ; ILP32-ILP32F-WITHFP-NEXT: addi sp, sp, -48
648 ; ILP32-ILP32F-WITHFP-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
649 ; ILP32-ILP32F-WITHFP-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
650 ; ILP32-ILP32F-WITHFP-NEXT: addi s0, sp, 16
651 ; ILP32-ILP32F-WITHFP-NEXT: sw a7, 28(s0)
652 ; ILP32-ILP32F-WITHFP-NEXT: sw a6, 24(s0)
653 ; ILP32-ILP32F-WITHFP-NEXT: sw a5, 20(s0)
654 ; ILP32-ILP32F-WITHFP-NEXT: sw a4, 16(s0)
655 ; ILP32-ILP32F-WITHFP-NEXT: sw a3, 12(s0)
656 ; ILP32-ILP32F-WITHFP-NEXT: sw a2, 8(s0)
657 ; ILP32-ILP32F-WITHFP-NEXT: sw a1, 4(s0)
658 ; ILP32-ILP32F-WITHFP-NEXT: addi a0, s0, 11
659 ; ILP32-ILP32F-WITHFP-NEXT: andi a1, a0, -8
660 ; ILP32-ILP32F-WITHFP-NEXT: addi a0, a1, 4
661 ; ILP32-ILP32F-WITHFP-NEXT: sw a0, -12(s0)
662 ; ILP32-ILP32F-WITHFP-NEXT: lw a0, 0(a1)
663 ; ILP32-ILP32F-WITHFP-NEXT: addi a2, a1, 8
664 ; ILP32-ILP32F-WITHFP-NEXT: sw a2, -12(s0)
665 ; ILP32-ILP32F-WITHFP-NEXT: lw a1, 4(a1)
666 ; ILP32-ILP32F-WITHFP-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
667 ; ILP32-ILP32F-WITHFP-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
668 ; ILP32-ILP32F-WITHFP-NEXT: addi sp, sp, 48
669 ; ILP32-ILP32F-WITHFP-NEXT: ret
671 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-LABEL: va2_va_arg:
672 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM: # %bb.0:
673 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi sp, sp, -48
674 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a7, 44(sp)
675 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a6, 40(sp)
676 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a5, 36(sp)
677 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a4, 32(sp)
678 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a3, 28(sp)
679 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a2, 24(sp)
680 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a1, 20(sp)
681 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi a0, sp, 27
682 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: andi a0, a0, -8
683 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi a1, a0, 8
684 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a1, 12(sp)
685 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: fld fa5, 0(a0)
686 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: fsd fa5, 0(sp)
687 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: lw a0, 0(sp)
688 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: lw a1, 4(sp)
689 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi sp, sp, 48
690 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: ret
692 ; LP64-LP64F-LP64D-FPELIM-LABEL: va2_va_arg:
693 ; LP64-LP64F-LP64D-FPELIM: # %bb.0:
694 ; LP64-LP64F-LP64D-FPELIM-NEXT: addi sp, sp, -80
695 ; LP64-LP64F-LP64D-FPELIM-NEXT: mv a0, a1
696 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a7, 72(sp)
697 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a6, 64(sp)
698 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a5, 56(sp)
699 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a4, 48(sp)
700 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a3, 40(sp)
701 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a2, 32(sp)
702 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a1, 24(sp)
703 ; LP64-LP64F-LP64D-FPELIM-NEXT: addi a1, sp, 32
704 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a1, 8(sp)
705 ; LP64-LP64F-LP64D-FPELIM-NEXT: addi sp, sp, 80
706 ; LP64-LP64F-LP64D-FPELIM-NEXT: ret
708 ; LP64-LP64F-LP64D-WITHFP-LABEL: va2_va_arg:
709 ; LP64-LP64F-LP64D-WITHFP: # %bb.0:
710 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi sp, sp, -96
711 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd ra, 24(sp) # 8-byte Folded Spill
712 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd s0, 16(sp) # 8-byte Folded Spill
713 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi s0, sp, 32
714 ; LP64-LP64F-LP64D-WITHFP-NEXT: mv a0, a1
715 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a7, 56(s0)
716 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a6, 48(s0)
717 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a5, 40(s0)
718 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a4, 32(s0)
719 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a3, 24(s0)
720 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a2, 16(s0)
721 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a1, 8(s0)
722 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi a1, s0, 16
723 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a1, -24(s0)
724 ; LP64-LP64F-LP64D-WITHFP-NEXT: ld ra, 24(sp) # 8-byte Folded Reload
725 ; LP64-LP64F-LP64D-WITHFP-NEXT: ld s0, 16(sp) # 8-byte Folded Reload
726 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi sp, sp, 96
727 ; LP64-LP64F-LP64D-WITHFP-NEXT: ret
729 call void @llvm.va_start(ptr %va)
730 %1 = va_arg ptr %va, double
731 call void @llvm.va_end(ptr %va)
732 %2 = bitcast double %1 to i64
736 define void @va2_caller() nounwind {
737 ; ILP32-ILP32F-FPELIM-LABEL: va2_caller:
738 ; ILP32-ILP32F-FPELIM: # %bb.0:
739 ; ILP32-ILP32F-FPELIM-NEXT: addi sp, sp, -16
740 ; ILP32-ILP32F-FPELIM-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
741 ; ILP32-ILP32F-FPELIM-NEXT: lui a3, 261888
742 ; ILP32-ILP32F-FPELIM-NEXT: li a2, 0
743 ; ILP32-ILP32F-FPELIM-NEXT: call va2@plt
744 ; ILP32-ILP32F-FPELIM-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
745 ; ILP32-ILP32F-FPELIM-NEXT: addi sp, sp, 16
746 ; ILP32-ILP32F-FPELIM-NEXT: ret
748 ; ILP32-ILP32F-WITHFP-LABEL: va2_caller:
749 ; ILP32-ILP32F-WITHFP: # %bb.0:
750 ; ILP32-ILP32F-WITHFP-NEXT: addi sp, sp, -16
751 ; ILP32-ILP32F-WITHFP-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
752 ; ILP32-ILP32F-WITHFP-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
753 ; ILP32-ILP32F-WITHFP-NEXT: addi s0, sp, 16
754 ; ILP32-ILP32F-WITHFP-NEXT: lui a3, 261888
755 ; ILP32-ILP32F-WITHFP-NEXT: li a2, 0
756 ; ILP32-ILP32F-WITHFP-NEXT: call va2@plt
757 ; ILP32-ILP32F-WITHFP-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
758 ; ILP32-ILP32F-WITHFP-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
759 ; ILP32-ILP32F-WITHFP-NEXT: addi sp, sp, 16
760 ; ILP32-ILP32F-WITHFP-NEXT: ret
762 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-LABEL: va2_caller:
763 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM: # %bb.0:
764 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi sp, sp, -16
765 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
766 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: lui a3, 261888
767 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: li a2, 0
768 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: call va2@plt
769 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
770 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi sp, sp, 16
771 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: ret
773 ; LP64-LP64F-LP64D-FPELIM-LABEL: va2_caller:
774 ; LP64-LP64F-LP64D-FPELIM: # %bb.0:
775 ; LP64-LP64F-LP64D-FPELIM-NEXT: addi sp, sp, -16
776 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
777 ; LP64-LP64F-LP64D-FPELIM-NEXT: li a1, 1023
778 ; LP64-LP64F-LP64D-FPELIM-NEXT: slli a1, a1, 52
779 ; LP64-LP64F-LP64D-FPELIM-NEXT: call va2@plt
780 ; LP64-LP64F-LP64D-FPELIM-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
781 ; LP64-LP64F-LP64D-FPELIM-NEXT: addi sp, sp, 16
782 ; LP64-LP64F-LP64D-FPELIM-NEXT: ret
784 ; LP64-LP64F-LP64D-WITHFP-LABEL: va2_caller:
785 ; LP64-LP64F-LP64D-WITHFP: # %bb.0:
786 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi sp, sp, -16
787 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
788 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd s0, 0(sp) # 8-byte Folded Spill
789 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi s0, sp, 16
790 ; LP64-LP64F-LP64D-WITHFP-NEXT: li a1, 1023
791 ; LP64-LP64F-LP64D-WITHFP-NEXT: slli a1, a1, 52
792 ; LP64-LP64F-LP64D-WITHFP-NEXT: call va2@plt
793 ; LP64-LP64F-LP64D-WITHFP-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
794 ; LP64-LP64F-LP64D-WITHFP-NEXT: ld s0, 0(sp) # 8-byte Folded Reload
795 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi sp, sp, 16
796 ; LP64-LP64F-LP64D-WITHFP-NEXT: ret
797 %1 = call i64 (ptr, ...) @va2(ptr undef, double 1.000000e+00)
801 ; On RV32, Ensure a named 2*xlen argument is passed in a1 and a2, while the
802 ; vararg double is passed in a4 and a5 (rather than a3 and a4)
804 define i64 @va3(i32 %a, i64 %b, ...) nounwind {
805 ; ILP32-ILP32F-FPELIM-LABEL: va3:
806 ; ILP32-ILP32F-FPELIM: # %bb.0:
807 ; ILP32-ILP32F-FPELIM-NEXT: addi sp, sp, -32
808 ; ILP32-ILP32F-FPELIM-NEXT: sw a7, 28(sp)
809 ; ILP32-ILP32F-FPELIM-NEXT: sw a6, 24(sp)
810 ; ILP32-ILP32F-FPELIM-NEXT: sw a5, 20(sp)
811 ; ILP32-ILP32F-FPELIM-NEXT: sw a4, 16(sp)
812 ; ILP32-ILP32F-FPELIM-NEXT: sw a3, 12(sp)
813 ; ILP32-ILP32F-FPELIM-NEXT: addi a0, sp, 12
814 ; ILP32-ILP32F-FPELIM-NEXT: sw a0, 4(sp)
815 ; ILP32-ILP32F-FPELIM-NEXT: addi a0, sp, 19
816 ; ILP32-ILP32F-FPELIM-NEXT: andi a0, a0, -8
817 ; ILP32-ILP32F-FPELIM-NEXT: addi a3, sp, 27
818 ; ILP32-ILP32F-FPELIM-NEXT: sw a3, 4(sp)
819 ; ILP32-ILP32F-FPELIM-NEXT: lw a3, 4(a0)
820 ; ILP32-ILP32F-FPELIM-NEXT: lw a0, 0(a0)
821 ; ILP32-ILP32F-FPELIM-NEXT: add a2, a2, a3
822 ; ILP32-ILP32F-FPELIM-NEXT: add a0, a1, a0
823 ; ILP32-ILP32F-FPELIM-NEXT: sltu a1, a0, a1
824 ; ILP32-ILP32F-FPELIM-NEXT: add a1, a2, a1
825 ; ILP32-ILP32F-FPELIM-NEXT: addi sp, sp, 32
826 ; ILP32-ILP32F-FPELIM-NEXT: ret
828 ; ILP32-ILP32F-WITHFP-LABEL: va3:
829 ; ILP32-ILP32F-WITHFP: # %bb.0:
830 ; ILP32-ILP32F-WITHFP-NEXT: addi sp, sp, -48
831 ; ILP32-ILP32F-WITHFP-NEXT: sw ra, 20(sp) # 4-byte Folded Spill
832 ; ILP32-ILP32F-WITHFP-NEXT: sw s0, 16(sp) # 4-byte Folded Spill
833 ; ILP32-ILP32F-WITHFP-NEXT: addi s0, sp, 24
834 ; ILP32-ILP32F-WITHFP-NEXT: sw a7, 20(s0)
835 ; ILP32-ILP32F-WITHFP-NEXT: sw a6, 16(s0)
836 ; ILP32-ILP32F-WITHFP-NEXT: sw a5, 12(s0)
837 ; ILP32-ILP32F-WITHFP-NEXT: sw a4, 8(s0)
838 ; ILP32-ILP32F-WITHFP-NEXT: sw a3, 4(s0)
839 ; ILP32-ILP32F-WITHFP-NEXT: addi a0, s0, 4
840 ; ILP32-ILP32F-WITHFP-NEXT: sw a0, -12(s0)
841 ; ILP32-ILP32F-WITHFP-NEXT: addi a0, s0, 11
842 ; ILP32-ILP32F-WITHFP-NEXT: andi a0, a0, -8
843 ; ILP32-ILP32F-WITHFP-NEXT: addi a3, s0, 19
844 ; ILP32-ILP32F-WITHFP-NEXT: sw a3, -12(s0)
845 ; ILP32-ILP32F-WITHFP-NEXT: lw a3, 4(a0)
846 ; ILP32-ILP32F-WITHFP-NEXT: lw a0, 0(a0)
847 ; ILP32-ILP32F-WITHFP-NEXT: add a2, a2, a3
848 ; ILP32-ILP32F-WITHFP-NEXT: add a0, a1, a0
849 ; ILP32-ILP32F-WITHFP-NEXT: sltu a1, a0, a1
850 ; ILP32-ILP32F-WITHFP-NEXT: add a1, a2, a1
851 ; ILP32-ILP32F-WITHFP-NEXT: lw ra, 20(sp) # 4-byte Folded Reload
852 ; ILP32-ILP32F-WITHFP-NEXT: lw s0, 16(sp) # 4-byte Folded Reload
853 ; ILP32-ILP32F-WITHFP-NEXT: addi sp, sp, 48
854 ; ILP32-ILP32F-WITHFP-NEXT: ret
856 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-LABEL: va3:
857 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM: # %bb.0:
858 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi sp, sp, -32
859 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a7, 28(sp)
860 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a6, 24(sp)
861 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a5, 20(sp)
862 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a4, 16(sp)
863 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a3, 12(sp)
864 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi a0, sp, 12
865 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a0, 4(sp)
866 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi a0, sp, 19
867 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: andi a0, a0, -8
868 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi a3, sp, 27
869 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a3, 4(sp)
870 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: lw a3, 4(a0)
871 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: lw a0, 0(a0)
872 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: add a2, a2, a3
873 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: add a0, a1, a0
874 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sltu a1, a0, a1
875 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: add a1, a2, a1
876 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi sp, sp, 32
877 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: ret
879 ; LP64-LP64F-LP64D-FPELIM-LABEL: va3:
880 ; LP64-LP64F-LP64D-FPELIM: # %bb.0:
881 ; LP64-LP64F-LP64D-FPELIM-NEXT: addi sp, sp, -64
882 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a7, 56(sp)
883 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a6, 48(sp)
884 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a5, 40(sp)
885 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a4, 32(sp)
886 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a3, 24(sp)
887 ; LP64-LP64F-LP64D-FPELIM-NEXT: addi a0, sp, 16
888 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a0, 8(sp)
889 ; LP64-LP64F-LP64D-FPELIM-NEXT: lw a0, 8(sp)
890 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a2, 16(sp)
891 ; LP64-LP64F-LP64D-FPELIM-NEXT: addi a0, a0, 7
892 ; LP64-LP64F-LP64D-FPELIM-NEXT: slli a2, a0, 32
893 ; LP64-LP64F-LP64D-FPELIM-NEXT: srli a2, a2, 32
894 ; LP64-LP64F-LP64D-FPELIM-NEXT: addi a2, a2, 8
895 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a2, 8(sp)
896 ; LP64-LP64F-LP64D-FPELIM-NEXT: srliw a0, a0, 3
897 ; LP64-LP64F-LP64D-FPELIM-NEXT: slli a0, a0, 3
898 ; LP64-LP64F-LP64D-FPELIM-NEXT: ld a0, 0(a0)
899 ; LP64-LP64F-LP64D-FPELIM-NEXT: add a0, a1, a0
900 ; LP64-LP64F-LP64D-FPELIM-NEXT: addi sp, sp, 64
901 ; LP64-LP64F-LP64D-FPELIM-NEXT: ret
903 ; LP64-LP64F-LP64D-WITHFP-LABEL: va3:
904 ; LP64-LP64F-LP64D-WITHFP: # %bb.0:
905 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi sp, sp, -80
906 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd ra, 24(sp) # 8-byte Folded Spill
907 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd s0, 16(sp) # 8-byte Folded Spill
908 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi s0, sp, 32
909 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a7, 40(s0)
910 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a6, 32(s0)
911 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a5, 24(s0)
912 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a4, 16(s0)
913 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a3, 8(s0)
914 ; LP64-LP64F-LP64D-WITHFP-NEXT: mv a0, s0
915 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a0, -24(s0)
916 ; LP64-LP64F-LP64D-WITHFP-NEXT: lw a0, -24(s0)
917 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a2, 0(s0)
918 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi a0, a0, 7
919 ; LP64-LP64F-LP64D-WITHFP-NEXT: slli a2, a0, 32
920 ; LP64-LP64F-LP64D-WITHFP-NEXT: srli a2, a2, 32
921 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi a2, a2, 8
922 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a2, -24(s0)
923 ; LP64-LP64F-LP64D-WITHFP-NEXT: srliw a0, a0, 3
924 ; LP64-LP64F-LP64D-WITHFP-NEXT: slli a0, a0, 3
925 ; LP64-LP64F-LP64D-WITHFP-NEXT: ld a0, 0(a0)
926 ; LP64-LP64F-LP64D-WITHFP-NEXT: add a0, a1, a0
927 ; LP64-LP64F-LP64D-WITHFP-NEXT: ld ra, 24(sp) # 8-byte Folded Reload
928 ; LP64-LP64F-LP64D-WITHFP-NEXT: ld s0, 16(sp) # 8-byte Folded Reload
929 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi sp, sp, 80
930 ; LP64-LP64F-LP64D-WITHFP-NEXT: ret
932 call void @llvm.va_start(ptr %va)
933 %argp.cur = load i32, ptr %va, align 4
934 %1 = add i32 %argp.cur, 7
936 %argp.cur.aligned = inttoptr i32 %1 to ptr
937 %argp.next = getelementptr inbounds i8, ptr %argp.cur.aligned, i32 8
938 store ptr %argp.next, ptr %va, align 4
939 %3 = inttoptr i32 %2 to ptr
940 %4 = load double, ptr %3, align 8
941 call void @llvm.va_end(ptr %va)
942 %5 = bitcast double %4 to i64
947 define i64 @va3_va_arg(i32 %a, i64 %b, ...) nounwind {
948 ; ILP32-ILP32F-FPELIM-LABEL: va3_va_arg:
949 ; ILP32-ILP32F-FPELIM: # %bb.0:
950 ; ILP32-ILP32F-FPELIM-NEXT: addi sp, sp, -32
951 ; ILP32-ILP32F-FPELIM-NEXT: sw a7, 28(sp)
952 ; ILP32-ILP32F-FPELIM-NEXT: sw a6, 24(sp)
953 ; ILP32-ILP32F-FPELIM-NEXT: sw a5, 20(sp)
954 ; ILP32-ILP32F-FPELIM-NEXT: sw a4, 16(sp)
955 ; ILP32-ILP32F-FPELIM-NEXT: sw a3, 12(sp)
956 ; ILP32-ILP32F-FPELIM-NEXT: addi a0, sp, 19
957 ; ILP32-ILP32F-FPELIM-NEXT: andi a0, a0, -8
958 ; ILP32-ILP32F-FPELIM-NEXT: addi a3, a0, 4
959 ; ILP32-ILP32F-FPELIM-NEXT: sw a3, 4(sp)
960 ; ILP32-ILP32F-FPELIM-NEXT: lw a3, 0(a0)
961 ; ILP32-ILP32F-FPELIM-NEXT: addi a4, a0, 8
962 ; ILP32-ILP32F-FPELIM-NEXT: sw a4, 4(sp)
963 ; ILP32-ILP32F-FPELIM-NEXT: lw a4, 4(a0)
964 ; ILP32-ILP32F-FPELIM-NEXT: add a0, a1, a3
965 ; ILP32-ILP32F-FPELIM-NEXT: sltu a1, a0, a1
966 ; ILP32-ILP32F-FPELIM-NEXT: add a2, a2, a4
967 ; ILP32-ILP32F-FPELIM-NEXT: add a1, a2, a1
968 ; ILP32-ILP32F-FPELIM-NEXT: addi sp, sp, 32
969 ; ILP32-ILP32F-FPELIM-NEXT: ret
971 ; ILP32-ILP32F-WITHFP-LABEL: va3_va_arg:
972 ; ILP32-ILP32F-WITHFP: # %bb.0:
973 ; ILP32-ILP32F-WITHFP-NEXT: addi sp, sp, -48
974 ; ILP32-ILP32F-WITHFP-NEXT: sw ra, 20(sp) # 4-byte Folded Spill
975 ; ILP32-ILP32F-WITHFP-NEXT: sw s0, 16(sp) # 4-byte Folded Spill
976 ; ILP32-ILP32F-WITHFP-NEXT: addi s0, sp, 24
977 ; ILP32-ILP32F-WITHFP-NEXT: sw a7, 20(s0)
978 ; ILP32-ILP32F-WITHFP-NEXT: sw a6, 16(s0)
979 ; ILP32-ILP32F-WITHFP-NEXT: sw a5, 12(s0)
980 ; ILP32-ILP32F-WITHFP-NEXT: sw a4, 8(s0)
981 ; ILP32-ILP32F-WITHFP-NEXT: sw a3, 4(s0)
982 ; ILP32-ILP32F-WITHFP-NEXT: addi a0, s0, 11
983 ; ILP32-ILP32F-WITHFP-NEXT: andi a0, a0, -8
984 ; ILP32-ILP32F-WITHFP-NEXT: addi a3, a0, 4
985 ; ILP32-ILP32F-WITHFP-NEXT: sw a3, -12(s0)
986 ; ILP32-ILP32F-WITHFP-NEXT: lw a3, 0(a0)
987 ; ILP32-ILP32F-WITHFP-NEXT: addi a4, a0, 8
988 ; ILP32-ILP32F-WITHFP-NEXT: sw a4, -12(s0)
989 ; ILP32-ILP32F-WITHFP-NEXT: lw a4, 4(a0)
990 ; ILP32-ILP32F-WITHFP-NEXT: add a0, a1, a3
991 ; ILP32-ILP32F-WITHFP-NEXT: sltu a1, a0, a1
992 ; ILP32-ILP32F-WITHFP-NEXT: add a2, a2, a4
993 ; ILP32-ILP32F-WITHFP-NEXT: add a1, a2, a1
994 ; ILP32-ILP32F-WITHFP-NEXT: lw ra, 20(sp) # 4-byte Folded Reload
995 ; ILP32-ILP32F-WITHFP-NEXT: lw s0, 16(sp) # 4-byte Folded Reload
996 ; ILP32-ILP32F-WITHFP-NEXT: addi sp, sp, 48
997 ; ILP32-ILP32F-WITHFP-NEXT: ret
999 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-LABEL: va3_va_arg:
1000 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM: # %bb.0:
1001 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi sp, sp, -48
1002 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a7, 44(sp)
1003 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a6, 40(sp)
1004 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a5, 36(sp)
1005 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a4, 32(sp)
1006 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a3, 28(sp)
1007 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi a0, sp, 35
1008 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: andi a0, a0, -8
1009 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi a3, a0, 8
1010 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a3, 20(sp)
1011 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: fld fa5, 0(a0)
1012 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: fsd fa5, 8(sp)
1013 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: lw a0, 12(sp)
1014 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: lw a3, 8(sp)
1015 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: add a2, a2, a0
1016 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: add a0, a1, a3
1017 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sltu a1, a0, a1
1018 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: add a1, a2, a1
1019 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi sp, sp, 48
1020 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: ret
1022 ; LP64-LP64F-LP64D-FPELIM-LABEL: va3_va_arg:
1023 ; LP64-LP64F-LP64D-FPELIM: # %bb.0:
1024 ; LP64-LP64F-LP64D-FPELIM-NEXT: addi sp, sp, -64
1025 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a7, 56(sp)
1026 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a6, 48(sp)
1027 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a5, 40(sp)
1028 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a4, 32(sp)
1029 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a3, 24(sp)
1030 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a2, 16(sp)
1031 ; LP64-LP64F-LP64D-FPELIM-NEXT: addi a3, sp, 24
1032 ; LP64-LP64F-LP64D-FPELIM-NEXT: add a0, a1, a2
1033 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a3, 8(sp)
1034 ; LP64-LP64F-LP64D-FPELIM-NEXT: addi sp, sp, 64
1035 ; LP64-LP64F-LP64D-FPELIM-NEXT: ret
1037 ; LP64-LP64F-LP64D-WITHFP-LABEL: va3_va_arg:
1038 ; LP64-LP64F-LP64D-WITHFP: # %bb.0:
1039 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi sp, sp, -80
1040 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd ra, 24(sp) # 8-byte Folded Spill
1041 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd s0, 16(sp) # 8-byte Folded Spill
1042 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi s0, sp, 32
1043 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a7, 40(s0)
1044 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a6, 32(s0)
1045 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a5, 24(s0)
1046 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a4, 16(s0)
1047 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a3, 8(s0)
1048 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a2, 0(s0)
1049 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi a3, s0, 8
1050 ; LP64-LP64F-LP64D-WITHFP-NEXT: add a0, a1, a2
1051 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a3, -24(s0)
1052 ; LP64-LP64F-LP64D-WITHFP-NEXT: ld ra, 24(sp) # 8-byte Folded Reload
1053 ; LP64-LP64F-LP64D-WITHFP-NEXT: ld s0, 16(sp) # 8-byte Folded Reload
1054 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi sp, sp, 80
1055 ; LP64-LP64F-LP64D-WITHFP-NEXT: ret
1057 call void @llvm.va_start(ptr %va)
1058 %1 = va_arg ptr %va, double
1059 call void @llvm.va_end(ptr %va)
1060 %2 = bitcast double %1 to i64
1065 define void @va3_caller() nounwind {
1066 ; ILP32-ILP32F-FPELIM-LABEL: va3_caller:
1067 ; ILP32-ILP32F-FPELIM: # %bb.0:
1068 ; ILP32-ILP32F-FPELIM-NEXT: addi sp, sp, -16
1069 ; ILP32-ILP32F-FPELIM-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1070 ; ILP32-ILP32F-FPELIM-NEXT: li a0, 2
1071 ; ILP32-ILP32F-FPELIM-NEXT: li a1, 1111
1072 ; ILP32-ILP32F-FPELIM-NEXT: lui a5, 262144
1073 ; ILP32-ILP32F-FPELIM-NEXT: li a2, 0
1074 ; ILP32-ILP32F-FPELIM-NEXT: li a4, 0
1075 ; ILP32-ILP32F-FPELIM-NEXT: call va3@plt
1076 ; ILP32-ILP32F-FPELIM-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1077 ; ILP32-ILP32F-FPELIM-NEXT: addi sp, sp, 16
1078 ; ILP32-ILP32F-FPELIM-NEXT: ret
1080 ; ILP32-ILP32F-WITHFP-LABEL: va3_caller:
1081 ; ILP32-ILP32F-WITHFP: # %bb.0:
1082 ; ILP32-ILP32F-WITHFP-NEXT: addi sp, sp, -16
1083 ; ILP32-ILP32F-WITHFP-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1084 ; ILP32-ILP32F-WITHFP-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
1085 ; ILP32-ILP32F-WITHFP-NEXT: addi s0, sp, 16
1086 ; ILP32-ILP32F-WITHFP-NEXT: li a0, 2
1087 ; ILP32-ILP32F-WITHFP-NEXT: li a1, 1111
1088 ; ILP32-ILP32F-WITHFP-NEXT: lui a5, 262144
1089 ; ILP32-ILP32F-WITHFP-NEXT: li a2, 0
1090 ; ILP32-ILP32F-WITHFP-NEXT: li a4, 0
1091 ; ILP32-ILP32F-WITHFP-NEXT: call va3@plt
1092 ; ILP32-ILP32F-WITHFP-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1093 ; ILP32-ILP32F-WITHFP-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
1094 ; ILP32-ILP32F-WITHFP-NEXT: addi sp, sp, 16
1095 ; ILP32-ILP32F-WITHFP-NEXT: ret
1097 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-LABEL: va3_caller:
1098 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM: # %bb.0:
1099 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi sp, sp, -16
1100 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1101 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: li a0, 2
1102 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: li a1, 1111
1103 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: lui a5, 262144
1104 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: li a2, 0
1105 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: li a4, 0
1106 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: call va3@plt
1107 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1108 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi sp, sp, 16
1109 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: ret
1111 ; LP64-LP64F-LP64D-FPELIM-LABEL: va3_caller:
1112 ; LP64-LP64F-LP64D-FPELIM: # %bb.0:
1113 ; LP64-LP64F-LP64D-FPELIM-NEXT: addi sp, sp, -16
1114 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
1115 ; LP64-LP64F-LP64D-FPELIM-NEXT: li a2, 1
1116 ; LP64-LP64F-LP64D-FPELIM-NEXT: slli a2, a2, 62
1117 ; LP64-LP64F-LP64D-FPELIM-NEXT: li a0, 2
1118 ; LP64-LP64F-LP64D-FPELIM-NEXT: li a1, 1111
1119 ; LP64-LP64F-LP64D-FPELIM-NEXT: call va3@plt
1120 ; LP64-LP64F-LP64D-FPELIM-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
1121 ; LP64-LP64F-LP64D-FPELIM-NEXT: addi sp, sp, 16
1122 ; LP64-LP64F-LP64D-FPELIM-NEXT: ret
1124 ; LP64-LP64F-LP64D-WITHFP-LABEL: va3_caller:
1125 ; LP64-LP64F-LP64D-WITHFP: # %bb.0:
1126 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi sp, sp, -16
1127 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
1128 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd s0, 0(sp) # 8-byte Folded Spill
1129 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi s0, sp, 16
1130 ; LP64-LP64F-LP64D-WITHFP-NEXT: li a2, 1
1131 ; LP64-LP64F-LP64D-WITHFP-NEXT: slli a2, a2, 62
1132 ; LP64-LP64F-LP64D-WITHFP-NEXT: li a0, 2
1133 ; LP64-LP64F-LP64D-WITHFP-NEXT: li a1, 1111
1134 ; LP64-LP64F-LP64D-WITHFP-NEXT: call va3@plt
1135 ; LP64-LP64F-LP64D-WITHFP-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
1136 ; LP64-LP64F-LP64D-WITHFP-NEXT: ld s0, 0(sp) # 8-byte Folded Reload
1137 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi sp, sp, 16
1138 ; LP64-LP64F-LP64D-WITHFP-NEXT: ret
1139 %1 = call i64 (i32, i64, ...) @va3(i32 2, i64 1111, double 2.000000e+00)
1143 declare void @llvm.va_copy(ptr, ptr)
1145 define i32 @va4_va_copy(i32 %argno, ...) nounwind {
1146 ; ILP32-ILP32F-FPELIM-LABEL: va4_va_copy:
1147 ; ILP32-ILP32F-FPELIM: # %bb.0:
1148 ; ILP32-ILP32F-FPELIM-NEXT: addi sp, sp, -48
1149 ; ILP32-ILP32F-FPELIM-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1150 ; ILP32-ILP32F-FPELIM-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
1151 ; ILP32-ILP32F-FPELIM-NEXT: mv s0, a1
1152 ; ILP32-ILP32F-FPELIM-NEXT: sw a7, 44(sp)
1153 ; ILP32-ILP32F-FPELIM-NEXT: sw a6, 40(sp)
1154 ; ILP32-ILP32F-FPELIM-NEXT: sw a5, 36(sp)
1155 ; ILP32-ILP32F-FPELIM-NEXT: sw a4, 32(sp)
1156 ; ILP32-ILP32F-FPELIM-NEXT: sw a3, 28(sp)
1157 ; ILP32-ILP32F-FPELIM-NEXT: sw a2, 24(sp)
1158 ; ILP32-ILP32F-FPELIM-NEXT: sw a1, 20(sp)
1159 ; ILP32-ILP32F-FPELIM-NEXT: addi a0, sp, 24
1160 ; ILP32-ILP32F-FPELIM-NEXT: sw a0, 4(sp)
1161 ; ILP32-ILP32F-FPELIM-NEXT: sw a0, 0(sp)
1162 ; ILP32-ILP32F-FPELIM-NEXT: call notdead@plt
1163 ; ILP32-ILP32F-FPELIM-NEXT: lw a0, 4(sp)
1164 ; ILP32-ILP32F-FPELIM-NEXT: addi a0, a0, 3
1165 ; ILP32-ILP32F-FPELIM-NEXT: andi a0, a0, -4
1166 ; ILP32-ILP32F-FPELIM-NEXT: addi a1, a0, 4
1167 ; ILP32-ILP32F-FPELIM-NEXT: sw a1, 4(sp)
1168 ; ILP32-ILP32F-FPELIM-NEXT: lw a1, 0(a0)
1169 ; ILP32-ILP32F-FPELIM-NEXT: addi a0, a0, 7
1170 ; ILP32-ILP32F-FPELIM-NEXT: andi a0, a0, -4
1171 ; ILP32-ILP32F-FPELIM-NEXT: addi a2, a0, 4
1172 ; ILP32-ILP32F-FPELIM-NEXT: sw a2, 4(sp)
1173 ; ILP32-ILP32F-FPELIM-NEXT: lw a2, 0(a0)
1174 ; ILP32-ILP32F-FPELIM-NEXT: addi a0, a0, 7
1175 ; ILP32-ILP32F-FPELIM-NEXT: andi a0, a0, -4
1176 ; ILP32-ILP32F-FPELIM-NEXT: addi a3, a0, 4
1177 ; ILP32-ILP32F-FPELIM-NEXT: sw a3, 4(sp)
1178 ; ILP32-ILP32F-FPELIM-NEXT: lw a0, 0(a0)
1179 ; ILP32-ILP32F-FPELIM-NEXT: add a1, a1, s0
1180 ; ILP32-ILP32F-FPELIM-NEXT: add a1, a1, a2
1181 ; ILP32-ILP32F-FPELIM-NEXT: add a0, a1, a0
1182 ; ILP32-ILP32F-FPELIM-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1183 ; ILP32-ILP32F-FPELIM-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
1184 ; ILP32-ILP32F-FPELIM-NEXT: addi sp, sp, 48
1185 ; ILP32-ILP32F-FPELIM-NEXT: ret
1187 ; ILP32-ILP32F-WITHFP-LABEL: va4_va_copy:
1188 ; ILP32-ILP32F-WITHFP: # %bb.0:
1189 ; ILP32-ILP32F-WITHFP-NEXT: addi sp, sp, -64
1190 ; ILP32-ILP32F-WITHFP-NEXT: sw ra, 28(sp) # 4-byte Folded Spill
1191 ; ILP32-ILP32F-WITHFP-NEXT: sw s0, 24(sp) # 4-byte Folded Spill
1192 ; ILP32-ILP32F-WITHFP-NEXT: sw s1, 20(sp) # 4-byte Folded Spill
1193 ; ILP32-ILP32F-WITHFP-NEXT: addi s0, sp, 32
1194 ; ILP32-ILP32F-WITHFP-NEXT: mv s1, a1
1195 ; ILP32-ILP32F-WITHFP-NEXT: sw a7, 28(s0)
1196 ; ILP32-ILP32F-WITHFP-NEXT: sw a6, 24(s0)
1197 ; ILP32-ILP32F-WITHFP-NEXT: sw a5, 20(s0)
1198 ; ILP32-ILP32F-WITHFP-NEXT: sw a4, 16(s0)
1199 ; ILP32-ILP32F-WITHFP-NEXT: sw a3, 12(s0)
1200 ; ILP32-ILP32F-WITHFP-NEXT: sw a2, 8(s0)
1201 ; ILP32-ILP32F-WITHFP-NEXT: sw a1, 4(s0)
1202 ; ILP32-ILP32F-WITHFP-NEXT: addi a0, s0, 8
1203 ; ILP32-ILP32F-WITHFP-NEXT: sw a0, -16(s0)
1204 ; ILP32-ILP32F-WITHFP-NEXT: sw a0, -20(s0)
1205 ; ILP32-ILP32F-WITHFP-NEXT: call notdead@plt
1206 ; ILP32-ILP32F-WITHFP-NEXT: lw a0, -16(s0)
1207 ; ILP32-ILP32F-WITHFP-NEXT: addi a0, a0, 3
1208 ; ILP32-ILP32F-WITHFP-NEXT: andi a0, a0, -4
1209 ; ILP32-ILP32F-WITHFP-NEXT: addi a1, a0, 4
1210 ; ILP32-ILP32F-WITHFP-NEXT: sw a1, -16(s0)
1211 ; ILP32-ILP32F-WITHFP-NEXT: lw a1, 0(a0)
1212 ; ILP32-ILP32F-WITHFP-NEXT: addi a0, a0, 7
1213 ; ILP32-ILP32F-WITHFP-NEXT: andi a0, a0, -4
1214 ; ILP32-ILP32F-WITHFP-NEXT: addi a2, a0, 4
1215 ; ILP32-ILP32F-WITHFP-NEXT: sw a2, -16(s0)
1216 ; ILP32-ILP32F-WITHFP-NEXT: lw a2, 0(a0)
1217 ; ILP32-ILP32F-WITHFP-NEXT: addi a0, a0, 7
1218 ; ILP32-ILP32F-WITHFP-NEXT: andi a0, a0, -4
1219 ; ILP32-ILP32F-WITHFP-NEXT: addi a3, a0, 4
1220 ; ILP32-ILP32F-WITHFP-NEXT: sw a3, -16(s0)
1221 ; ILP32-ILP32F-WITHFP-NEXT: lw a0, 0(a0)
1222 ; ILP32-ILP32F-WITHFP-NEXT: add a1, a1, s1
1223 ; ILP32-ILP32F-WITHFP-NEXT: add a1, a1, a2
1224 ; ILP32-ILP32F-WITHFP-NEXT: add a0, a1, a0
1225 ; ILP32-ILP32F-WITHFP-NEXT: lw ra, 28(sp) # 4-byte Folded Reload
1226 ; ILP32-ILP32F-WITHFP-NEXT: lw s0, 24(sp) # 4-byte Folded Reload
1227 ; ILP32-ILP32F-WITHFP-NEXT: lw s1, 20(sp) # 4-byte Folded Reload
1228 ; ILP32-ILP32F-WITHFP-NEXT: addi sp, sp, 64
1229 ; ILP32-ILP32F-WITHFP-NEXT: ret
1231 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-LABEL: va4_va_copy:
1232 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM: # %bb.0:
1233 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi sp, sp, -48
1234 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1235 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
1236 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: mv s0, a1
1237 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a7, 44(sp)
1238 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a6, 40(sp)
1239 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a5, 36(sp)
1240 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a4, 32(sp)
1241 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a3, 28(sp)
1242 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a2, 24(sp)
1243 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a1, 20(sp)
1244 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi a0, sp, 24
1245 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a0, 4(sp)
1246 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a0, 0(sp)
1247 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: call notdead@plt
1248 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: lw a0, 4(sp)
1249 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi a0, a0, 3
1250 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: andi a0, a0, -4
1251 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi a1, a0, 4
1252 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a1, 4(sp)
1253 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: lw a1, 0(a0)
1254 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi a0, a0, 7
1255 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: andi a0, a0, -4
1256 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi a2, a0, 4
1257 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a2, 4(sp)
1258 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: lw a2, 0(a0)
1259 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi a0, a0, 7
1260 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: andi a0, a0, -4
1261 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi a3, a0, 4
1262 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a3, 4(sp)
1263 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: lw a0, 0(a0)
1264 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: add a1, a1, s0
1265 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: add a1, a1, a2
1266 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: add a0, a1, a0
1267 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1268 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
1269 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi sp, sp, 48
1270 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: ret
1272 ; LP64-LP64F-LP64D-FPELIM-LABEL: va4_va_copy:
1273 ; LP64-LP64F-LP64D-FPELIM: # %bb.0:
1274 ; LP64-LP64F-LP64D-FPELIM-NEXT: addi sp, sp, -96
1275 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd ra, 24(sp) # 8-byte Folded Spill
1276 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd s0, 16(sp) # 8-byte Folded Spill
1277 ; LP64-LP64F-LP64D-FPELIM-NEXT: mv s0, a1
1278 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a7, 88(sp)
1279 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a6, 80(sp)
1280 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a5, 72(sp)
1281 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a4, 64(sp)
1282 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a3, 56(sp)
1283 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a2, 48(sp)
1284 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a1, 40(sp)
1285 ; LP64-LP64F-LP64D-FPELIM-NEXT: addi a0, sp, 48
1286 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a0, 8(sp)
1287 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a0, 0(sp)
1288 ; LP64-LP64F-LP64D-FPELIM-NEXT: call notdead@plt
1289 ; LP64-LP64F-LP64D-FPELIM-NEXT: ld a0, 8(sp)
1290 ; LP64-LP64F-LP64D-FPELIM-NEXT: addi a0, a0, 3
1291 ; LP64-LP64F-LP64D-FPELIM-NEXT: andi a0, a0, -4
1292 ; LP64-LP64F-LP64D-FPELIM-NEXT: addi a1, a0, 8
1293 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a1, 8(sp)
1294 ; LP64-LP64F-LP64D-FPELIM-NEXT: ld a1, 0(a0)
1295 ; LP64-LP64F-LP64D-FPELIM-NEXT: addi a0, a0, 11
1296 ; LP64-LP64F-LP64D-FPELIM-NEXT: andi a0, a0, -4
1297 ; LP64-LP64F-LP64D-FPELIM-NEXT: addi a2, a0, 8
1298 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a2, 8(sp)
1299 ; LP64-LP64F-LP64D-FPELIM-NEXT: ld a2, 0(a0)
1300 ; LP64-LP64F-LP64D-FPELIM-NEXT: addi a0, a0, 11
1301 ; LP64-LP64F-LP64D-FPELIM-NEXT: andi a0, a0, -4
1302 ; LP64-LP64F-LP64D-FPELIM-NEXT: addi a3, a0, 8
1303 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a3, 8(sp)
1304 ; LP64-LP64F-LP64D-FPELIM-NEXT: ld a0, 0(a0)
1305 ; LP64-LP64F-LP64D-FPELIM-NEXT: add a1, a1, s0
1306 ; LP64-LP64F-LP64D-FPELIM-NEXT: add a1, a1, a2
1307 ; LP64-LP64F-LP64D-FPELIM-NEXT: addw a0, a1, a0
1308 ; LP64-LP64F-LP64D-FPELIM-NEXT: ld ra, 24(sp) # 8-byte Folded Reload
1309 ; LP64-LP64F-LP64D-FPELIM-NEXT: ld s0, 16(sp) # 8-byte Folded Reload
1310 ; LP64-LP64F-LP64D-FPELIM-NEXT: addi sp, sp, 96
1311 ; LP64-LP64F-LP64D-FPELIM-NEXT: ret
1313 ; LP64-LP64F-LP64D-WITHFP-LABEL: va4_va_copy:
1314 ; LP64-LP64F-LP64D-WITHFP: # %bb.0:
1315 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi sp, sp, -112
1316 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd ra, 40(sp) # 8-byte Folded Spill
1317 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd s0, 32(sp) # 8-byte Folded Spill
1318 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd s1, 24(sp) # 8-byte Folded Spill
1319 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi s0, sp, 48
1320 ; LP64-LP64F-LP64D-WITHFP-NEXT: mv s1, a1
1321 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a7, 56(s0)
1322 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a6, 48(s0)
1323 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a5, 40(s0)
1324 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a4, 32(s0)
1325 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a3, 24(s0)
1326 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a2, 16(s0)
1327 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a1, 8(s0)
1328 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi a0, s0, 16
1329 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a0, -32(s0)
1330 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a0, -40(s0)
1331 ; LP64-LP64F-LP64D-WITHFP-NEXT: call notdead@plt
1332 ; LP64-LP64F-LP64D-WITHFP-NEXT: ld a0, -32(s0)
1333 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi a0, a0, 3
1334 ; LP64-LP64F-LP64D-WITHFP-NEXT: andi a0, a0, -4
1335 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi a1, a0, 8
1336 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a1, -32(s0)
1337 ; LP64-LP64F-LP64D-WITHFP-NEXT: ld a1, 0(a0)
1338 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi a0, a0, 11
1339 ; LP64-LP64F-LP64D-WITHFP-NEXT: andi a0, a0, -4
1340 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi a2, a0, 8
1341 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a2, -32(s0)
1342 ; LP64-LP64F-LP64D-WITHFP-NEXT: ld a2, 0(a0)
1343 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi a0, a0, 11
1344 ; LP64-LP64F-LP64D-WITHFP-NEXT: andi a0, a0, -4
1345 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi a3, a0, 8
1346 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a3, -32(s0)
1347 ; LP64-LP64F-LP64D-WITHFP-NEXT: ld a0, 0(a0)
1348 ; LP64-LP64F-LP64D-WITHFP-NEXT: add a1, a1, s1
1349 ; LP64-LP64F-LP64D-WITHFP-NEXT: add a1, a1, a2
1350 ; LP64-LP64F-LP64D-WITHFP-NEXT: addw a0, a1, a0
1351 ; LP64-LP64F-LP64D-WITHFP-NEXT: ld ra, 40(sp) # 8-byte Folded Reload
1352 ; LP64-LP64F-LP64D-WITHFP-NEXT: ld s0, 32(sp) # 8-byte Folded Reload
1353 ; LP64-LP64F-LP64D-WITHFP-NEXT: ld s1, 24(sp) # 8-byte Folded Reload
1354 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi sp, sp, 112
1355 ; LP64-LP64F-LP64D-WITHFP-NEXT: ret
1358 call void @llvm.va_start(ptr %vargs)
1359 %1 = va_arg ptr %vargs, i32
1360 call void @llvm.va_copy(ptr %wargs, ptr %vargs)
1361 %2 = load ptr, ptr %wargs, align 4
1362 call void @notdead(ptr %2)
1363 %3 = va_arg ptr %vargs, i32
1364 %4 = va_arg ptr %vargs, i32
1365 %5 = va_arg ptr %vargs, i32
1366 call void @llvm.va_end(ptr %vargs)
1367 call void @llvm.va_end(ptr %wargs)
1368 %add1 = add i32 %3, %1
1369 %add2 = add i32 %add1, %4
1370 %add3 = add i32 %add2, %5
1374 ; Check 2x*xlen values are aligned appropriately when passed on the stack in a vararg call
1376 declare i32 @va5_aligned_stack_callee(i32, ...)
1378 define void @va5_aligned_stack_caller() nounwind {
1379 ; The double should be 8-byte aligned on the stack, but the two-element array
1380 ; should only be 4-byte aligned
1381 ; ILP32-ILP32F-FPELIM-LABEL: va5_aligned_stack_caller:
1382 ; ILP32-ILP32F-FPELIM: # %bb.0:
1383 ; ILP32-ILP32F-FPELIM-NEXT: addi sp, sp, -64
1384 ; ILP32-ILP32F-FPELIM-NEXT: sw ra, 60(sp) # 4-byte Folded Spill
1385 ; ILP32-ILP32F-FPELIM-NEXT: li a0, 17
1386 ; ILP32-ILP32F-FPELIM-NEXT: sw a0, 24(sp)
1387 ; ILP32-ILP32F-FPELIM-NEXT: li a0, 16
1388 ; ILP32-ILP32F-FPELIM-NEXT: sw a0, 20(sp)
1389 ; ILP32-ILP32F-FPELIM-NEXT: li a0, 15
1390 ; ILP32-ILP32F-FPELIM-NEXT: sw a0, 16(sp)
1391 ; ILP32-ILP32F-FPELIM-NEXT: lui a0, 262236
1392 ; ILP32-ILP32F-FPELIM-NEXT: addi a0, a0, 655
1393 ; ILP32-ILP32F-FPELIM-NEXT: sw a0, 12(sp)
1394 ; ILP32-ILP32F-FPELIM-NEXT: lui a0, 377487
1395 ; ILP32-ILP32F-FPELIM-NEXT: addi a0, a0, 1475
1396 ; ILP32-ILP32F-FPELIM-NEXT: sw a0, 8(sp)
1397 ; ILP32-ILP32F-FPELIM-NEXT: li a0, 14
1398 ; ILP32-ILP32F-FPELIM-NEXT: sw a0, 0(sp)
1399 ; ILP32-ILP32F-FPELIM-NEXT: lui a0, 262153
1400 ; ILP32-ILP32F-FPELIM-NEXT: addi a0, a0, 491
1401 ; ILP32-ILP32F-FPELIM-NEXT: sw a0, 44(sp)
1402 ; ILP32-ILP32F-FPELIM-NEXT: lui a0, 545260
1403 ; ILP32-ILP32F-FPELIM-NEXT: addi a0, a0, -1967
1404 ; ILP32-ILP32F-FPELIM-NEXT: sw a0, 40(sp)
1405 ; ILP32-ILP32F-FPELIM-NEXT: lui a0, 964690
1406 ; ILP32-ILP32F-FPELIM-NEXT: addi a0, a0, -328
1407 ; ILP32-ILP32F-FPELIM-NEXT: sw a0, 36(sp)
1408 ; ILP32-ILP32F-FPELIM-NEXT: lui a0, 335544
1409 ; ILP32-ILP32F-FPELIM-NEXT: addi a5, a0, 1311
1410 ; ILP32-ILP32F-FPELIM-NEXT: lui a0, 688509
1411 ; ILP32-ILP32F-FPELIM-NEXT: addi a6, a0, -2048
1412 ; ILP32-ILP32F-FPELIM-NEXT: li a0, 1
1413 ; ILP32-ILP32F-FPELIM-NEXT: li a1, 11
1414 ; ILP32-ILP32F-FPELIM-NEXT: addi a2, sp, 32
1415 ; ILP32-ILP32F-FPELIM-NEXT: li a3, 12
1416 ; ILP32-ILP32F-FPELIM-NEXT: li a4, 13
1417 ; ILP32-ILP32F-FPELIM-NEXT: li a7, 4
1418 ; ILP32-ILP32F-FPELIM-NEXT: sw a5, 32(sp)
1419 ; ILP32-ILP32F-FPELIM-NEXT: call va5_aligned_stack_callee@plt
1420 ; ILP32-ILP32F-FPELIM-NEXT: lw ra, 60(sp) # 4-byte Folded Reload
1421 ; ILP32-ILP32F-FPELIM-NEXT: addi sp, sp, 64
1422 ; ILP32-ILP32F-FPELIM-NEXT: ret
1424 ; ILP32-ILP32F-WITHFP-LABEL: va5_aligned_stack_caller:
1425 ; ILP32-ILP32F-WITHFP: # %bb.0:
1426 ; ILP32-ILP32F-WITHFP-NEXT: addi sp, sp, -64
1427 ; ILP32-ILP32F-WITHFP-NEXT: sw ra, 60(sp) # 4-byte Folded Spill
1428 ; ILP32-ILP32F-WITHFP-NEXT: sw s0, 56(sp) # 4-byte Folded Spill
1429 ; ILP32-ILP32F-WITHFP-NEXT: addi s0, sp, 64
1430 ; ILP32-ILP32F-WITHFP-NEXT: li a0, 17
1431 ; ILP32-ILP32F-WITHFP-NEXT: sw a0, 24(sp)
1432 ; ILP32-ILP32F-WITHFP-NEXT: li a0, 16
1433 ; ILP32-ILP32F-WITHFP-NEXT: sw a0, 20(sp)
1434 ; ILP32-ILP32F-WITHFP-NEXT: li a0, 15
1435 ; ILP32-ILP32F-WITHFP-NEXT: sw a0, 16(sp)
1436 ; ILP32-ILP32F-WITHFP-NEXT: lui a0, 262236
1437 ; ILP32-ILP32F-WITHFP-NEXT: addi a0, a0, 655
1438 ; ILP32-ILP32F-WITHFP-NEXT: sw a0, 12(sp)
1439 ; ILP32-ILP32F-WITHFP-NEXT: lui a0, 377487
1440 ; ILP32-ILP32F-WITHFP-NEXT: addi a0, a0, 1475
1441 ; ILP32-ILP32F-WITHFP-NEXT: sw a0, 8(sp)
1442 ; ILP32-ILP32F-WITHFP-NEXT: li a0, 14
1443 ; ILP32-ILP32F-WITHFP-NEXT: sw a0, 0(sp)
1444 ; ILP32-ILP32F-WITHFP-NEXT: lui a0, 262153
1445 ; ILP32-ILP32F-WITHFP-NEXT: addi a0, a0, 491
1446 ; ILP32-ILP32F-WITHFP-NEXT: sw a0, -20(s0)
1447 ; ILP32-ILP32F-WITHFP-NEXT: lui a0, 545260
1448 ; ILP32-ILP32F-WITHFP-NEXT: addi a0, a0, -1967
1449 ; ILP32-ILP32F-WITHFP-NEXT: sw a0, -24(s0)
1450 ; ILP32-ILP32F-WITHFP-NEXT: lui a0, 964690
1451 ; ILP32-ILP32F-WITHFP-NEXT: addi a0, a0, -328
1452 ; ILP32-ILP32F-WITHFP-NEXT: sw a0, -28(s0)
1453 ; ILP32-ILP32F-WITHFP-NEXT: lui a0, 335544
1454 ; ILP32-ILP32F-WITHFP-NEXT: addi a5, a0, 1311
1455 ; ILP32-ILP32F-WITHFP-NEXT: lui a0, 688509
1456 ; ILP32-ILP32F-WITHFP-NEXT: addi a6, a0, -2048
1457 ; ILP32-ILP32F-WITHFP-NEXT: li a0, 1
1458 ; ILP32-ILP32F-WITHFP-NEXT: li a1, 11
1459 ; ILP32-ILP32F-WITHFP-NEXT: addi a2, s0, -32
1460 ; ILP32-ILP32F-WITHFP-NEXT: li a3, 12
1461 ; ILP32-ILP32F-WITHFP-NEXT: li a4, 13
1462 ; ILP32-ILP32F-WITHFP-NEXT: li a7, 4
1463 ; ILP32-ILP32F-WITHFP-NEXT: sw a5, -32(s0)
1464 ; ILP32-ILP32F-WITHFP-NEXT: call va5_aligned_stack_callee@plt
1465 ; ILP32-ILP32F-WITHFP-NEXT: lw ra, 60(sp) # 4-byte Folded Reload
1466 ; ILP32-ILP32F-WITHFP-NEXT: lw s0, 56(sp) # 4-byte Folded Reload
1467 ; ILP32-ILP32F-WITHFP-NEXT: addi sp, sp, 64
1468 ; ILP32-ILP32F-WITHFP-NEXT: ret
1470 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-LABEL: va5_aligned_stack_caller:
1471 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM: # %bb.0:
1472 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi sp, sp, -64
1473 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw ra, 60(sp) # 4-byte Folded Spill
1474 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: lui a0, 262236
1475 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi a0, a0, 655
1476 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a0, 12(sp)
1477 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: lui a0, 377487
1478 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi a0, a0, 1475
1479 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a0, 8(sp)
1480 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: li a0, 17
1481 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a0, 24(sp)
1482 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: li a0, 16
1483 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a0, 20(sp)
1484 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: li a0, 15
1485 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a0, 16(sp)
1486 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: li a0, 14
1487 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a0, 0(sp)
1488 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: lui a0, 262153
1489 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi a0, a0, 491
1490 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a0, 44(sp)
1491 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: lui a0, 545260
1492 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi a0, a0, -1967
1493 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a0, 40(sp)
1494 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: lui a0, 964690
1495 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi a0, a0, -328
1496 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a0, 36(sp)
1497 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: lui a0, 335544
1498 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi a5, a0, 1311
1499 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: lui a0, 688509
1500 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi a6, a0, -2048
1501 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: li a0, 1
1502 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: li a1, 11
1503 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi a2, sp, 32
1504 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: li a3, 12
1505 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: li a4, 13
1506 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: li a7, 4
1507 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a5, 32(sp)
1508 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: call va5_aligned_stack_callee@plt
1509 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: lw ra, 60(sp) # 4-byte Folded Reload
1510 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi sp, sp, 64
1511 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: ret
1513 ; LP64-LP64F-LP64D-FPELIM-LABEL: va5_aligned_stack_caller:
1514 ; LP64-LP64F-LP64D-FPELIM: # %bb.0:
1515 ; LP64-LP64F-LP64D-FPELIM-NEXT: addi sp, sp, -48
1516 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd ra, 40(sp) # 8-byte Folded Spill
1517 ; LP64-LP64F-LP64D-FPELIM-NEXT: li a0, 17
1518 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a0, 24(sp)
1519 ; LP64-LP64F-LP64D-FPELIM-NEXT: li a0, 16
1520 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a0, 16(sp)
1521 ; LP64-LP64F-LP64D-FPELIM-NEXT: li a0, 15
1522 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a0, 8(sp)
1523 ; LP64-LP64F-LP64D-FPELIM-NEXT: lui a0, %hi(.LCPI11_0)
1524 ; LP64-LP64F-LP64D-FPELIM-NEXT: ld t0, %lo(.LCPI11_0)(a0)
1525 ; LP64-LP64F-LP64D-FPELIM-NEXT: lui a0, %hi(.LCPI11_1)
1526 ; LP64-LP64F-LP64D-FPELIM-NEXT: ld a2, %lo(.LCPI11_1)(a0)
1527 ; LP64-LP64F-LP64D-FPELIM-NEXT: lui a0, %hi(.LCPI11_2)
1528 ; LP64-LP64F-LP64D-FPELIM-NEXT: ld a3, %lo(.LCPI11_2)(a0)
1529 ; LP64-LP64F-LP64D-FPELIM-NEXT: lui a0, 2384
1530 ; LP64-LP64F-LP64D-FPELIM-NEXT: addiw a6, a0, 761
1531 ; LP64-LP64F-LP64D-FPELIM-NEXT: slli a6, a6, 11
1532 ; LP64-LP64F-LP64D-FPELIM-NEXT: li a0, 1
1533 ; LP64-LP64F-LP64D-FPELIM-NEXT: li a1, 11
1534 ; LP64-LP64F-LP64D-FPELIM-NEXT: li a4, 12
1535 ; LP64-LP64F-LP64D-FPELIM-NEXT: li a5, 13
1536 ; LP64-LP64F-LP64D-FPELIM-NEXT: li a7, 14
1537 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd t0, 0(sp)
1538 ; LP64-LP64F-LP64D-FPELIM-NEXT: call va5_aligned_stack_callee@plt
1539 ; LP64-LP64F-LP64D-FPELIM-NEXT: ld ra, 40(sp) # 8-byte Folded Reload
1540 ; LP64-LP64F-LP64D-FPELIM-NEXT: addi sp, sp, 48
1541 ; LP64-LP64F-LP64D-FPELIM-NEXT: ret
1543 ; LP64-LP64F-LP64D-WITHFP-LABEL: va5_aligned_stack_caller:
1544 ; LP64-LP64F-LP64D-WITHFP: # %bb.0:
1545 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi sp, sp, -48
1546 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd ra, 40(sp) # 8-byte Folded Spill
1547 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd s0, 32(sp) # 8-byte Folded Spill
1548 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi s0, sp, 48
1549 ; LP64-LP64F-LP64D-WITHFP-NEXT: li a0, 17
1550 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a0, 24(sp)
1551 ; LP64-LP64F-LP64D-WITHFP-NEXT: li a0, 16
1552 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a0, 16(sp)
1553 ; LP64-LP64F-LP64D-WITHFP-NEXT: li a0, 15
1554 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a0, 8(sp)
1555 ; LP64-LP64F-LP64D-WITHFP-NEXT: lui a0, %hi(.LCPI11_0)
1556 ; LP64-LP64F-LP64D-WITHFP-NEXT: ld t0, %lo(.LCPI11_0)(a0)
1557 ; LP64-LP64F-LP64D-WITHFP-NEXT: lui a0, %hi(.LCPI11_1)
1558 ; LP64-LP64F-LP64D-WITHFP-NEXT: ld a2, %lo(.LCPI11_1)(a0)
1559 ; LP64-LP64F-LP64D-WITHFP-NEXT: lui a0, %hi(.LCPI11_2)
1560 ; LP64-LP64F-LP64D-WITHFP-NEXT: ld a3, %lo(.LCPI11_2)(a0)
1561 ; LP64-LP64F-LP64D-WITHFP-NEXT: lui a0, 2384
1562 ; LP64-LP64F-LP64D-WITHFP-NEXT: addiw a6, a0, 761
1563 ; LP64-LP64F-LP64D-WITHFP-NEXT: slli a6, a6, 11
1564 ; LP64-LP64F-LP64D-WITHFP-NEXT: li a0, 1
1565 ; LP64-LP64F-LP64D-WITHFP-NEXT: li a1, 11
1566 ; LP64-LP64F-LP64D-WITHFP-NEXT: li a4, 12
1567 ; LP64-LP64F-LP64D-WITHFP-NEXT: li a5, 13
1568 ; LP64-LP64F-LP64D-WITHFP-NEXT: li a7, 14
1569 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd t0, 0(sp)
1570 ; LP64-LP64F-LP64D-WITHFP-NEXT: call va5_aligned_stack_callee@plt
1571 ; LP64-LP64F-LP64D-WITHFP-NEXT: ld ra, 40(sp) # 8-byte Folded Reload
1572 ; LP64-LP64F-LP64D-WITHFP-NEXT: ld s0, 32(sp) # 8-byte Folded Reload
1573 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi sp, sp, 48
1574 ; LP64-LP64F-LP64D-WITHFP-NEXT: ret
1575 %1 = call i32 (i32, ...) @va5_aligned_stack_callee(i32 1, i32 11,
1576 fp128 0xLEB851EB851EB851F400091EB851EB851, i32 12, i32 13, i64 20000000000,
1577 i32 14, double 2.720000e+00, i32 15, [2 x i32] [i32 16, i32 17])
1581 ; A function with no fixed arguments is not valid C, but can be
1582 ; specified in LLVM IR. We must ensure the vararg save area is
1583 ; still set up correctly.
1585 define i32 @va6_no_fixed_args(...) nounwind {
1586 ; ILP32-ILP32F-FPELIM-LABEL: va6_no_fixed_args:
1587 ; ILP32-ILP32F-FPELIM: # %bb.0:
1588 ; ILP32-ILP32F-FPELIM-NEXT: addi sp, sp, -48
1589 ; ILP32-ILP32F-FPELIM-NEXT: sw a7, 44(sp)
1590 ; ILP32-ILP32F-FPELIM-NEXT: sw a6, 40(sp)
1591 ; ILP32-ILP32F-FPELIM-NEXT: sw a5, 36(sp)
1592 ; ILP32-ILP32F-FPELIM-NEXT: sw a4, 32(sp)
1593 ; ILP32-ILP32F-FPELIM-NEXT: sw a3, 28(sp)
1594 ; ILP32-ILP32F-FPELIM-NEXT: sw a2, 24(sp)
1595 ; ILP32-ILP32F-FPELIM-NEXT: sw a1, 20(sp)
1596 ; ILP32-ILP32F-FPELIM-NEXT: sw a0, 16(sp)
1597 ; ILP32-ILP32F-FPELIM-NEXT: addi a1, sp, 20
1598 ; ILP32-ILP32F-FPELIM-NEXT: sw a1, 12(sp)
1599 ; ILP32-ILP32F-FPELIM-NEXT: addi sp, sp, 48
1600 ; ILP32-ILP32F-FPELIM-NEXT: ret
1602 ; ILP32-ILP32F-WITHFP-LABEL: va6_no_fixed_args:
1603 ; ILP32-ILP32F-WITHFP: # %bb.0:
1604 ; ILP32-ILP32F-WITHFP-NEXT: addi sp, sp, -48
1605 ; ILP32-ILP32F-WITHFP-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1606 ; ILP32-ILP32F-WITHFP-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
1607 ; ILP32-ILP32F-WITHFP-NEXT: addi s0, sp, 16
1608 ; ILP32-ILP32F-WITHFP-NEXT: sw a7, 28(s0)
1609 ; ILP32-ILP32F-WITHFP-NEXT: sw a6, 24(s0)
1610 ; ILP32-ILP32F-WITHFP-NEXT: sw a5, 20(s0)
1611 ; ILP32-ILP32F-WITHFP-NEXT: sw a4, 16(s0)
1612 ; ILP32-ILP32F-WITHFP-NEXT: sw a3, 12(s0)
1613 ; ILP32-ILP32F-WITHFP-NEXT: sw a2, 8(s0)
1614 ; ILP32-ILP32F-WITHFP-NEXT: sw a1, 4(s0)
1615 ; ILP32-ILP32F-WITHFP-NEXT: sw a0, 0(s0)
1616 ; ILP32-ILP32F-WITHFP-NEXT: addi a1, s0, 4
1617 ; ILP32-ILP32F-WITHFP-NEXT: sw a1, -12(s0)
1618 ; ILP32-ILP32F-WITHFP-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1619 ; ILP32-ILP32F-WITHFP-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
1620 ; ILP32-ILP32F-WITHFP-NEXT: addi sp, sp, 48
1621 ; ILP32-ILP32F-WITHFP-NEXT: ret
1623 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-LABEL: va6_no_fixed_args:
1624 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM: # %bb.0:
1625 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi sp, sp, -48
1626 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a7, 44(sp)
1627 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a6, 40(sp)
1628 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a5, 36(sp)
1629 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a4, 32(sp)
1630 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a3, 28(sp)
1631 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a2, 24(sp)
1632 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a1, 20(sp)
1633 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a0, 16(sp)
1634 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi a1, sp, 20
1635 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a1, 12(sp)
1636 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi sp, sp, 48
1637 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: ret
1639 ; LP64-LP64F-LP64D-FPELIM-LABEL: va6_no_fixed_args:
1640 ; LP64-LP64F-LP64D-FPELIM: # %bb.0:
1641 ; LP64-LP64F-LP64D-FPELIM-NEXT: addi sp, sp, -80
1642 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a7, 72(sp)
1643 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a6, 64(sp)
1644 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a5, 56(sp)
1645 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a4, 48(sp)
1646 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a3, 40(sp)
1647 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a2, 32(sp)
1648 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a1, 24(sp)
1649 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a0, 16(sp)
1650 ; LP64-LP64F-LP64D-FPELIM-NEXT: addi a1, sp, 24
1651 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a1, 8(sp)
1652 ; LP64-LP64F-LP64D-FPELIM-NEXT: addi sp, sp, 80
1653 ; LP64-LP64F-LP64D-FPELIM-NEXT: ret
1655 ; LP64-LP64F-LP64D-WITHFP-LABEL: va6_no_fixed_args:
1656 ; LP64-LP64F-LP64D-WITHFP: # %bb.0:
1657 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi sp, sp, -96
1658 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd ra, 24(sp) # 8-byte Folded Spill
1659 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd s0, 16(sp) # 8-byte Folded Spill
1660 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi s0, sp, 32
1661 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a7, 56(s0)
1662 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a6, 48(s0)
1663 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a5, 40(s0)
1664 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a4, 32(s0)
1665 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a3, 24(s0)
1666 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a2, 16(s0)
1667 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a1, 8(s0)
1668 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a0, 0(s0)
1669 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi a1, s0, 8
1670 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a1, -24(s0)
1671 ; LP64-LP64F-LP64D-WITHFP-NEXT: ld ra, 24(sp) # 8-byte Folded Reload
1672 ; LP64-LP64F-LP64D-WITHFP-NEXT: ld s0, 16(sp) # 8-byte Folded Reload
1673 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi sp, sp, 96
1674 ; LP64-LP64F-LP64D-WITHFP-NEXT: ret
1676 call void @llvm.va_start(ptr %va)
1677 %1 = va_arg ptr %va, i32
1678 call void @llvm.va_end(ptr %va)
1682 ; TODO: improve constant materialization of stack addresses
1684 define i32 @va_large_stack(ptr %fmt, ...) {
1685 ; ILP32-ILP32F-FPELIM-LABEL: va_large_stack:
1686 ; ILP32-ILP32F-FPELIM: # %bb.0:
1687 ; ILP32-ILP32F-FPELIM-NEXT: lui a0, 24414
1688 ; ILP32-ILP32F-FPELIM-NEXT: addi a0, a0, 304
1689 ; ILP32-ILP32F-FPELIM-NEXT: sub sp, sp, a0
1690 ; ILP32-ILP32F-FPELIM-NEXT: .cfi_def_cfa_offset 100000048
1691 ; ILP32-ILP32F-FPELIM-NEXT: mv a0, a1
1692 ; ILP32-ILP32F-FPELIM-NEXT: lui t0, 24414
1693 ; ILP32-ILP32F-FPELIM-NEXT: add t0, sp, t0
1694 ; ILP32-ILP32F-FPELIM-NEXT: sw a7, 300(t0)
1695 ; ILP32-ILP32F-FPELIM-NEXT: lui a7, 24414
1696 ; ILP32-ILP32F-FPELIM-NEXT: add a7, sp, a7
1697 ; ILP32-ILP32F-FPELIM-NEXT: sw a6, 296(a7)
1698 ; ILP32-ILP32F-FPELIM-NEXT: lui a6, 24414
1699 ; ILP32-ILP32F-FPELIM-NEXT: add a6, sp, a6
1700 ; ILP32-ILP32F-FPELIM-NEXT: sw a5, 292(a6)
1701 ; ILP32-ILP32F-FPELIM-NEXT: lui a5, 24414
1702 ; ILP32-ILP32F-FPELIM-NEXT: add a5, sp, a5
1703 ; ILP32-ILP32F-FPELIM-NEXT: sw a4, 288(a5)
1704 ; ILP32-ILP32F-FPELIM-NEXT: lui a4, 24414
1705 ; ILP32-ILP32F-FPELIM-NEXT: add a4, sp, a4
1706 ; ILP32-ILP32F-FPELIM-NEXT: sw a3, 284(a4)
1707 ; ILP32-ILP32F-FPELIM-NEXT: lui a3, 24414
1708 ; ILP32-ILP32F-FPELIM-NEXT: add a3, sp, a3
1709 ; ILP32-ILP32F-FPELIM-NEXT: sw a2, 280(a3)
1710 ; ILP32-ILP32F-FPELIM-NEXT: lui a2, 24414
1711 ; ILP32-ILP32F-FPELIM-NEXT: add a2, sp, a2
1712 ; ILP32-ILP32F-FPELIM-NEXT: sw a1, 276(a2)
1713 ; ILP32-ILP32F-FPELIM-NEXT: lui a1, 24414
1714 ; ILP32-ILP32F-FPELIM-NEXT: addi a1, a1, 280
1715 ; ILP32-ILP32F-FPELIM-NEXT: add a1, sp, a1
1716 ; ILP32-ILP32F-FPELIM-NEXT: sw a1, 12(sp)
1717 ; ILP32-ILP32F-FPELIM-NEXT: lui a1, 24414
1718 ; ILP32-ILP32F-FPELIM-NEXT: addi a1, a1, 304
1719 ; ILP32-ILP32F-FPELIM-NEXT: add sp, sp, a1
1720 ; ILP32-ILP32F-FPELIM-NEXT: ret
1722 ; ILP32-ILP32F-WITHFP-LABEL: va_large_stack:
1723 ; ILP32-ILP32F-WITHFP: # %bb.0:
1724 ; ILP32-ILP32F-WITHFP-NEXT: addi sp, sp, -2032
1725 ; ILP32-ILP32F-WITHFP-NEXT: .cfi_def_cfa_offset 2032
1726 ; ILP32-ILP32F-WITHFP-NEXT: sw ra, 1996(sp) # 4-byte Folded Spill
1727 ; ILP32-ILP32F-WITHFP-NEXT: sw s0, 1992(sp) # 4-byte Folded Spill
1728 ; ILP32-ILP32F-WITHFP-NEXT: .cfi_offset ra, -36
1729 ; ILP32-ILP32F-WITHFP-NEXT: .cfi_offset s0, -40
1730 ; ILP32-ILP32F-WITHFP-NEXT: addi s0, sp, 2000
1731 ; ILP32-ILP32F-WITHFP-NEXT: .cfi_def_cfa s0, 32
1732 ; ILP32-ILP32F-WITHFP-NEXT: lui a0, 24414
1733 ; ILP32-ILP32F-WITHFP-NEXT: addi a0, a0, -1728
1734 ; ILP32-ILP32F-WITHFP-NEXT: sub sp, sp, a0
1735 ; ILP32-ILP32F-WITHFP-NEXT: mv a0, a1
1736 ; ILP32-ILP32F-WITHFP-NEXT: sw a7, 28(s0)
1737 ; ILP32-ILP32F-WITHFP-NEXT: sw a6, 24(s0)
1738 ; ILP32-ILP32F-WITHFP-NEXT: sw a5, 20(s0)
1739 ; ILP32-ILP32F-WITHFP-NEXT: sw a4, 16(s0)
1740 ; ILP32-ILP32F-WITHFP-NEXT: sw a3, 12(s0)
1741 ; ILP32-ILP32F-WITHFP-NEXT: sw a2, 8(s0)
1742 ; ILP32-ILP32F-WITHFP-NEXT: sw a1, 4(s0)
1743 ; ILP32-ILP32F-WITHFP-NEXT: addi a1, s0, 8
1744 ; ILP32-ILP32F-WITHFP-NEXT: lui a2, 24414
1745 ; ILP32-ILP32F-WITHFP-NEXT: sub a2, s0, a2
1746 ; ILP32-ILP32F-WITHFP-NEXT: sw a1, -272(a2)
1747 ; ILP32-ILP32F-WITHFP-NEXT: lui a1, 24414
1748 ; ILP32-ILP32F-WITHFP-NEXT: addi a1, a1, -1728
1749 ; ILP32-ILP32F-WITHFP-NEXT: add sp, sp, a1
1750 ; ILP32-ILP32F-WITHFP-NEXT: lw ra, 1996(sp) # 4-byte Folded Reload
1751 ; ILP32-ILP32F-WITHFP-NEXT: lw s0, 1992(sp) # 4-byte Folded Reload
1752 ; ILP32-ILP32F-WITHFP-NEXT: addi sp, sp, 2032
1753 ; ILP32-ILP32F-WITHFP-NEXT: ret
1755 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-LABEL: va_large_stack:
1756 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM: # %bb.0:
1757 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: lui a0, 24414
1758 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi a0, a0, 304
1759 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sub sp, sp, a0
1760 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: .cfi_def_cfa_offset 100000048
1761 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: mv a0, a1
1762 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: lui t0, 24414
1763 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: add t0, sp, t0
1764 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a7, 300(t0)
1765 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: lui a7, 24414
1766 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: add a7, sp, a7
1767 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a6, 296(a7)
1768 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: lui a6, 24414
1769 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: add a6, sp, a6
1770 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a5, 292(a6)
1771 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: lui a5, 24414
1772 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: add a5, sp, a5
1773 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a4, 288(a5)
1774 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: lui a4, 24414
1775 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: add a4, sp, a4
1776 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a3, 284(a4)
1777 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: lui a3, 24414
1778 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: add a3, sp, a3
1779 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a2, 280(a3)
1780 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: lui a2, 24414
1781 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: add a2, sp, a2
1782 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a1, 276(a2)
1783 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: lui a1, 24414
1784 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi a1, a1, 280
1785 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: add a1, sp, a1
1786 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: sw a1, 12(sp)
1787 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: lui a1, 24414
1788 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: addi a1, a1, 304
1789 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: add sp, sp, a1
1790 ; RV32D-ILP32-ILP32F-ILP32D-FPELIM-NEXT: ret
1792 ; LP64-LP64F-LP64D-FPELIM-LABEL: va_large_stack:
1793 ; LP64-LP64F-LP64D-FPELIM: # %bb.0:
1794 ; LP64-LP64F-LP64D-FPELIM-NEXT: lui a0, 24414
1795 ; LP64-LP64F-LP64D-FPELIM-NEXT: addiw a0, a0, 336
1796 ; LP64-LP64F-LP64D-FPELIM-NEXT: sub sp, sp, a0
1797 ; LP64-LP64F-LP64D-FPELIM-NEXT: .cfi_def_cfa_offset 100000080
1798 ; LP64-LP64F-LP64D-FPELIM-NEXT: lui a0, 24414
1799 ; LP64-LP64F-LP64D-FPELIM-NEXT: add a0, sp, a0
1800 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a1, 280(a0)
1801 ; LP64-LP64F-LP64D-FPELIM-NEXT: lui a0, 24414
1802 ; LP64-LP64F-LP64D-FPELIM-NEXT: add a0, sp, a0
1803 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a7, 328(a0)
1804 ; LP64-LP64F-LP64D-FPELIM-NEXT: lui a0, 24414
1805 ; LP64-LP64F-LP64D-FPELIM-NEXT: add a0, sp, a0
1806 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a6, 320(a0)
1807 ; LP64-LP64F-LP64D-FPELIM-NEXT: lui a0, 24414
1808 ; LP64-LP64F-LP64D-FPELIM-NEXT: add a0, sp, a0
1809 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a5, 312(a0)
1810 ; LP64-LP64F-LP64D-FPELIM-NEXT: lui a0, 24414
1811 ; LP64-LP64F-LP64D-FPELIM-NEXT: add a0, sp, a0
1812 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a4, 304(a0)
1813 ; LP64-LP64F-LP64D-FPELIM-NEXT: lui a0, 24414
1814 ; LP64-LP64F-LP64D-FPELIM-NEXT: add a0, sp, a0
1815 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a3, 296(a0)
1816 ; LP64-LP64F-LP64D-FPELIM-NEXT: lui a0, 24414
1817 ; LP64-LP64F-LP64D-FPELIM-NEXT: add a0, sp, a0
1818 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a2, 288(a0)
1819 ; LP64-LP64F-LP64D-FPELIM-NEXT: lui a0, 24414
1820 ; LP64-LP64F-LP64D-FPELIM-NEXT: addiw a0, a0, 284
1821 ; LP64-LP64F-LP64D-FPELIM-NEXT: add a0, sp, a0
1822 ; LP64-LP64F-LP64D-FPELIM-NEXT: sd a0, 8(sp)
1823 ; LP64-LP64F-LP64D-FPELIM-NEXT: lui a0, 24414
1824 ; LP64-LP64F-LP64D-FPELIM-NEXT: add a0, sp, a0
1825 ; LP64-LP64F-LP64D-FPELIM-NEXT: lw a0, 280(a0)
1826 ; LP64-LP64F-LP64D-FPELIM-NEXT: lui a1, 24414
1827 ; LP64-LP64F-LP64D-FPELIM-NEXT: addiw a1, a1, 336
1828 ; LP64-LP64F-LP64D-FPELIM-NEXT: add sp, sp, a1
1829 ; LP64-LP64F-LP64D-FPELIM-NEXT: ret
1831 ; LP64-LP64F-LP64D-WITHFP-LABEL: va_large_stack:
1832 ; LP64-LP64F-LP64D-WITHFP: # %bb.0:
1833 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi sp, sp, -2032
1834 ; LP64-LP64F-LP64D-WITHFP-NEXT: .cfi_def_cfa_offset 2032
1835 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd ra, 1960(sp) # 8-byte Folded Spill
1836 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd s0, 1952(sp) # 8-byte Folded Spill
1837 ; LP64-LP64F-LP64D-WITHFP-NEXT: .cfi_offset ra, -72
1838 ; LP64-LP64F-LP64D-WITHFP-NEXT: .cfi_offset s0, -80
1839 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi s0, sp, 1968
1840 ; LP64-LP64F-LP64D-WITHFP-NEXT: .cfi_def_cfa s0, 64
1841 ; LP64-LP64F-LP64D-WITHFP-NEXT: lui a0, 24414
1842 ; LP64-LP64F-LP64D-WITHFP-NEXT: addiw a0, a0, -1680
1843 ; LP64-LP64F-LP64D-WITHFP-NEXT: sub sp, sp, a0
1844 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a1, 8(s0)
1845 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a7, 56(s0)
1846 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a6, 48(s0)
1847 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a5, 40(s0)
1848 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a4, 32(s0)
1849 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a3, 24(s0)
1850 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a2, 16(s0)
1851 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi a0, s0, 12
1852 ; LP64-LP64F-LP64D-WITHFP-NEXT: lui a1, 24414
1853 ; LP64-LP64F-LP64D-WITHFP-NEXT: sub a1, s0, a1
1854 ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a0, -288(a1)
1855 ; LP64-LP64F-LP64D-WITHFP-NEXT: lw a0, 8(s0)
1856 ; LP64-LP64F-LP64D-WITHFP-NEXT: lui a1, 24414
1857 ; LP64-LP64F-LP64D-WITHFP-NEXT: addiw a1, a1, -1680
1858 ; LP64-LP64F-LP64D-WITHFP-NEXT: add sp, sp, a1
1859 ; LP64-LP64F-LP64D-WITHFP-NEXT: ld ra, 1960(sp) # 8-byte Folded Reload
1860 ; LP64-LP64F-LP64D-WITHFP-NEXT: ld s0, 1952(sp) # 8-byte Folded Reload
1861 ; LP64-LP64F-LP64D-WITHFP-NEXT: addi sp, sp, 2032
1862 ; LP64-LP64F-LP64D-WITHFP-NEXT: ret
1863 %large = alloca [ 100000000 x i8 ]
1865 call void @llvm.va_start(ptr %va)
1866 %argp.cur = load ptr, ptr %va, align 4
1867 %argp.next = getelementptr inbounds i8, ptr %argp.cur, i32 4
1868 store ptr %argp.next, ptr %va, align 4
1869 %1 = load i32, ptr %argp.cur, align 4
1870 call void @llvm.va_end(ptr %va)