1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple riscv32-unknown-elf -o - %s \
3 ; RUN: 2>&1 | FileCheck %s -check-prefix CHECK-RV32
4 ; RUN: llc -mtriple riscv32-unknown-elf -mattr=+f -o - %s \
5 ; RUN: 2>&1 | FileCheck %s -check-prefix CHECK-RV32IF
6 ; RUN: llc -mtriple riscv32-unknown-elf -mattr=+f,+d -o - %s \
7 ; RUN: 2>&1 | FileCheck %s -check-prefix CHECK-RV32IFD
9 ; TODO: Add RV64 tests when we can lower global addresses.
11 ; Checking all registers that are used are being saved.
12 ; This includes Caller (arguments and temps) and
13 ; Callee saved registers.
16 ; __attribute__((interrupt)) void foo_no_call(void) {
21 @a = external global i32
22 @b = external global i32
23 @c = external global i32
25 define void @foo_i32() nounwind #0 {
26 ; CHECK-RV32-LABEL: foo_i32:
27 ; CHECK-RV32: # %bb.0:
28 ; CHECK-RV32-NEXT: addi sp, sp, -16
29 ; CHECK-RV32-NEXT: sw a0, 12(sp) # 4-byte Folded Spill
30 ; CHECK-RV32-NEXT: sw a1, 8(sp) # 4-byte Folded Spill
31 ; CHECK-RV32-NEXT: lui a0, %hi(a)
32 ; CHECK-RV32-NEXT: lw a0, %lo(a)(a0)
33 ; CHECK-RV32-NEXT: lui a1, %hi(b)
34 ; CHECK-RV32-NEXT: lw a1, %lo(b)(a1)
35 ; CHECK-RV32-NEXT: add a0, a1, a0
36 ; CHECK-RV32-NEXT: lui a1, %hi(c)
37 ; CHECK-RV32-NEXT: sw a0, %lo(c)(a1)
38 ; CHECK-RV32-NEXT: lw a0, 12(sp) # 4-byte Folded Reload
39 ; CHECK-RV32-NEXT: lw a1, 8(sp) # 4-byte Folded Reload
40 ; CHECK-RV32-NEXT: addi sp, sp, 16
41 ; CHECK-RV32-NEXT: mret
43 ; CHECK-RV32IF-LABEL: foo_i32:
44 ; CHECK-RV32IF: # %bb.0:
45 ; CHECK-RV32IF-NEXT: addi sp, sp, -16
46 ; CHECK-RV32IF-NEXT: sw a0, 12(sp) # 4-byte Folded Spill
47 ; CHECK-RV32IF-NEXT: sw a1, 8(sp) # 4-byte Folded Spill
48 ; CHECK-RV32IF-NEXT: lui a0, %hi(a)
49 ; CHECK-RV32IF-NEXT: lw a0, %lo(a)(a0)
50 ; CHECK-RV32IF-NEXT: lui a1, %hi(b)
51 ; CHECK-RV32IF-NEXT: lw a1, %lo(b)(a1)
52 ; CHECK-RV32IF-NEXT: add a0, a1, a0
53 ; CHECK-RV32IF-NEXT: lui a1, %hi(c)
54 ; CHECK-RV32IF-NEXT: sw a0, %lo(c)(a1)
55 ; CHECK-RV32IF-NEXT: lw a0, 12(sp) # 4-byte Folded Reload
56 ; CHECK-RV32IF-NEXT: lw a1, 8(sp) # 4-byte Folded Reload
57 ; CHECK-RV32IF-NEXT: addi sp, sp, 16
58 ; CHECK-RV32IF-NEXT: mret
60 ; CHECK-RV32IFD-LABEL: foo_i32:
61 ; CHECK-RV32IFD: # %bb.0:
62 ; CHECK-RV32IFD-NEXT: addi sp, sp, -16
63 ; CHECK-RV32IFD-NEXT: sw a0, 12(sp) # 4-byte Folded Spill
64 ; CHECK-RV32IFD-NEXT: sw a1, 8(sp) # 4-byte Folded Spill
65 ; CHECK-RV32IFD-NEXT: lui a0, %hi(a)
66 ; CHECK-RV32IFD-NEXT: lw a0, %lo(a)(a0)
67 ; CHECK-RV32IFD-NEXT: lui a1, %hi(b)
68 ; CHECK-RV32IFD-NEXT: lw a1, %lo(b)(a1)
69 ; CHECK-RV32IFD-NEXT: add a0, a1, a0
70 ; CHECK-RV32IFD-NEXT: lui a1, %hi(c)
71 ; CHECK-RV32IFD-NEXT: sw a0, %lo(c)(a1)
72 ; CHECK-RV32IFD-NEXT: lw a0, 12(sp) # 4-byte Folded Reload
73 ; CHECK-RV32IFD-NEXT: lw a1, 8(sp) # 4-byte Folded Reload
74 ; CHECK-RV32IFD-NEXT: addi sp, sp, 16
75 ; CHECK-RV32IFD-NEXT: mret
78 %add = add nsw i32 %2, %1
79 store i32 %add, ptr @c
84 ; Additionally check frame pointer and return address are properly saved.
87 define void @foo_fp_i32() nounwind #1 {
88 ; CHECK-RV32-LABEL: foo_fp_i32:
89 ; CHECK-RV32: # %bb.0:
90 ; CHECK-RV32-NEXT: addi sp, sp, -16
91 ; CHECK-RV32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
92 ; CHECK-RV32-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
93 ; CHECK-RV32-NEXT: sw a0, 4(sp) # 4-byte Folded Spill
94 ; CHECK-RV32-NEXT: sw a1, 0(sp) # 4-byte Folded Spill
95 ; CHECK-RV32-NEXT: addi s0, sp, 16
96 ; CHECK-RV32-NEXT: lui a0, %hi(a)
97 ; CHECK-RV32-NEXT: lw a0, %lo(a)(a0)
98 ; CHECK-RV32-NEXT: lui a1, %hi(b)
99 ; CHECK-RV32-NEXT: lw a1, %lo(b)(a1)
100 ; CHECK-RV32-NEXT: add a0, a1, a0
101 ; CHECK-RV32-NEXT: lui a1, %hi(c)
102 ; CHECK-RV32-NEXT: sw a0, %lo(c)(a1)
103 ; CHECK-RV32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
104 ; CHECK-RV32-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
105 ; CHECK-RV32-NEXT: lw a0, 4(sp) # 4-byte Folded Reload
106 ; CHECK-RV32-NEXT: lw a1, 0(sp) # 4-byte Folded Reload
107 ; CHECK-RV32-NEXT: addi sp, sp, 16
108 ; CHECK-RV32-NEXT: mret
110 ; CHECK-RV32IF-LABEL: foo_fp_i32:
111 ; CHECK-RV32IF: # %bb.0:
112 ; CHECK-RV32IF-NEXT: addi sp, sp, -16
113 ; CHECK-RV32IF-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
114 ; CHECK-RV32IF-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
115 ; CHECK-RV32IF-NEXT: sw a0, 4(sp) # 4-byte Folded Spill
116 ; CHECK-RV32IF-NEXT: sw a1, 0(sp) # 4-byte Folded Spill
117 ; CHECK-RV32IF-NEXT: addi s0, sp, 16
118 ; CHECK-RV32IF-NEXT: lui a0, %hi(a)
119 ; CHECK-RV32IF-NEXT: lw a0, %lo(a)(a0)
120 ; CHECK-RV32IF-NEXT: lui a1, %hi(b)
121 ; CHECK-RV32IF-NEXT: lw a1, %lo(b)(a1)
122 ; CHECK-RV32IF-NEXT: add a0, a1, a0
123 ; CHECK-RV32IF-NEXT: lui a1, %hi(c)
124 ; CHECK-RV32IF-NEXT: sw a0, %lo(c)(a1)
125 ; CHECK-RV32IF-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
126 ; CHECK-RV32IF-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
127 ; CHECK-RV32IF-NEXT: lw a0, 4(sp) # 4-byte Folded Reload
128 ; CHECK-RV32IF-NEXT: lw a1, 0(sp) # 4-byte Folded Reload
129 ; CHECK-RV32IF-NEXT: addi sp, sp, 16
130 ; CHECK-RV32IF-NEXT: mret
132 ; CHECK-RV32IFD-LABEL: foo_fp_i32:
133 ; CHECK-RV32IFD: # %bb.0:
134 ; CHECK-RV32IFD-NEXT: addi sp, sp, -16
135 ; CHECK-RV32IFD-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
136 ; CHECK-RV32IFD-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
137 ; CHECK-RV32IFD-NEXT: sw a0, 4(sp) # 4-byte Folded Spill
138 ; CHECK-RV32IFD-NEXT: sw a1, 0(sp) # 4-byte Folded Spill
139 ; CHECK-RV32IFD-NEXT: addi s0, sp, 16
140 ; CHECK-RV32IFD-NEXT: lui a0, %hi(a)
141 ; CHECK-RV32IFD-NEXT: lw a0, %lo(a)(a0)
142 ; CHECK-RV32IFD-NEXT: lui a1, %hi(b)
143 ; CHECK-RV32IFD-NEXT: lw a1, %lo(b)(a1)
144 ; CHECK-RV32IFD-NEXT: add a0, a1, a0
145 ; CHECK-RV32IFD-NEXT: lui a1, %hi(c)
146 ; CHECK-RV32IFD-NEXT: sw a0, %lo(c)(a1)
147 ; CHECK-RV32IFD-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
148 ; CHECK-RV32IFD-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
149 ; CHECK-RV32IFD-NEXT: lw a0, 4(sp) # 4-byte Folded Reload
150 ; CHECK-RV32IFD-NEXT: lw a1, 0(sp) # 4-byte Folded Reload
151 ; CHECK-RV32IFD-NEXT: addi sp, sp, 16
152 ; CHECK-RV32IFD-NEXT: mret
153 %1 = load i32, ptr @a
154 %2 = load i32, ptr @b
155 %add = add nsw i32 %2, %1
156 store i32 %add, ptr @c
160 @e = external global float
161 @f = external global float
162 @d = external global float
164 define void @foo_float() nounwind #0 {
165 ; CHECK-RV32-LABEL: foo_float:
166 ; CHECK-RV32: # %bb.0:
167 ; CHECK-RV32-NEXT: addi sp, sp, -64
168 ; CHECK-RV32-NEXT: sw ra, 60(sp) # 4-byte Folded Spill
169 ; CHECK-RV32-NEXT: sw t0, 56(sp) # 4-byte Folded Spill
170 ; CHECK-RV32-NEXT: sw t1, 52(sp) # 4-byte Folded Spill
171 ; CHECK-RV32-NEXT: sw t2, 48(sp) # 4-byte Folded Spill
172 ; CHECK-RV32-NEXT: sw a0, 44(sp) # 4-byte Folded Spill
173 ; CHECK-RV32-NEXT: sw a1, 40(sp) # 4-byte Folded Spill
174 ; CHECK-RV32-NEXT: sw a2, 36(sp) # 4-byte Folded Spill
175 ; CHECK-RV32-NEXT: sw a3, 32(sp) # 4-byte Folded Spill
176 ; CHECK-RV32-NEXT: sw a4, 28(sp) # 4-byte Folded Spill
177 ; CHECK-RV32-NEXT: sw a5, 24(sp) # 4-byte Folded Spill
178 ; CHECK-RV32-NEXT: sw a6, 20(sp) # 4-byte Folded Spill
179 ; CHECK-RV32-NEXT: sw a7, 16(sp) # 4-byte Folded Spill
180 ; CHECK-RV32-NEXT: sw t3, 12(sp) # 4-byte Folded Spill
181 ; CHECK-RV32-NEXT: sw t4, 8(sp) # 4-byte Folded Spill
182 ; CHECK-RV32-NEXT: sw t5, 4(sp) # 4-byte Folded Spill
183 ; CHECK-RV32-NEXT: sw t6, 0(sp) # 4-byte Folded Spill
184 ; CHECK-RV32-NEXT: lui a0, %hi(e)
185 ; CHECK-RV32-NEXT: lw a0, %lo(e)(a0)
186 ; CHECK-RV32-NEXT: lui a1, %hi(f)
187 ; CHECK-RV32-NEXT: lw a1, %lo(f)(a1)
188 ; CHECK-RV32-NEXT: call __addsf3
189 ; CHECK-RV32-NEXT: lui a1, %hi(d)
190 ; CHECK-RV32-NEXT: sw a0, %lo(d)(a1)
191 ; CHECK-RV32-NEXT: lw ra, 60(sp) # 4-byte Folded Reload
192 ; CHECK-RV32-NEXT: lw t0, 56(sp) # 4-byte Folded Reload
193 ; CHECK-RV32-NEXT: lw t1, 52(sp) # 4-byte Folded Reload
194 ; CHECK-RV32-NEXT: lw t2, 48(sp) # 4-byte Folded Reload
195 ; CHECK-RV32-NEXT: lw a0, 44(sp) # 4-byte Folded Reload
196 ; CHECK-RV32-NEXT: lw a1, 40(sp) # 4-byte Folded Reload
197 ; CHECK-RV32-NEXT: lw a2, 36(sp) # 4-byte Folded Reload
198 ; CHECK-RV32-NEXT: lw a3, 32(sp) # 4-byte Folded Reload
199 ; CHECK-RV32-NEXT: lw a4, 28(sp) # 4-byte Folded Reload
200 ; CHECK-RV32-NEXT: lw a5, 24(sp) # 4-byte Folded Reload
201 ; CHECK-RV32-NEXT: lw a6, 20(sp) # 4-byte Folded Reload
202 ; CHECK-RV32-NEXT: lw a7, 16(sp) # 4-byte Folded Reload
203 ; CHECK-RV32-NEXT: lw t3, 12(sp) # 4-byte Folded Reload
204 ; CHECK-RV32-NEXT: lw t4, 8(sp) # 4-byte Folded Reload
205 ; CHECK-RV32-NEXT: lw t5, 4(sp) # 4-byte Folded Reload
206 ; CHECK-RV32-NEXT: lw t6, 0(sp) # 4-byte Folded Reload
207 ; CHECK-RV32-NEXT: addi sp, sp, 64
208 ; CHECK-RV32-NEXT: mret
210 ; CHECK-RV32IF-LABEL: foo_float:
211 ; CHECK-RV32IF: # %bb.0:
212 ; CHECK-RV32IF-NEXT: addi sp, sp, -16
213 ; CHECK-RV32IF-NEXT: sw a0, 12(sp) # 4-byte Folded Spill
214 ; CHECK-RV32IF-NEXT: fsw fa4, 8(sp) # 4-byte Folded Spill
215 ; CHECK-RV32IF-NEXT: fsw fa5, 4(sp) # 4-byte Folded Spill
216 ; CHECK-RV32IF-NEXT: lui a0, %hi(e)
217 ; CHECK-RV32IF-NEXT: flw fa5, %lo(e)(a0)
218 ; CHECK-RV32IF-NEXT: lui a0, %hi(f)
219 ; CHECK-RV32IF-NEXT: flw fa4, %lo(f)(a0)
220 ; CHECK-RV32IF-NEXT: fadd.s fa5, fa5, fa4
221 ; CHECK-RV32IF-NEXT: lui a0, %hi(d)
222 ; CHECK-RV32IF-NEXT: fsw fa5, %lo(d)(a0)
223 ; CHECK-RV32IF-NEXT: lw a0, 12(sp) # 4-byte Folded Reload
224 ; CHECK-RV32IF-NEXT: flw fa4, 8(sp) # 4-byte Folded Reload
225 ; CHECK-RV32IF-NEXT: flw fa5, 4(sp) # 4-byte Folded Reload
226 ; CHECK-RV32IF-NEXT: addi sp, sp, 16
227 ; CHECK-RV32IF-NEXT: mret
229 ; CHECK-RV32IFD-LABEL: foo_float:
230 ; CHECK-RV32IFD: # %bb.0:
231 ; CHECK-RV32IFD-NEXT: addi sp, sp, -32
232 ; CHECK-RV32IFD-NEXT: sw a0, 28(sp) # 4-byte Folded Spill
233 ; CHECK-RV32IFD-NEXT: fsd fa4, 16(sp) # 8-byte Folded Spill
234 ; CHECK-RV32IFD-NEXT: fsd fa5, 8(sp) # 8-byte Folded Spill
235 ; CHECK-RV32IFD-NEXT: lui a0, %hi(e)
236 ; CHECK-RV32IFD-NEXT: flw fa5, %lo(e)(a0)
237 ; CHECK-RV32IFD-NEXT: lui a0, %hi(f)
238 ; CHECK-RV32IFD-NEXT: flw fa4, %lo(f)(a0)
239 ; CHECK-RV32IFD-NEXT: fadd.s fa5, fa5, fa4
240 ; CHECK-RV32IFD-NEXT: lui a0, %hi(d)
241 ; CHECK-RV32IFD-NEXT: fsw fa5, %lo(d)(a0)
242 ; CHECK-RV32IFD-NEXT: lw a0, 28(sp) # 4-byte Folded Reload
243 ; CHECK-RV32IFD-NEXT: fld fa4, 16(sp) # 8-byte Folded Reload
244 ; CHECK-RV32IFD-NEXT: fld fa5, 8(sp) # 8-byte Folded Reload
245 ; CHECK-RV32IFD-NEXT: addi sp, sp, 32
246 ; CHECK-RV32IFD-NEXT: mret
247 %1 = load float, ptr @e
248 %2 = load float, ptr @f
249 %add = fadd float %1, %2
250 store float %add, ptr @d
255 ; Additionally check frame pointer and return address are properly saved.
257 define void @foo_fp_float() nounwind #1 {
258 ; CHECK-RV32-LABEL: foo_fp_float:
259 ; CHECK-RV32: # %bb.0:
260 ; CHECK-RV32-NEXT: addi sp, sp, -80
261 ; CHECK-RV32-NEXT: sw ra, 76(sp) # 4-byte Folded Spill
262 ; CHECK-RV32-NEXT: sw t0, 72(sp) # 4-byte Folded Spill
263 ; CHECK-RV32-NEXT: sw t1, 68(sp) # 4-byte Folded Spill
264 ; CHECK-RV32-NEXT: sw t2, 64(sp) # 4-byte Folded Spill
265 ; CHECK-RV32-NEXT: sw s0, 60(sp) # 4-byte Folded Spill
266 ; CHECK-RV32-NEXT: sw a0, 56(sp) # 4-byte Folded Spill
267 ; CHECK-RV32-NEXT: sw a1, 52(sp) # 4-byte Folded Spill
268 ; CHECK-RV32-NEXT: sw a2, 48(sp) # 4-byte Folded Spill
269 ; CHECK-RV32-NEXT: sw a3, 44(sp) # 4-byte Folded Spill
270 ; CHECK-RV32-NEXT: sw a4, 40(sp) # 4-byte Folded Spill
271 ; CHECK-RV32-NEXT: sw a5, 36(sp) # 4-byte Folded Spill
272 ; CHECK-RV32-NEXT: sw a6, 32(sp) # 4-byte Folded Spill
273 ; CHECK-RV32-NEXT: sw a7, 28(sp) # 4-byte Folded Spill
274 ; CHECK-RV32-NEXT: sw t3, 24(sp) # 4-byte Folded Spill
275 ; CHECK-RV32-NEXT: sw t4, 20(sp) # 4-byte Folded Spill
276 ; CHECK-RV32-NEXT: sw t5, 16(sp) # 4-byte Folded Spill
277 ; CHECK-RV32-NEXT: sw t6, 12(sp) # 4-byte Folded Spill
278 ; CHECK-RV32-NEXT: addi s0, sp, 80
279 ; CHECK-RV32-NEXT: lui a0, %hi(e)
280 ; CHECK-RV32-NEXT: lw a0, %lo(e)(a0)
281 ; CHECK-RV32-NEXT: lui a1, %hi(f)
282 ; CHECK-RV32-NEXT: lw a1, %lo(f)(a1)
283 ; CHECK-RV32-NEXT: call __addsf3
284 ; CHECK-RV32-NEXT: lui a1, %hi(d)
285 ; CHECK-RV32-NEXT: sw a0, %lo(d)(a1)
286 ; CHECK-RV32-NEXT: lw ra, 76(sp) # 4-byte Folded Reload
287 ; CHECK-RV32-NEXT: lw t0, 72(sp) # 4-byte Folded Reload
288 ; CHECK-RV32-NEXT: lw t1, 68(sp) # 4-byte Folded Reload
289 ; CHECK-RV32-NEXT: lw t2, 64(sp) # 4-byte Folded Reload
290 ; CHECK-RV32-NEXT: lw s0, 60(sp) # 4-byte Folded Reload
291 ; CHECK-RV32-NEXT: lw a0, 56(sp) # 4-byte Folded Reload
292 ; CHECK-RV32-NEXT: lw a1, 52(sp) # 4-byte Folded Reload
293 ; CHECK-RV32-NEXT: lw a2, 48(sp) # 4-byte Folded Reload
294 ; CHECK-RV32-NEXT: lw a3, 44(sp) # 4-byte Folded Reload
295 ; CHECK-RV32-NEXT: lw a4, 40(sp) # 4-byte Folded Reload
296 ; CHECK-RV32-NEXT: lw a5, 36(sp) # 4-byte Folded Reload
297 ; CHECK-RV32-NEXT: lw a6, 32(sp) # 4-byte Folded Reload
298 ; CHECK-RV32-NEXT: lw a7, 28(sp) # 4-byte Folded Reload
299 ; CHECK-RV32-NEXT: lw t3, 24(sp) # 4-byte Folded Reload
300 ; CHECK-RV32-NEXT: lw t4, 20(sp) # 4-byte Folded Reload
301 ; CHECK-RV32-NEXT: lw t5, 16(sp) # 4-byte Folded Reload
302 ; CHECK-RV32-NEXT: lw t6, 12(sp) # 4-byte Folded Reload
303 ; CHECK-RV32-NEXT: addi sp, sp, 80
304 ; CHECK-RV32-NEXT: mret
306 ; CHECK-RV32IF-LABEL: foo_fp_float:
307 ; CHECK-RV32IF: # %bb.0:
308 ; CHECK-RV32IF-NEXT: addi sp, sp, -32
309 ; CHECK-RV32IF-NEXT: sw ra, 28(sp) # 4-byte Folded Spill
310 ; CHECK-RV32IF-NEXT: sw s0, 24(sp) # 4-byte Folded Spill
311 ; CHECK-RV32IF-NEXT: sw a0, 20(sp) # 4-byte Folded Spill
312 ; CHECK-RV32IF-NEXT: fsw fa4, 16(sp) # 4-byte Folded Spill
313 ; CHECK-RV32IF-NEXT: fsw fa5, 12(sp) # 4-byte Folded Spill
314 ; CHECK-RV32IF-NEXT: addi s0, sp, 32
315 ; CHECK-RV32IF-NEXT: lui a0, %hi(e)
316 ; CHECK-RV32IF-NEXT: flw fa5, %lo(e)(a0)
317 ; CHECK-RV32IF-NEXT: lui a0, %hi(f)
318 ; CHECK-RV32IF-NEXT: flw fa4, %lo(f)(a0)
319 ; CHECK-RV32IF-NEXT: fadd.s fa5, fa5, fa4
320 ; CHECK-RV32IF-NEXT: lui a0, %hi(d)
321 ; CHECK-RV32IF-NEXT: fsw fa5, %lo(d)(a0)
322 ; CHECK-RV32IF-NEXT: lw ra, 28(sp) # 4-byte Folded Reload
323 ; CHECK-RV32IF-NEXT: lw s0, 24(sp) # 4-byte Folded Reload
324 ; CHECK-RV32IF-NEXT: lw a0, 20(sp) # 4-byte Folded Reload
325 ; CHECK-RV32IF-NEXT: flw fa4, 16(sp) # 4-byte Folded Reload
326 ; CHECK-RV32IF-NEXT: flw fa5, 12(sp) # 4-byte Folded Reload
327 ; CHECK-RV32IF-NEXT: addi sp, sp, 32
328 ; CHECK-RV32IF-NEXT: mret
330 ; CHECK-RV32IFD-LABEL: foo_fp_float:
331 ; CHECK-RV32IFD: # %bb.0:
332 ; CHECK-RV32IFD-NEXT: addi sp, sp, -32
333 ; CHECK-RV32IFD-NEXT: sw ra, 28(sp) # 4-byte Folded Spill
334 ; CHECK-RV32IFD-NEXT: sw s0, 24(sp) # 4-byte Folded Spill
335 ; CHECK-RV32IFD-NEXT: sw a0, 20(sp) # 4-byte Folded Spill
336 ; CHECK-RV32IFD-NEXT: fsd fa4, 8(sp) # 8-byte Folded Spill
337 ; CHECK-RV32IFD-NEXT: fsd fa5, 0(sp) # 8-byte Folded Spill
338 ; CHECK-RV32IFD-NEXT: addi s0, sp, 32
339 ; CHECK-RV32IFD-NEXT: lui a0, %hi(e)
340 ; CHECK-RV32IFD-NEXT: flw fa5, %lo(e)(a0)
341 ; CHECK-RV32IFD-NEXT: lui a0, %hi(f)
342 ; CHECK-RV32IFD-NEXT: flw fa4, %lo(f)(a0)
343 ; CHECK-RV32IFD-NEXT: fadd.s fa5, fa5, fa4
344 ; CHECK-RV32IFD-NEXT: lui a0, %hi(d)
345 ; CHECK-RV32IFD-NEXT: fsw fa5, %lo(d)(a0)
346 ; CHECK-RV32IFD-NEXT: lw ra, 28(sp) # 4-byte Folded Reload
347 ; CHECK-RV32IFD-NEXT: lw s0, 24(sp) # 4-byte Folded Reload
348 ; CHECK-RV32IFD-NEXT: lw a0, 20(sp) # 4-byte Folded Reload
349 ; CHECK-RV32IFD-NEXT: fld fa4, 8(sp) # 8-byte Folded Reload
350 ; CHECK-RV32IFD-NEXT: fld fa5, 0(sp) # 8-byte Folded Reload
351 ; CHECK-RV32IFD-NEXT: addi sp, sp, 32
352 ; CHECK-RV32IFD-NEXT: mret
353 %1 = load float, ptr @e
354 %2 = load float, ptr @f
355 %add = fadd float %1, %2
356 store float %add, ptr @d
360 @h = external global double
361 @i = external global double
362 @g = external global double
364 define void @foo_double() nounwind #0 {
365 ; CHECK-RV32-LABEL: foo_double:
366 ; CHECK-RV32: # %bb.0:
367 ; CHECK-RV32-NEXT: addi sp, sp, -64
368 ; CHECK-RV32-NEXT: sw ra, 60(sp) # 4-byte Folded Spill
369 ; CHECK-RV32-NEXT: sw t0, 56(sp) # 4-byte Folded Spill
370 ; CHECK-RV32-NEXT: sw t1, 52(sp) # 4-byte Folded Spill
371 ; CHECK-RV32-NEXT: sw t2, 48(sp) # 4-byte Folded Spill
372 ; CHECK-RV32-NEXT: sw a0, 44(sp) # 4-byte Folded Spill
373 ; CHECK-RV32-NEXT: sw a1, 40(sp) # 4-byte Folded Spill
374 ; CHECK-RV32-NEXT: sw a2, 36(sp) # 4-byte Folded Spill
375 ; CHECK-RV32-NEXT: sw a3, 32(sp) # 4-byte Folded Spill
376 ; CHECK-RV32-NEXT: sw a4, 28(sp) # 4-byte Folded Spill
377 ; CHECK-RV32-NEXT: sw a5, 24(sp) # 4-byte Folded Spill
378 ; CHECK-RV32-NEXT: sw a6, 20(sp) # 4-byte Folded Spill
379 ; CHECK-RV32-NEXT: sw a7, 16(sp) # 4-byte Folded Spill
380 ; CHECK-RV32-NEXT: sw t3, 12(sp) # 4-byte Folded Spill
381 ; CHECK-RV32-NEXT: sw t4, 8(sp) # 4-byte Folded Spill
382 ; CHECK-RV32-NEXT: sw t5, 4(sp) # 4-byte Folded Spill
383 ; CHECK-RV32-NEXT: sw t6, 0(sp) # 4-byte Folded Spill
384 ; CHECK-RV32-NEXT: lui a1, %hi(h)
385 ; CHECK-RV32-NEXT: lw a0, %lo(h)(a1)
386 ; CHECK-RV32-NEXT: lw a1, %lo(h+4)(a1)
387 ; CHECK-RV32-NEXT: lui a3, %hi(i)
388 ; CHECK-RV32-NEXT: lw a2, %lo(i)(a3)
389 ; CHECK-RV32-NEXT: lw a3, %lo(i+4)(a3)
390 ; CHECK-RV32-NEXT: call __adddf3
391 ; CHECK-RV32-NEXT: lui a2, %hi(g)
392 ; CHECK-RV32-NEXT: sw a1, %lo(g+4)(a2)
393 ; CHECK-RV32-NEXT: sw a0, %lo(g)(a2)
394 ; CHECK-RV32-NEXT: lw ra, 60(sp) # 4-byte Folded Reload
395 ; CHECK-RV32-NEXT: lw t0, 56(sp) # 4-byte Folded Reload
396 ; CHECK-RV32-NEXT: lw t1, 52(sp) # 4-byte Folded Reload
397 ; CHECK-RV32-NEXT: lw t2, 48(sp) # 4-byte Folded Reload
398 ; CHECK-RV32-NEXT: lw a0, 44(sp) # 4-byte Folded Reload
399 ; CHECK-RV32-NEXT: lw a1, 40(sp) # 4-byte Folded Reload
400 ; CHECK-RV32-NEXT: lw a2, 36(sp) # 4-byte Folded Reload
401 ; CHECK-RV32-NEXT: lw a3, 32(sp) # 4-byte Folded Reload
402 ; CHECK-RV32-NEXT: lw a4, 28(sp) # 4-byte Folded Reload
403 ; CHECK-RV32-NEXT: lw a5, 24(sp) # 4-byte Folded Reload
404 ; CHECK-RV32-NEXT: lw a6, 20(sp) # 4-byte Folded Reload
405 ; CHECK-RV32-NEXT: lw a7, 16(sp) # 4-byte Folded Reload
406 ; CHECK-RV32-NEXT: lw t3, 12(sp) # 4-byte Folded Reload
407 ; CHECK-RV32-NEXT: lw t4, 8(sp) # 4-byte Folded Reload
408 ; CHECK-RV32-NEXT: lw t5, 4(sp) # 4-byte Folded Reload
409 ; CHECK-RV32-NEXT: lw t6, 0(sp) # 4-byte Folded Reload
410 ; CHECK-RV32-NEXT: addi sp, sp, 64
411 ; CHECK-RV32-NEXT: mret
413 ; CHECK-RV32IF-LABEL: foo_double:
414 ; CHECK-RV32IF: # %bb.0:
415 ; CHECK-RV32IF-NEXT: addi sp, sp, -144
416 ; CHECK-RV32IF-NEXT: sw ra, 140(sp) # 4-byte Folded Spill
417 ; CHECK-RV32IF-NEXT: sw t0, 136(sp) # 4-byte Folded Spill
418 ; CHECK-RV32IF-NEXT: sw t1, 132(sp) # 4-byte Folded Spill
419 ; CHECK-RV32IF-NEXT: sw t2, 128(sp) # 4-byte Folded Spill
420 ; CHECK-RV32IF-NEXT: sw a0, 124(sp) # 4-byte Folded Spill
421 ; CHECK-RV32IF-NEXT: sw a1, 120(sp) # 4-byte Folded Spill
422 ; CHECK-RV32IF-NEXT: sw a2, 116(sp) # 4-byte Folded Spill
423 ; CHECK-RV32IF-NEXT: sw a3, 112(sp) # 4-byte Folded Spill
424 ; CHECK-RV32IF-NEXT: sw a4, 108(sp) # 4-byte Folded Spill
425 ; CHECK-RV32IF-NEXT: sw a5, 104(sp) # 4-byte Folded Spill
426 ; CHECK-RV32IF-NEXT: sw a6, 100(sp) # 4-byte Folded Spill
427 ; CHECK-RV32IF-NEXT: sw a7, 96(sp) # 4-byte Folded Spill
428 ; CHECK-RV32IF-NEXT: sw t3, 92(sp) # 4-byte Folded Spill
429 ; CHECK-RV32IF-NEXT: sw t4, 88(sp) # 4-byte Folded Spill
430 ; CHECK-RV32IF-NEXT: sw t5, 84(sp) # 4-byte Folded Spill
431 ; CHECK-RV32IF-NEXT: sw t6, 80(sp) # 4-byte Folded Spill
432 ; CHECK-RV32IF-NEXT: fsw ft0, 76(sp) # 4-byte Folded Spill
433 ; CHECK-RV32IF-NEXT: fsw ft1, 72(sp) # 4-byte Folded Spill
434 ; CHECK-RV32IF-NEXT: fsw ft2, 68(sp) # 4-byte Folded Spill
435 ; CHECK-RV32IF-NEXT: fsw ft3, 64(sp) # 4-byte Folded Spill
436 ; CHECK-RV32IF-NEXT: fsw ft4, 60(sp) # 4-byte Folded Spill
437 ; CHECK-RV32IF-NEXT: fsw ft5, 56(sp) # 4-byte Folded Spill
438 ; CHECK-RV32IF-NEXT: fsw ft6, 52(sp) # 4-byte Folded Spill
439 ; CHECK-RV32IF-NEXT: fsw ft7, 48(sp) # 4-byte Folded Spill
440 ; CHECK-RV32IF-NEXT: fsw fa0, 44(sp) # 4-byte Folded Spill
441 ; CHECK-RV32IF-NEXT: fsw fa1, 40(sp) # 4-byte Folded Spill
442 ; CHECK-RV32IF-NEXT: fsw fa2, 36(sp) # 4-byte Folded Spill
443 ; CHECK-RV32IF-NEXT: fsw fa3, 32(sp) # 4-byte Folded Spill
444 ; CHECK-RV32IF-NEXT: fsw fa4, 28(sp) # 4-byte Folded Spill
445 ; CHECK-RV32IF-NEXT: fsw fa5, 24(sp) # 4-byte Folded Spill
446 ; CHECK-RV32IF-NEXT: fsw fa6, 20(sp) # 4-byte Folded Spill
447 ; CHECK-RV32IF-NEXT: fsw fa7, 16(sp) # 4-byte Folded Spill
448 ; CHECK-RV32IF-NEXT: fsw ft8, 12(sp) # 4-byte Folded Spill
449 ; CHECK-RV32IF-NEXT: fsw ft9, 8(sp) # 4-byte Folded Spill
450 ; CHECK-RV32IF-NEXT: fsw ft10, 4(sp) # 4-byte Folded Spill
451 ; CHECK-RV32IF-NEXT: fsw ft11, 0(sp) # 4-byte Folded Spill
452 ; CHECK-RV32IF-NEXT: lui a1, %hi(h)
453 ; CHECK-RV32IF-NEXT: lw a0, %lo(h)(a1)
454 ; CHECK-RV32IF-NEXT: lw a1, %lo(h+4)(a1)
455 ; CHECK-RV32IF-NEXT: lui a3, %hi(i)
456 ; CHECK-RV32IF-NEXT: lw a2, %lo(i)(a3)
457 ; CHECK-RV32IF-NEXT: lw a3, %lo(i+4)(a3)
458 ; CHECK-RV32IF-NEXT: call __adddf3
459 ; CHECK-RV32IF-NEXT: lui a2, %hi(g)
460 ; CHECK-RV32IF-NEXT: sw a1, %lo(g+4)(a2)
461 ; CHECK-RV32IF-NEXT: sw a0, %lo(g)(a2)
462 ; CHECK-RV32IF-NEXT: lw ra, 140(sp) # 4-byte Folded Reload
463 ; CHECK-RV32IF-NEXT: lw t0, 136(sp) # 4-byte Folded Reload
464 ; CHECK-RV32IF-NEXT: lw t1, 132(sp) # 4-byte Folded Reload
465 ; CHECK-RV32IF-NEXT: lw t2, 128(sp) # 4-byte Folded Reload
466 ; CHECK-RV32IF-NEXT: lw a0, 124(sp) # 4-byte Folded Reload
467 ; CHECK-RV32IF-NEXT: lw a1, 120(sp) # 4-byte Folded Reload
468 ; CHECK-RV32IF-NEXT: lw a2, 116(sp) # 4-byte Folded Reload
469 ; CHECK-RV32IF-NEXT: lw a3, 112(sp) # 4-byte Folded Reload
470 ; CHECK-RV32IF-NEXT: lw a4, 108(sp) # 4-byte Folded Reload
471 ; CHECK-RV32IF-NEXT: lw a5, 104(sp) # 4-byte Folded Reload
472 ; CHECK-RV32IF-NEXT: lw a6, 100(sp) # 4-byte Folded Reload
473 ; CHECK-RV32IF-NEXT: lw a7, 96(sp) # 4-byte Folded Reload
474 ; CHECK-RV32IF-NEXT: lw t3, 92(sp) # 4-byte Folded Reload
475 ; CHECK-RV32IF-NEXT: lw t4, 88(sp) # 4-byte Folded Reload
476 ; CHECK-RV32IF-NEXT: lw t5, 84(sp) # 4-byte Folded Reload
477 ; CHECK-RV32IF-NEXT: lw t6, 80(sp) # 4-byte Folded Reload
478 ; CHECK-RV32IF-NEXT: flw ft0, 76(sp) # 4-byte Folded Reload
479 ; CHECK-RV32IF-NEXT: flw ft1, 72(sp) # 4-byte Folded Reload
480 ; CHECK-RV32IF-NEXT: flw ft2, 68(sp) # 4-byte Folded Reload
481 ; CHECK-RV32IF-NEXT: flw ft3, 64(sp) # 4-byte Folded Reload
482 ; CHECK-RV32IF-NEXT: flw ft4, 60(sp) # 4-byte Folded Reload
483 ; CHECK-RV32IF-NEXT: flw ft5, 56(sp) # 4-byte Folded Reload
484 ; CHECK-RV32IF-NEXT: flw ft6, 52(sp) # 4-byte Folded Reload
485 ; CHECK-RV32IF-NEXT: flw ft7, 48(sp) # 4-byte Folded Reload
486 ; CHECK-RV32IF-NEXT: flw fa0, 44(sp) # 4-byte Folded Reload
487 ; CHECK-RV32IF-NEXT: flw fa1, 40(sp) # 4-byte Folded Reload
488 ; CHECK-RV32IF-NEXT: flw fa2, 36(sp) # 4-byte Folded Reload
489 ; CHECK-RV32IF-NEXT: flw fa3, 32(sp) # 4-byte Folded Reload
490 ; CHECK-RV32IF-NEXT: flw fa4, 28(sp) # 4-byte Folded Reload
491 ; CHECK-RV32IF-NEXT: flw fa5, 24(sp) # 4-byte Folded Reload
492 ; CHECK-RV32IF-NEXT: flw fa6, 20(sp) # 4-byte Folded Reload
493 ; CHECK-RV32IF-NEXT: flw fa7, 16(sp) # 4-byte Folded Reload
494 ; CHECK-RV32IF-NEXT: flw ft8, 12(sp) # 4-byte Folded Reload
495 ; CHECK-RV32IF-NEXT: flw ft9, 8(sp) # 4-byte Folded Reload
496 ; CHECK-RV32IF-NEXT: flw ft10, 4(sp) # 4-byte Folded Reload
497 ; CHECK-RV32IF-NEXT: flw ft11, 0(sp) # 4-byte Folded Reload
498 ; CHECK-RV32IF-NEXT: addi sp, sp, 144
499 ; CHECK-RV32IF-NEXT: mret
501 ; CHECK-RV32IFD-LABEL: foo_double:
502 ; CHECK-RV32IFD: # %bb.0:
503 ; CHECK-RV32IFD-NEXT: addi sp, sp, -32
504 ; CHECK-RV32IFD-NEXT: sw a0, 28(sp) # 4-byte Folded Spill
505 ; CHECK-RV32IFD-NEXT: fsd fa4, 16(sp) # 8-byte Folded Spill
506 ; CHECK-RV32IFD-NEXT: fsd fa5, 8(sp) # 8-byte Folded Spill
507 ; CHECK-RV32IFD-NEXT: lui a0, %hi(h)
508 ; CHECK-RV32IFD-NEXT: fld fa5, %lo(h)(a0)
509 ; CHECK-RV32IFD-NEXT: lui a0, %hi(i)
510 ; CHECK-RV32IFD-NEXT: fld fa4, %lo(i)(a0)
511 ; CHECK-RV32IFD-NEXT: fadd.d fa5, fa5, fa4
512 ; CHECK-RV32IFD-NEXT: lui a0, %hi(g)
513 ; CHECK-RV32IFD-NEXT: fsd fa5, %lo(g)(a0)
514 ; CHECK-RV32IFD-NEXT: lw a0, 28(sp) # 4-byte Folded Reload
515 ; CHECK-RV32IFD-NEXT: fld fa4, 16(sp) # 8-byte Folded Reload
516 ; CHECK-RV32IFD-NEXT: fld fa5, 8(sp) # 8-byte Folded Reload
517 ; CHECK-RV32IFD-NEXT: addi sp, sp, 32
518 ; CHECK-RV32IFD-NEXT: mret
519 %1 = load double, ptr @h
520 %2 = load double, ptr @i
521 %add = fadd double %1, %2
522 store double %add, ptr @g
527 ; Additionally check frame pointer and return address are properly saved.
529 define void @foo_fp_double() nounwind #1 {
530 ; CHECK-RV32-LABEL: foo_fp_double:
531 ; CHECK-RV32: # %bb.0:
532 ; CHECK-RV32-NEXT: addi sp, sp, -80
533 ; CHECK-RV32-NEXT: sw ra, 76(sp) # 4-byte Folded Spill
534 ; CHECK-RV32-NEXT: sw t0, 72(sp) # 4-byte Folded Spill
535 ; CHECK-RV32-NEXT: sw t1, 68(sp) # 4-byte Folded Spill
536 ; CHECK-RV32-NEXT: sw t2, 64(sp) # 4-byte Folded Spill
537 ; CHECK-RV32-NEXT: sw s0, 60(sp) # 4-byte Folded Spill
538 ; CHECK-RV32-NEXT: sw a0, 56(sp) # 4-byte Folded Spill
539 ; CHECK-RV32-NEXT: sw a1, 52(sp) # 4-byte Folded Spill
540 ; CHECK-RV32-NEXT: sw a2, 48(sp) # 4-byte Folded Spill
541 ; CHECK-RV32-NEXT: sw a3, 44(sp) # 4-byte Folded Spill
542 ; CHECK-RV32-NEXT: sw a4, 40(sp) # 4-byte Folded Spill
543 ; CHECK-RV32-NEXT: sw a5, 36(sp) # 4-byte Folded Spill
544 ; CHECK-RV32-NEXT: sw a6, 32(sp) # 4-byte Folded Spill
545 ; CHECK-RV32-NEXT: sw a7, 28(sp) # 4-byte Folded Spill
546 ; CHECK-RV32-NEXT: sw t3, 24(sp) # 4-byte Folded Spill
547 ; CHECK-RV32-NEXT: sw t4, 20(sp) # 4-byte Folded Spill
548 ; CHECK-RV32-NEXT: sw t5, 16(sp) # 4-byte Folded Spill
549 ; CHECK-RV32-NEXT: sw t6, 12(sp) # 4-byte Folded Spill
550 ; CHECK-RV32-NEXT: addi s0, sp, 80
551 ; CHECK-RV32-NEXT: lui a1, %hi(h)
552 ; CHECK-RV32-NEXT: lw a0, %lo(h)(a1)
553 ; CHECK-RV32-NEXT: lw a1, %lo(h+4)(a1)
554 ; CHECK-RV32-NEXT: lui a3, %hi(i)
555 ; CHECK-RV32-NEXT: lw a2, %lo(i)(a3)
556 ; CHECK-RV32-NEXT: lw a3, %lo(i+4)(a3)
557 ; CHECK-RV32-NEXT: call __adddf3
558 ; CHECK-RV32-NEXT: lui a2, %hi(g)
559 ; CHECK-RV32-NEXT: sw a1, %lo(g+4)(a2)
560 ; CHECK-RV32-NEXT: sw a0, %lo(g)(a2)
561 ; CHECK-RV32-NEXT: lw ra, 76(sp) # 4-byte Folded Reload
562 ; CHECK-RV32-NEXT: lw t0, 72(sp) # 4-byte Folded Reload
563 ; CHECK-RV32-NEXT: lw t1, 68(sp) # 4-byte Folded Reload
564 ; CHECK-RV32-NEXT: lw t2, 64(sp) # 4-byte Folded Reload
565 ; CHECK-RV32-NEXT: lw s0, 60(sp) # 4-byte Folded Reload
566 ; CHECK-RV32-NEXT: lw a0, 56(sp) # 4-byte Folded Reload
567 ; CHECK-RV32-NEXT: lw a1, 52(sp) # 4-byte Folded Reload
568 ; CHECK-RV32-NEXT: lw a2, 48(sp) # 4-byte Folded Reload
569 ; CHECK-RV32-NEXT: lw a3, 44(sp) # 4-byte Folded Reload
570 ; CHECK-RV32-NEXT: lw a4, 40(sp) # 4-byte Folded Reload
571 ; CHECK-RV32-NEXT: lw a5, 36(sp) # 4-byte Folded Reload
572 ; CHECK-RV32-NEXT: lw a6, 32(sp) # 4-byte Folded Reload
573 ; CHECK-RV32-NEXT: lw a7, 28(sp) # 4-byte Folded Reload
574 ; CHECK-RV32-NEXT: lw t3, 24(sp) # 4-byte Folded Reload
575 ; CHECK-RV32-NEXT: lw t4, 20(sp) # 4-byte Folded Reload
576 ; CHECK-RV32-NEXT: lw t5, 16(sp) # 4-byte Folded Reload
577 ; CHECK-RV32-NEXT: lw t6, 12(sp) # 4-byte Folded Reload
578 ; CHECK-RV32-NEXT: addi sp, sp, 80
579 ; CHECK-RV32-NEXT: mret
581 ; CHECK-RV32IF-LABEL: foo_fp_double:
582 ; CHECK-RV32IF: # %bb.0:
583 ; CHECK-RV32IF-NEXT: addi sp, sp, -160
584 ; CHECK-RV32IF-NEXT: sw ra, 156(sp) # 4-byte Folded Spill
585 ; CHECK-RV32IF-NEXT: sw t0, 152(sp) # 4-byte Folded Spill
586 ; CHECK-RV32IF-NEXT: sw t1, 148(sp) # 4-byte Folded Spill
587 ; CHECK-RV32IF-NEXT: sw t2, 144(sp) # 4-byte Folded Spill
588 ; CHECK-RV32IF-NEXT: sw s0, 140(sp) # 4-byte Folded Spill
589 ; CHECK-RV32IF-NEXT: sw a0, 136(sp) # 4-byte Folded Spill
590 ; CHECK-RV32IF-NEXT: sw a1, 132(sp) # 4-byte Folded Spill
591 ; CHECK-RV32IF-NEXT: sw a2, 128(sp) # 4-byte Folded Spill
592 ; CHECK-RV32IF-NEXT: sw a3, 124(sp) # 4-byte Folded Spill
593 ; CHECK-RV32IF-NEXT: sw a4, 120(sp) # 4-byte Folded Spill
594 ; CHECK-RV32IF-NEXT: sw a5, 116(sp) # 4-byte Folded Spill
595 ; CHECK-RV32IF-NEXT: sw a6, 112(sp) # 4-byte Folded Spill
596 ; CHECK-RV32IF-NEXT: sw a7, 108(sp) # 4-byte Folded Spill
597 ; CHECK-RV32IF-NEXT: sw t3, 104(sp) # 4-byte Folded Spill
598 ; CHECK-RV32IF-NEXT: sw t4, 100(sp) # 4-byte Folded Spill
599 ; CHECK-RV32IF-NEXT: sw t5, 96(sp) # 4-byte Folded Spill
600 ; CHECK-RV32IF-NEXT: sw t6, 92(sp) # 4-byte Folded Spill
601 ; CHECK-RV32IF-NEXT: fsw ft0, 88(sp) # 4-byte Folded Spill
602 ; CHECK-RV32IF-NEXT: fsw ft1, 84(sp) # 4-byte Folded Spill
603 ; CHECK-RV32IF-NEXT: fsw ft2, 80(sp) # 4-byte Folded Spill
604 ; CHECK-RV32IF-NEXT: fsw ft3, 76(sp) # 4-byte Folded Spill
605 ; CHECK-RV32IF-NEXT: fsw ft4, 72(sp) # 4-byte Folded Spill
606 ; CHECK-RV32IF-NEXT: fsw ft5, 68(sp) # 4-byte Folded Spill
607 ; CHECK-RV32IF-NEXT: fsw ft6, 64(sp) # 4-byte Folded Spill
608 ; CHECK-RV32IF-NEXT: fsw ft7, 60(sp) # 4-byte Folded Spill
609 ; CHECK-RV32IF-NEXT: fsw fa0, 56(sp) # 4-byte Folded Spill
610 ; CHECK-RV32IF-NEXT: fsw fa1, 52(sp) # 4-byte Folded Spill
611 ; CHECK-RV32IF-NEXT: fsw fa2, 48(sp) # 4-byte Folded Spill
612 ; CHECK-RV32IF-NEXT: fsw fa3, 44(sp) # 4-byte Folded Spill
613 ; CHECK-RV32IF-NEXT: fsw fa4, 40(sp) # 4-byte Folded Spill
614 ; CHECK-RV32IF-NEXT: fsw fa5, 36(sp) # 4-byte Folded Spill
615 ; CHECK-RV32IF-NEXT: fsw fa6, 32(sp) # 4-byte Folded Spill
616 ; CHECK-RV32IF-NEXT: fsw fa7, 28(sp) # 4-byte Folded Spill
617 ; CHECK-RV32IF-NEXT: fsw ft8, 24(sp) # 4-byte Folded Spill
618 ; CHECK-RV32IF-NEXT: fsw ft9, 20(sp) # 4-byte Folded Spill
619 ; CHECK-RV32IF-NEXT: fsw ft10, 16(sp) # 4-byte Folded Spill
620 ; CHECK-RV32IF-NEXT: fsw ft11, 12(sp) # 4-byte Folded Spill
621 ; CHECK-RV32IF-NEXT: addi s0, sp, 160
622 ; CHECK-RV32IF-NEXT: lui a1, %hi(h)
623 ; CHECK-RV32IF-NEXT: lw a0, %lo(h)(a1)
624 ; CHECK-RV32IF-NEXT: lw a1, %lo(h+4)(a1)
625 ; CHECK-RV32IF-NEXT: lui a3, %hi(i)
626 ; CHECK-RV32IF-NEXT: lw a2, %lo(i)(a3)
627 ; CHECK-RV32IF-NEXT: lw a3, %lo(i+4)(a3)
628 ; CHECK-RV32IF-NEXT: call __adddf3
629 ; CHECK-RV32IF-NEXT: lui a2, %hi(g)
630 ; CHECK-RV32IF-NEXT: sw a1, %lo(g+4)(a2)
631 ; CHECK-RV32IF-NEXT: sw a0, %lo(g)(a2)
632 ; CHECK-RV32IF-NEXT: lw ra, 156(sp) # 4-byte Folded Reload
633 ; CHECK-RV32IF-NEXT: lw t0, 152(sp) # 4-byte Folded Reload
634 ; CHECK-RV32IF-NEXT: lw t1, 148(sp) # 4-byte Folded Reload
635 ; CHECK-RV32IF-NEXT: lw t2, 144(sp) # 4-byte Folded Reload
636 ; CHECK-RV32IF-NEXT: lw s0, 140(sp) # 4-byte Folded Reload
637 ; CHECK-RV32IF-NEXT: lw a0, 136(sp) # 4-byte Folded Reload
638 ; CHECK-RV32IF-NEXT: lw a1, 132(sp) # 4-byte Folded Reload
639 ; CHECK-RV32IF-NEXT: lw a2, 128(sp) # 4-byte Folded Reload
640 ; CHECK-RV32IF-NEXT: lw a3, 124(sp) # 4-byte Folded Reload
641 ; CHECK-RV32IF-NEXT: lw a4, 120(sp) # 4-byte Folded Reload
642 ; CHECK-RV32IF-NEXT: lw a5, 116(sp) # 4-byte Folded Reload
643 ; CHECK-RV32IF-NEXT: lw a6, 112(sp) # 4-byte Folded Reload
644 ; CHECK-RV32IF-NEXT: lw a7, 108(sp) # 4-byte Folded Reload
645 ; CHECK-RV32IF-NEXT: lw t3, 104(sp) # 4-byte Folded Reload
646 ; CHECK-RV32IF-NEXT: lw t4, 100(sp) # 4-byte Folded Reload
647 ; CHECK-RV32IF-NEXT: lw t5, 96(sp) # 4-byte Folded Reload
648 ; CHECK-RV32IF-NEXT: lw t6, 92(sp) # 4-byte Folded Reload
649 ; CHECK-RV32IF-NEXT: flw ft0, 88(sp) # 4-byte Folded Reload
650 ; CHECK-RV32IF-NEXT: flw ft1, 84(sp) # 4-byte Folded Reload
651 ; CHECK-RV32IF-NEXT: flw ft2, 80(sp) # 4-byte Folded Reload
652 ; CHECK-RV32IF-NEXT: flw ft3, 76(sp) # 4-byte Folded Reload
653 ; CHECK-RV32IF-NEXT: flw ft4, 72(sp) # 4-byte Folded Reload
654 ; CHECK-RV32IF-NEXT: flw ft5, 68(sp) # 4-byte Folded Reload
655 ; CHECK-RV32IF-NEXT: flw ft6, 64(sp) # 4-byte Folded Reload
656 ; CHECK-RV32IF-NEXT: flw ft7, 60(sp) # 4-byte Folded Reload
657 ; CHECK-RV32IF-NEXT: flw fa0, 56(sp) # 4-byte Folded Reload
658 ; CHECK-RV32IF-NEXT: flw fa1, 52(sp) # 4-byte Folded Reload
659 ; CHECK-RV32IF-NEXT: flw fa2, 48(sp) # 4-byte Folded Reload
660 ; CHECK-RV32IF-NEXT: flw fa3, 44(sp) # 4-byte Folded Reload
661 ; CHECK-RV32IF-NEXT: flw fa4, 40(sp) # 4-byte Folded Reload
662 ; CHECK-RV32IF-NEXT: flw fa5, 36(sp) # 4-byte Folded Reload
663 ; CHECK-RV32IF-NEXT: flw fa6, 32(sp) # 4-byte Folded Reload
664 ; CHECK-RV32IF-NEXT: flw fa7, 28(sp) # 4-byte Folded Reload
665 ; CHECK-RV32IF-NEXT: flw ft8, 24(sp) # 4-byte Folded Reload
666 ; CHECK-RV32IF-NEXT: flw ft9, 20(sp) # 4-byte Folded Reload
667 ; CHECK-RV32IF-NEXT: flw ft10, 16(sp) # 4-byte Folded Reload
668 ; CHECK-RV32IF-NEXT: flw ft11, 12(sp) # 4-byte Folded Reload
669 ; CHECK-RV32IF-NEXT: addi sp, sp, 160
670 ; CHECK-RV32IF-NEXT: mret
672 ; CHECK-RV32IFD-LABEL: foo_fp_double:
673 ; CHECK-RV32IFD: # %bb.0:
674 ; CHECK-RV32IFD-NEXT: addi sp, sp, -32
675 ; CHECK-RV32IFD-NEXT: sw ra, 28(sp) # 4-byte Folded Spill
676 ; CHECK-RV32IFD-NEXT: sw s0, 24(sp) # 4-byte Folded Spill
677 ; CHECK-RV32IFD-NEXT: sw a0, 20(sp) # 4-byte Folded Spill
678 ; CHECK-RV32IFD-NEXT: fsd fa4, 8(sp) # 8-byte Folded Spill
679 ; CHECK-RV32IFD-NEXT: fsd fa5, 0(sp) # 8-byte Folded Spill
680 ; CHECK-RV32IFD-NEXT: addi s0, sp, 32
681 ; CHECK-RV32IFD-NEXT: lui a0, %hi(h)
682 ; CHECK-RV32IFD-NEXT: fld fa5, %lo(h)(a0)
683 ; CHECK-RV32IFD-NEXT: lui a0, %hi(i)
684 ; CHECK-RV32IFD-NEXT: fld fa4, %lo(i)(a0)
685 ; CHECK-RV32IFD-NEXT: fadd.d fa5, fa5, fa4
686 ; CHECK-RV32IFD-NEXT: lui a0, %hi(g)
687 ; CHECK-RV32IFD-NEXT: fsd fa5, %lo(g)(a0)
688 ; CHECK-RV32IFD-NEXT: lw ra, 28(sp) # 4-byte Folded Reload
689 ; CHECK-RV32IFD-NEXT: lw s0, 24(sp) # 4-byte Folded Reload
690 ; CHECK-RV32IFD-NEXT: lw a0, 20(sp) # 4-byte Folded Reload
691 ; CHECK-RV32IFD-NEXT: fld fa4, 8(sp) # 8-byte Folded Reload
692 ; CHECK-RV32IFD-NEXT: fld fa5, 0(sp) # 8-byte Folded Reload
693 ; CHECK-RV32IFD-NEXT: addi sp, sp, 32
694 ; CHECK-RV32IFD-NEXT: mret
695 %1 = load double, ptr @h
696 %2 = load double, ptr @i
697 %add = fadd double %1, %2
698 store double %add, ptr @g
702 attributes #0 = { "interrupt"="machine" }
703 attributes #1 = { "interrupt"="machine" "frame-pointer"="all" }