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
76 %1 = load i32, i32* @a
77 %2 = load i32, i32* @b
78 %add = add nsw i32 %2, %1
79 store i32 %add, i32* @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, i32* @a
154 %2 = load i32, i32* @b
155 %add = add nsw i32 %2, %1
156 store i32 %add, i32* @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@plt
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 ft0, 8(sp) # 4-byte Folded Spill
215 ; CHECK-RV32IF-NEXT: fsw ft1, 4(sp) # 4-byte Folded Spill
216 ; CHECK-RV32IF-NEXT: lui a0, %hi(e)
217 ; CHECK-RV32IF-NEXT: flw ft0, %lo(e)(a0)
218 ; CHECK-RV32IF-NEXT: lui a0, %hi(f)
219 ; CHECK-RV32IF-NEXT: flw ft1, %lo(f)(a0)
220 ; CHECK-RV32IF-NEXT: fadd.s ft0, ft0, ft1
221 ; CHECK-RV32IF-NEXT: lui a0, %hi(d)
222 ; CHECK-RV32IF-NEXT: fsw ft0, %lo(d)(a0)
223 ; CHECK-RV32IF-NEXT: lw a0, 12(sp) # 4-byte Folded Reload
224 ; CHECK-RV32IF-NEXT: flw ft0, 8(sp) # 4-byte Folded Reload
225 ; CHECK-RV32IF-NEXT: flw ft1, 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 ft0, 16(sp) # 8-byte Folded Spill
234 ; CHECK-RV32IFD-NEXT: fsd ft1, 8(sp) # 8-byte Folded Spill
235 ; CHECK-RV32IFD-NEXT: lui a0, %hi(e)
236 ; CHECK-RV32IFD-NEXT: flw ft0, %lo(e)(a0)
237 ; CHECK-RV32IFD-NEXT: lui a0, %hi(f)
238 ; CHECK-RV32IFD-NEXT: flw ft1, %lo(f)(a0)
239 ; CHECK-RV32IFD-NEXT: fadd.s ft0, ft0, ft1
240 ; CHECK-RV32IFD-NEXT: lui a0, %hi(d)
241 ; CHECK-RV32IFD-NEXT: fsw ft0, %lo(d)(a0)
242 ; CHECK-RV32IFD-NEXT: lw a0, 28(sp) # 4-byte Folded Reload
243 ; CHECK-RV32IFD-NEXT: fld ft0, 16(sp) # 8-byte Folded Reload
244 ; CHECK-RV32IFD-NEXT: fld ft1, 8(sp) # 8-byte Folded Reload
245 ; CHECK-RV32IFD-NEXT: addi sp, sp, 32
246 ; CHECK-RV32IFD-NEXT: mret
247 %1 = load float, float* @e
248 %2 = load float, float* @f
249 %add = fadd float %1, %2
250 store float %add, float* @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@plt
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 ft0, 16(sp) # 4-byte Folded Spill
313 ; CHECK-RV32IF-NEXT: fsw ft1, 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 ft0, %lo(e)(a0)
317 ; CHECK-RV32IF-NEXT: lui a0, %hi(f)
318 ; CHECK-RV32IF-NEXT: flw ft1, %lo(f)(a0)
319 ; CHECK-RV32IF-NEXT: fadd.s ft0, ft0, ft1
320 ; CHECK-RV32IF-NEXT: lui a0, %hi(d)
321 ; CHECK-RV32IF-NEXT: fsw ft0, %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 ft0, 16(sp) # 4-byte Folded Reload
326 ; CHECK-RV32IF-NEXT: flw ft1, 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 ft0, 8(sp) # 8-byte Folded Spill
337 ; CHECK-RV32IFD-NEXT: fsd ft1, 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 ft0, %lo(e)(a0)
341 ; CHECK-RV32IFD-NEXT: lui a0, %hi(f)
342 ; CHECK-RV32IFD-NEXT: flw ft1, %lo(f)(a0)
343 ; CHECK-RV32IFD-NEXT: fadd.s ft0, ft0, ft1
344 ; CHECK-RV32IFD-NEXT: lui a0, %hi(d)
345 ; CHECK-RV32IFD-NEXT: fsw ft0, %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 ft0, 8(sp) # 8-byte Folded Reload
350 ; CHECK-RV32IFD-NEXT: fld ft1, 0(sp) # 8-byte Folded Reload
351 ; CHECK-RV32IFD-NEXT: addi sp, sp, 32
352 ; CHECK-RV32IFD-NEXT: mret
353 %1 = load float, float* @e
354 %2 = load float, float* @f
355 %add = fadd float %1, %2
356 store float %add, float* @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@plt
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, -192
416 ; CHECK-RV32IF-NEXT: sw ra, 188(sp) # 4-byte Folded Spill
417 ; CHECK-RV32IF-NEXT: sw t0, 184(sp) # 4-byte Folded Spill
418 ; CHECK-RV32IF-NEXT: sw t1, 180(sp) # 4-byte Folded Spill
419 ; CHECK-RV32IF-NEXT: sw t2, 176(sp) # 4-byte Folded Spill
420 ; CHECK-RV32IF-NEXT: sw a0, 172(sp) # 4-byte Folded Spill
421 ; CHECK-RV32IF-NEXT: sw a1, 168(sp) # 4-byte Folded Spill
422 ; CHECK-RV32IF-NEXT: sw a2, 164(sp) # 4-byte Folded Spill
423 ; CHECK-RV32IF-NEXT: sw a3, 160(sp) # 4-byte Folded Spill
424 ; CHECK-RV32IF-NEXT: sw a4, 156(sp) # 4-byte Folded Spill
425 ; CHECK-RV32IF-NEXT: sw a5, 152(sp) # 4-byte Folded Spill
426 ; CHECK-RV32IF-NEXT: sw a6, 148(sp) # 4-byte Folded Spill
427 ; CHECK-RV32IF-NEXT: sw a7, 144(sp) # 4-byte Folded Spill
428 ; CHECK-RV32IF-NEXT: sw t3, 140(sp) # 4-byte Folded Spill
429 ; CHECK-RV32IF-NEXT: sw t4, 136(sp) # 4-byte Folded Spill
430 ; CHECK-RV32IF-NEXT: sw t5, 132(sp) # 4-byte Folded Spill
431 ; CHECK-RV32IF-NEXT: sw t6, 128(sp) # 4-byte Folded Spill
432 ; CHECK-RV32IF-NEXT: fsw ft0, 124(sp) # 4-byte Folded Spill
433 ; CHECK-RV32IF-NEXT: fsw ft1, 120(sp) # 4-byte Folded Spill
434 ; CHECK-RV32IF-NEXT: fsw ft2, 116(sp) # 4-byte Folded Spill
435 ; CHECK-RV32IF-NEXT: fsw ft3, 112(sp) # 4-byte Folded Spill
436 ; CHECK-RV32IF-NEXT: fsw ft4, 108(sp) # 4-byte Folded Spill
437 ; CHECK-RV32IF-NEXT: fsw ft5, 104(sp) # 4-byte Folded Spill
438 ; CHECK-RV32IF-NEXT: fsw ft6, 100(sp) # 4-byte Folded Spill
439 ; CHECK-RV32IF-NEXT: fsw ft7, 96(sp) # 4-byte Folded Spill
440 ; CHECK-RV32IF-NEXT: fsw fa0, 92(sp) # 4-byte Folded Spill
441 ; CHECK-RV32IF-NEXT: fsw fa1, 88(sp) # 4-byte Folded Spill
442 ; CHECK-RV32IF-NEXT: fsw fa2, 84(sp) # 4-byte Folded Spill
443 ; CHECK-RV32IF-NEXT: fsw fa3, 80(sp) # 4-byte Folded Spill
444 ; CHECK-RV32IF-NEXT: fsw fa4, 76(sp) # 4-byte Folded Spill
445 ; CHECK-RV32IF-NEXT: fsw fa5, 72(sp) # 4-byte Folded Spill
446 ; CHECK-RV32IF-NEXT: fsw fa6, 68(sp) # 4-byte Folded Spill
447 ; CHECK-RV32IF-NEXT: fsw fa7, 64(sp) # 4-byte Folded Spill
448 ; CHECK-RV32IF-NEXT: fsw ft8, 60(sp) # 4-byte Folded Spill
449 ; CHECK-RV32IF-NEXT: fsw ft9, 56(sp) # 4-byte Folded Spill
450 ; CHECK-RV32IF-NEXT: fsw ft10, 52(sp) # 4-byte Folded Spill
451 ; CHECK-RV32IF-NEXT: fsw ft11, 48(sp) # 4-byte Folded Spill
452 ; CHECK-RV32IF-NEXT: fsw fs0, 44(sp) # 4-byte Folded Spill
453 ; CHECK-RV32IF-NEXT: fsw fs1, 40(sp) # 4-byte Folded Spill
454 ; CHECK-RV32IF-NEXT: fsw fs2, 36(sp) # 4-byte Folded Spill
455 ; CHECK-RV32IF-NEXT: fsw fs3, 32(sp) # 4-byte Folded Spill
456 ; CHECK-RV32IF-NEXT: fsw fs4, 28(sp) # 4-byte Folded Spill
457 ; CHECK-RV32IF-NEXT: fsw fs5, 24(sp) # 4-byte Folded Spill
458 ; CHECK-RV32IF-NEXT: fsw fs6, 20(sp) # 4-byte Folded Spill
459 ; CHECK-RV32IF-NEXT: fsw fs7, 16(sp) # 4-byte Folded Spill
460 ; CHECK-RV32IF-NEXT: fsw fs8, 12(sp) # 4-byte Folded Spill
461 ; CHECK-RV32IF-NEXT: fsw fs9, 8(sp) # 4-byte Folded Spill
462 ; CHECK-RV32IF-NEXT: fsw fs10, 4(sp) # 4-byte Folded Spill
463 ; CHECK-RV32IF-NEXT: fsw fs11, 0(sp) # 4-byte Folded Spill
464 ; CHECK-RV32IF-NEXT: lui a1, %hi(h)
465 ; CHECK-RV32IF-NEXT: lw a0, %lo(h)(a1)
466 ; CHECK-RV32IF-NEXT: lw a1, %lo(h+4)(a1)
467 ; CHECK-RV32IF-NEXT: lui a3, %hi(i)
468 ; CHECK-RV32IF-NEXT: lw a2, %lo(i)(a3)
469 ; CHECK-RV32IF-NEXT: lw a3, %lo(i+4)(a3)
470 ; CHECK-RV32IF-NEXT: call __adddf3@plt
471 ; CHECK-RV32IF-NEXT: lui a2, %hi(g)
472 ; CHECK-RV32IF-NEXT: sw a1, %lo(g+4)(a2)
473 ; CHECK-RV32IF-NEXT: sw a0, %lo(g)(a2)
474 ; CHECK-RV32IF-NEXT: lw ra, 188(sp) # 4-byte Folded Reload
475 ; CHECK-RV32IF-NEXT: lw t0, 184(sp) # 4-byte Folded Reload
476 ; CHECK-RV32IF-NEXT: lw t1, 180(sp) # 4-byte Folded Reload
477 ; CHECK-RV32IF-NEXT: lw t2, 176(sp) # 4-byte Folded Reload
478 ; CHECK-RV32IF-NEXT: lw a0, 172(sp) # 4-byte Folded Reload
479 ; CHECK-RV32IF-NEXT: lw a1, 168(sp) # 4-byte Folded Reload
480 ; CHECK-RV32IF-NEXT: lw a2, 164(sp) # 4-byte Folded Reload
481 ; CHECK-RV32IF-NEXT: lw a3, 160(sp) # 4-byte Folded Reload
482 ; CHECK-RV32IF-NEXT: lw a4, 156(sp) # 4-byte Folded Reload
483 ; CHECK-RV32IF-NEXT: lw a5, 152(sp) # 4-byte Folded Reload
484 ; CHECK-RV32IF-NEXT: lw a6, 148(sp) # 4-byte Folded Reload
485 ; CHECK-RV32IF-NEXT: lw a7, 144(sp) # 4-byte Folded Reload
486 ; CHECK-RV32IF-NEXT: lw t3, 140(sp) # 4-byte Folded Reload
487 ; CHECK-RV32IF-NEXT: lw t4, 136(sp) # 4-byte Folded Reload
488 ; CHECK-RV32IF-NEXT: lw t5, 132(sp) # 4-byte Folded Reload
489 ; CHECK-RV32IF-NEXT: lw t6, 128(sp) # 4-byte Folded Reload
490 ; CHECK-RV32IF-NEXT: flw ft0, 124(sp) # 4-byte Folded Reload
491 ; CHECK-RV32IF-NEXT: flw ft1, 120(sp) # 4-byte Folded Reload
492 ; CHECK-RV32IF-NEXT: flw ft2, 116(sp) # 4-byte Folded Reload
493 ; CHECK-RV32IF-NEXT: flw ft3, 112(sp) # 4-byte Folded Reload
494 ; CHECK-RV32IF-NEXT: flw ft4, 108(sp) # 4-byte Folded Reload
495 ; CHECK-RV32IF-NEXT: flw ft5, 104(sp) # 4-byte Folded Reload
496 ; CHECK-RV32IF-NEXT: flw ft6, 100(sp) # 4-byte Folded Reload
497 ; CHECK-RV32IF-NEXT: flw ft7, 96(sp) # 4-byte Folded Reload
498 ; CHECK-RV32IF-NEXT: flw fa0, 92(sp) # 4-byte Folded Reload
499 ; CHECK-RV32IF-NEXT: flw fa1, 88(sp) # 4-byte Folded Reload
500 ; CHECK-RV32IF-NEXT: flw fa2, 84(sp) # 4-byte Folded Reload
501 ; CHECK-RV32IF-NEXT: flw fa3, 80(sp) # 4-byte Folded Reload
502 ; CHECK-RV32IF-NEXT: flw fa4, 76(sp) # 4-byte Folded Reload
503 ; CHECK-RV32IF-NEXT: flw fa5, 72(sp) # 4-byte Folded Reload
504 ; CHECK-RV32IF-NEXT: flw fa6, 68(sp) # 4-byte Folded Reload
505 ; CHECK-RV32IF-NEXT: flw fa7, 64(sp) # 4-byte Folded Reload
506 ; CHECK-RV32IF-NEXT: flw ft8, 60(sp) # 4-byte Folded Reload
507 ; CHECK-RV32IF-NEXT: flw ft9, 56(sp) # 4-byte Folded Reload
508 ; CHECK-RV32IF-NEXT: flw ft10, 52(sp) # 4-byte Folded Reload
509 ; CHECK-RV32IF-NEXT: flw ft11, 48(sp) # 4-byte Folded Reload
510 ; CHECK-RV32IF-NEXT: flw fs0, 44(sp) # 4-byte Folded Reload
511 ; CHECK-RV32IF-NEXT: flw fs1, 40(sp) # 4-byte Folded Reload
512 ; CHECK-RV32IF-NEXT: flw fs2, 36(sp) # 4-byte Folded Reload
513 ; CHECK-RV32IF-NEXT: flw fs3, 32(sp) # 4-byte Folded Reload
514 ; CHECK-RV32IF-NEXT: flw fs4, 28(sp) # 4-byte Folded Reload
515 ; CHECK-RV32IF-NEXT: flw fs5, 24(sp) # 4-byte Folded Reload
516 ; CHECK-RV32IF-NEXT: flw fs6, 20(sp) # 4-byte Folded Reload
517 ; CHECK-RV32IF-NEXT: flw fs7, 16(sp) # 4-byte Folded Reload
518 ; CHECK-RV32IF-NEXT: flw fs8, 12(sp) # 4-byte Folded Reload
519 ; CHECK-RV32IF-NEXT: flw fs9, 8(sp) # 4-byte Folded Reload
520 ; CHECK-RV32IF-NEXT: flw fs10, 4(sp) # 4-byte Folded Reload
521 ; CHECK-RV32IF-NEXT: flw fs11, 0(sp) # 4-byte Folded Reload
522 ; CHECK-RV32IF-NEXT: addi sp, sp, 192
523 ; CHECK-RV32IF-NEXT: mret
525 ; CHECK-RV32IFD-LABEL: foo_double:
526 ; CHECK-RV32IFD: # %bb.0:
527 ; CHECK-RV32IFD-NEXT: addi sp, sp, -32
528 ; CHECK-RV32IFD-NEXT: sw a0, 28(sp) # 4-byte Folded Spill
529 ; CHECK-RV32IFD-NEXT: fsd ft0, 16(sp) # 8-byte Folded Spill
530 ; CHECK-RV32IFD-NEXT: fsd ft1, 8(sp) # 8-byte Folded Spill
531 ; CHECK-RV32IFD-NEXT: lui a0, %hi(h)
532 ; CHECK-RV32IFD-NEXT: fld ft0, %lo(h)(a0)
533 ; CHECK-RV32IFD-NEXT: lui a0, %hi(i)
534 ; CHECK-RV32IFD-NEXT: fld ft1, %lo(i)(a0)
535 ; CHECK-RV32IFD-NEXT: fadd.d ft0, ft0, ft1
536 ; CHECK-RV32IFD-NEXT: lui a0, %hi(g)
537 ; CHECK-RV32IFD-NEXT: fsd ft0, %lo(g)(a0)
538 ; CHECK-RV32IFD-NEXT: lw a0, 28(sp) # 4-byte Folded Reload
539 ; CHECK-RV32IFD-NEXT: fld ft0, 16(sp) # 8-byte Folded Reload
540 ; CHECK-RV32IFD-NEXT: fld ft1, 8(sp) # 8-byte Folded Reload
541 ; CHECK-RV32IFD-NEXT: addi sp, sp, 32
542 ; CHECK-RV32IFD-NEXT: mret
543 %1 = load double, double* @h
544 %2 = load double, double* @i
545 %add = fadd double %1, %2
546 store double %add, double* @g
551 ; Additionally check frame pointer and return address are properly saved.
553 define void @foo_fp_double() nounwind #1 {
554 ; CHECK-RV32-LABEL: foo_fp_double:
555 ; CHECK-RV32: # %bb.0:
556 ; CHECK-RV32-NEXT: addi sp, sp, -80
557 ; CHECK-RV32-NEXT: sw ra, 76(sp) # 4-byte Folded Spill
558 ; CHECK-RV32-NEXT: sw t0, 72(sp) # 4-byte Folded Spill
559 ; CHECK-RV32-NEXT: sw t1, 68(sp) # 4-byte Folded Spill
560 ; CHECK-RV32-NEXT: sw t2, 64(sp) # 4-byte Folded Spill
561 ; CHECK-RV32-NEXT: sw s0, 60(sp) # 4-byte Folded Spill
562 ; CHECK-RV32-NEXT: sw a0, 56(sp) # 4-byte Folded Spill
563 ; CHECK-RV32-NEXT: sw a1, 52(sp) # 4-byte Folded Spill
564 ; CHECK-RV32-NEXT: sw a2, 48(sp) # 4-byte Folded Spill
565 ; CHECK-RV32-NEXT: sw a3, 44(sp) # 4-byte Folded Spill
566 ; CHECK-RV32-NEXT: sw a4, 40(sp) # 4-byte Folded Spill
567 ; CHECK-RV32-NEXT: sw a5, 36(sp) # 4-byte Folded Spill
568 ; CHECK-RV32-NEXT: sw a6, 32(sp) # 4-byte Folded Spill
569 ; CHECK-RV32-NEXT: sw a7, 28(sp) # 4-byte Folded Spill
570 ; CHECK-RV32-NEXT: sw t3, 24(sp) # 4-byte Folded Spill
571 ; CHECK-RV32-NEXT: sw t4, 20(sp) # 4-byte Folded Spill
572 ; CHECK-RV32-NEXT: sw t5, 16(sp) # 4-byte Folded Spill
573 ; CHECK-RV32-NEXT: sw t6, 12(sp) # 4-byte Folded Spill
574 ; CHECK-RV32-NEXT: addi s0, sp, 80
575 ; CHECK-RV32-NEXT: lui a1, %hi(h)
576 ; CHECK-RV32-NEXT: lw a0, %lo(h)(a1)
577 ; CHECK-RV32-NEXT: lw a1, %lo(h+4)(a1)
578 ; CHECK-RV32-NEXT: lui a3, %hi(i)
579 ; CHECK-RV32-NEXT: lw a2, %lo(i)(a3)
580 ; CHECK-RV32-NEXT: lw a3, %lo(i+4)(a3)
581 ; CHECK-RV32-NEXT: call __adddf3@plt
582 ; CHECK-RV32-NEXT: lui a2, %hi(g)
583 ; CHECK-RV32-NEXT: sw a1, %lo(g+4)(a2)
584 ; CHECK-RV32-NEXT: sw a0, %lo(g)(a2)
585 ; CHECK-RV32-NEXT: lw ra, 76(sp) # 4-byte Folded Reload
586 ; CHECK-RV32-NEXT: lw t0, 72(sp) # 4-byte Folded Reload
587 ; CHECK-RV32-NEXT: lw t1, 68(sp) # 4-byte Folded Reload
588 ; CHECK-RV32-NEXT: lw t2, 64(sp) # 4-byte Folded Reload
589 ; CHECK-RV32-NEXT: lw s0, 60(sp) # 4-byte Folded Reload
590 ; CHECK-RV32-NEXT: lw a0, 56(sp) # 4-byte Folded Reload
591 ; CHECK-RV32-NEXT: lw a1, 52(sp) # 4-byte Folded Reload
592 ; CHECK-RV32-NEXT: lw a2, 48(sp) # 4-byte Folded Reload
593 ; CHECK-RV32-NEXT: lw a3, 44(sp) # 4-byte Folded Reload
594 ; CHECK-RV32-NEXT: lw a4, 40(sp) # 4-byte Folded Reload
595 ; CHECK-RV32-NEXT: lw a5, 36(sp) # 4-byte Folded Reload
596 ; CHECK-RV32-NEXT: lw a6, 32(sp) # 4-byte Folded Reload
597 ; CHECK-RV32-NEXT: lw a7, 28(sp) # 4-byte Folded Reload
598 ; CHECK-RV32-NEXT: lw t3, 24(sp) # 4-byte Folded Reload
599 ; CHECK-RV32-NEXT: lw t4, 20(sp) # 4-byte Folded Reload
600 ; CHECK-RV32-NEXT: lw t5, 16(sp) # 4-byte Folded Reload
601 ; CHECK-RV32-NEXT: lw t6, 12(sp) # 4-byte Folded Reload
602 ; CHECK-RV32-NEXT: addi sp, sp, 80
603 ; CHECK-RV32-NEXT: mret
605 ; CHECK-RV32IF-LABEL: foo_fp_double:
606 ; CHECK-RV32IF: # %bb.0:
607 ; CHECK-RV32IF-NEXT: addi sp, sp, -208
608 ; CHECK-RV32IF-NEXT: sw ra, 204(sp) # 4-byte Folded Spill
609 ; CHECK-RV32IF-NEXT: sw t0, 200(sp) # 4-byte Folded Spill
610 ; CHECK-RV32IF-NEXT: sw t1, 196(sp) # 4-byte Folded Spill
611 ; CHECK-RV32IF-NEXT: sw t2, 192(sp) # 4-byte Folded Spill
612 ; CHECK-RV32IF-NEXT: sw s0, 188(sp) # 4-byte Folded Spill
613 ; CHECK-RV32IF-NEXT: sw a0, 184(sp) # 4-byte Folded Spill
614 ; CHECK-RV32IF-NEXT: sw a1, 180(sp) # 4-byte Folded Spill
615 ; CHECK-RV32IF-NEXT: sw a2, 176(sp) # 4-byte Folded Spill
616 ; CHECK-RV32IF-NEXT: sw a3, 172(sp) # 4-byte Folded Spill
617 ; CHECK-RV32IF-NEXT: sw a4, 168(sp) # 4-byte Folded Spill
618 ; CHECK-RV32IF-NEXT: sw a5, 164(sp) # 4-byte Folded Spill
619 ; CHECK-RV32IF-NEXT: sw a6, 160(sp) # 4-byte Folded Spill
620 ; CHECK-RV32IF-NEXT: sw a7, 156(sp) # 4-byte Folded Spill
621 ; CHECK-RV32IF-NEXT: sw t3, 152(sp) # 4-byte Folded Spill
622 ; CHECK-RV32IF-NEXT: sw t4, 148(sp) # 4-byte Folded Spill
623 ; CHECK-RV32IF-NEXT: sw t5, 144(sp) # 4-byte Folded Spill
624 ; CHECK-RV32IF-NEXT: sw t6, 140(sp) # 4-byte Folded Spill
625 ; CHECK-RV32IF-NEXT: fsw ft0, 136(sp) # 4-byte Folded Spill
626 ; CHECK-RV32IF-NEXT: fsw ft1, 132(sp) # 4-byte Folded Spill
627 ; CHECK-RV32IF-NEXT: fsw ft2, 128(sp) # 4-byte Folded Spill
628 ; CHECK-RV32IF-NEXT: fsw ft3, 124(sp) # 4-byte Folded Spill
629 ; CHECK-RV32IF-NEXT: fsw ft4, 120(sp) # 4-byte Folded Spill
630 ; CHECK-RV32IF-NEXT: fsw ft5, 116(sp) # 4-byte Folded Spill
631 ; CHECK-RV32IF-NEXT: fsw ft6, 112(sp) # 4-byte Folded Spill
632 ; CHECK-RV32IF-NEXT: fsw ft7, 108(sp) # 4-byte Folded Spill
633 ; CHECK-RV32IF-NEXT: fsw fa0, 104(sp) # 4-byte Folded Spill
634 ; CHECK-RV32IF-NEXT: fsw fa1, 100(sp) # 4-byte Folded Spill
635 ; CHECK-RV32IF-NEXT: fsw fa2, 96(sp) # 4-byte Folded Spill
636 ; CHECK-RV32IF-NEXT: fsw fa3, 92(sp) # 4-byte Folded Spill
637 ; CHECK-RV32IF-NEXT: fsw fa4, 88(sp) # 4-byte Folded Spill
638 ; CHECK-RV32IF-NEXT: fsw fa5, 84(sp) # 4-byte Folded Spill
639 ; CHECK-RV32IF-NEXT: fsw fa6, 80(sp) # 4-byte Folded Spill
640 ; CHECK-RV32IF-NEXT: fsw fa7, 76(sp) # 4-byte Folded Spill
641 ; CHECK-RV32IF-NEXT: fsw ft8, 72(sp) # 4-byte Folded Spill
642 ; CHECK-RV32IF-NEXT: fsw ft9, 68(sp) # 4-byte Folded Spill
643 ; CHECK-RV32IF-NEXT: fsw ft10, 64(sp) # 4-byte Folded Spill
644 ; CHECK-RV32IF-NEXT: fsw ft11, 60(sp) # 4-byte Folded Spill
645 ; CHECK-RV32IF-NEXT: fsw fs0, 56(sp) # 4-byte Folded Spill
646 ; CHECK-RV32IF-NEXT: fsw fs1, 52(sp) # 4-byte Folded Spill
647 ; CHECK-RV32IF-NEXT: fsw fs2, 48(sp) # 4-byte Folded Spill
648 ; CHECK-RV32IF-NEXT: fsw fs3, 44(sp) # 4-byte Folded Spill
649 ; CHECK-RV32IF-NEXT: fsw fs4, 40(sp) # 4-byte Folded Spill
650 ; CHECK-RV32IF-NEXT: fsw fs5, 36(sp) # 4-byte Folded Spill
651 ; CHECK-RV32IF-NEXT: fsw fs6, 32(sp) # 4-byte Folded Spill
652 ; CHECK-RV32IF-NEXT: fsw fs7, 28(sp) # 4-byte Folded Spill
653 ; CHECK-RV32IF-NEXT: fsw fs8, 24(sp) # 4-byte Folded Spill
654 ; CHECK-RV32IF-NEXT: fsw fs9, 20(sp) # 4-byte Folded Spill
655 ; CHECK-RV32IF-NEXT: fsw fs10, 16(sp) # 4-byte Folded Spill
656 ; CHECK-RV32IF-NEXT: fsw fs11, 12(sp) # 4-byte Folded Spill
657 ; CHECK-RV32IF-NEXT: addi s0, sp, 208
658 ; CHECK-RV32IF-NEXT: lui a1, %hi(h)
659 ; CHECK-RV32IF-NEXT: lw a0, %lo(h)(a1)
660 ; CHECK-RV32IF-NEXT: lw a1, %lo(h+4)(a1)
661 ; CHECK-RV32IF-NEXT: lui a3, %hi(i)
662 ; CHECK-RV32IF-NEXT: lw a2, %lo(i)(a3)
663 ; CHECK-RV32IF-NEXT: lw a3, %lo(i+4)(a3)
664 ; CHECK-RV32IF-NEXT: call __adddf3@plt
665 ; CHECK-RV32IF-NEXT: lui a2, %hi(g)
666 ; CHECK-RV32IF-NEXT: sw a1, %lo(g+4)(a2)
667 ; CHECK-RV32IF-NEXT: sw a0, %lo(g)(a2)
668 ; CHECK-RV32IF-NEXT: lw ra, 204(sp) # 4-byte Folded Reload
669 ; CHECK-RV32IF-NEXT: lw t0, 200(sp) # 4-byte Folded Reload
670 ; CHECK-RV32IF-NEXT: lw t1, 196(sp) # 4-byte Folded Reload
671 ; CHECK-RV32IF-NEXT: lw t2, 192(sp) # 4-byte Folded Reload
672 ; CHECK-RV32IF-NEXT: lw s0, 188(sp) # 4-byte Folded Reload
673 ; CHECK-RV32IF-NEXT: lw a0, 184(sp) # 4-byte Folded Reload
674 ; CHECK-RV32IF-NEXT: lw a1, 180(sp) # 4-byte Folded Reload
675 ; CHECK-RV32IF-NEXT: lw a2, 176(sp) # 4-byte Folded Reload
676 ; CHECK-RV32IF-NEXT: lw a3, 172(sp) # 4-byte Folded Reload
677 ; CHECK-RV32IF-NEXT: lw a4, 168(sp) # 4-byte Folded Reload
678 ; CHECK-RV32IF-NEXT: lw a5, 164(sp) # 4-byte Folded Reload
679 ; CHECK-RV32IF-NEXT: lw a6, 160(sp) # 4-byte Folded Reload
680 ; CHECK-RV32IF-NEXT: lw a7, 156(sp) # 4-byte Folded Reload
681 ; CHECK-RV32IF-NEXT: lw t3, 152(sp) # 4-byte Folded Reload
682 ; CHECK-RV32IF-NEXT: lw t4, 148(sp) # 4-byte Folded Reload
683 ; CHECK-RV32IF-NEXT: lw t5, 144(sp) # 4-byte Folded Reload
684 ; CHECK-RV32IF-NEXT: lw t6, 140(sp) # 4-byte Folded Reload
685 ; CHECK-RV32IF-NEXT: flw ft0, 136(sp) # 4-byte Folded Reload
686 ; CHECK-RV32IF-NEXT: flw ft1, 132(sp) # 4-byte Folded Reload
687 ; CHECK-RV32IF-NEXT: flw ft2, 128(sp) # 4-byte Folded Reload
688 ; CHECK-RV32IF-NEXT: flw ft3, 124(sp) # 4-byte Folded Reload
689 ; CHECK-RV32IF-NEXT: flw ft4, 120(sp) # 4-byte Folded Reload
690 ; CHECK-RV32IF-NEXT: flw ft5, 116(sp) # 4-byte Folded Reload
691 ; CHECK-RV32IF-NEXT: flw ft6, 112(sp) # 4-byte Folded Reload
692 ; CHECK-RV32IF-NEXT: flw ft7, 108(sp) # 4-byte Folded Reload
693 ; CHECK-RV32IF-NEXT: flw fa0, 104(sp) # 4-byte Folded Reload
694 ; CHECK-RV32IF-NEXT: flw fa1, 100(sp) # 4-byte Folded Reload
695 ; CHECK-RV32IF-NEXT: flw fa2, 96(sp) # 4-byte Folded Reload
696 ; CHECK-RV32IF-NEXT: flw fa3, 92(sp) # 4-byte Folded Reload
697 ; CHECK-RV32IF-NEXT: flw fa4, 88(sp) # 4-byte Folded Reload
698 ; CHECK-RV32IF-NEXT: flw fa5, 84(sp) # 4-byte Folded Reload
699 ; CHECK-RV32IF-NEXT: flw fa6, 80(sp) # 4-byte Folded Reload
700 ; CHECK-RV32IF-NEXT: flw fa7, 76(sp) # 4-byte Folded Reload
701 ; CHECK-RV32IF-NEXT: flw ft8, 72(sp) # 4-byte Folded Reload
702 ; CHECK-RV32IF-NEXT: flw ft9, 68(sp) # 4-byte Folded Reload
703 ; CHECK-RV32IF-NEXT: flw ft10, 64(sp) # 4-byte Folded Reload
704 ; CHECK-RV32IF-NEXT: flw ft11, 60(sp) # 4-byte Folded Reload
705 ; CHECK-RV32IF-NEXT: flw fs0, 56(sp) # 4-byte Folded Reload
706 ; CHECK-RV32IF-NEXT: flw fs1, 52(sp) # 4-byte Folded Reload
707 ; CHECK-RV32IF-NEXT: flw fs2, 48(sp) # 4-byte Folded Reload
708 ; CHECK-RV32IF-NEXT: flw fs3, 44(sp) # 4-byte Folded Reload
709 ; CHECK-RV32IF-NEXT: flw fs4, 40(sp) # 4-byte Folded Reload
710 ; CHECK-RV32IF-NEXT: flw fs5, 36(sp) # 4-byte Folded Reload
711 ; CHECK-RV32IF-NEXT: flw fs6, 32(sp) # 4-byte Folded Reload
712 ; CHECK-RV32IF-NEXT: flw fs7, 28(sp) # 4-byte Folded Reload
713 ; CHECK-RV32IF-NEXT: flw fs8, 24(sp) # 4-byte Folded Reload
714 ; CHECK-RV32IF-NEXT: flw fs9, 20(sp) # 4-byte Folded Reload
715 ; CHECK-RV32IF-NEXT: flw fs10, 16(sp) # 4-byte Folded Reload
716 ; CHECK-RV32IF-NEXT: flw fs11, 12(sp) # 4-byte Folded Reload
717 ; CHECK-RV32IF-NEXT: addi sp, sp, 208
718 ; CHECK-RV32IF-NEXT: mret
720 ; CHECK-RV32IFD-LABEL: foo_fp_double:
721 ; CHECK-RV32IFD: # %bb.0:
722 ; CHECK-RV32IFD-NEXT: addi sp, sp, -32
723 ; CHECK-RV32IFD-NEXT: sw ra, 28(sp) # 4-byte Folded Spill
724 ; CHECK-RV32IFD-NEXT: sw s0, 24(sp) # 4-byte Folded Spill
725 ; CHECK-RV32IFD-NEXT: sw a0, 20(sp) # 4-byte Folded Spill
726 ; CHECK-RV32IFD-NEXT: fsd ft0, 8(sp) # 8-byte Folded Spill
727 ; CHECK-RV32IFD-NEXT: fsd ft1, 0(sp) # 8-byte Folded Spill
728 ; CHECK-RV32IFD-NEXT: addi s0, sp, 32
729 ; CHECK-RV32IFD-NEXT: lui a0, %hi(h)
730 ; CHECK-RV32IFD-NEXT: fld ft0, %lo(h)(a0)
731 ; CHECK-RV32IFD-NEXT: lui a0, %hi(i)
732 ; CHECK-RV32IFD-NEXT: fld ft1, %lo(i)(a0)
733 ; CHECK-RV32IFD-NEXT: fadd.d ft0, ft0, ft1
734 ; CHECK-RV32IFD-NEXT: lui a0, %hi(g)
735 ; CHECK-RV32IFD-NEXT: fsd ft0, %lo(g)(a0)
736 ; CHECK-RV32IFD-NEXT: lw ra, 28(sp) # 4-byte Folded Reload
737 ; CHECK-RV32IFD-NEXT: lw s0, 24(sp) # 4-byte Folded Reload
738 ; CHECK-RV32IFD-NEXT: lw a0, 20(sp) # 4-byte Folded Reload
739 ; CHECK-RV32IFD-NEXT: fld ft0, 8(sp) # 8-byte Folded Reload
740 ; CHECK-RV32IFD-NEXT: fld ft1, 0(sp) # 8-byte Folded Reload
741 ; CHECK-RV32IFD-NEXT: addi sp, sp, 32
742 ; CHECK-RV32IFD-NEXT: mret
743 %1 = load double, double* @h
744 %2 = load double, double* @i
745 %add = fadd double %1, %2
746 store double %add, double* @g
750 attributes #0 = { "interrupt"="machine" }
751 attributes #1 = { "interrupt"="machine" "frame-pointer"="all" }