1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc --mtriple=loongarch32 -mattr=+d --filetype=obj --verify-machineinstrs < %s \
3 ; RUN: -o /dev/null 2>&1
4 ; RUN: llc --mtriple=loongarch32 -mattr=+d --verify-machineinstrs < %s | FileCheck %s
6 define void @relax_b28_spill() {
7 ; CHECK-LABEL: relax_b28_spill:
9 ; CHECK-NEXT: addi.w $sp, $sp, -48
10 ; CHECK-NEXT: .cfi_def_cfa_offset 48
11 ; CHECK-NEXT: st.w $ra, $sp, 44 # 4-byte Folded Spill
12 ; CHECK-NEXT: st.w $fp, $sp, 40 # 4-byte Folded Spill
13 ; CHECK-NEXT: st.w $s0, $sp, 36 # 4-byte Folded Spill
14 ; CHECK-NEXT: st.w $s1, $sp, 32 # 4-byte Folded Spill
15 ; CHECK-NEXT: st.w $s2, $sp, 28 # 4-byte Folded Spill
16 ; CHECK-NEXT: st.w $s3, $sp, 24 # 4-byte Folded Spill
17 ; CHECK-NEXT: st.w $s4, $sp, 20 # 4-byte Folded Spill
18 ; CHECK-NEXT: st.w $s5, $sp, 16 # 4-byte Folded Spill
19 ; CHECK-NEXT: st.w $s6, $sp, 12 # 4-byte Folded Spill
20 ; CHECK-NEXT: st.w $s7, $sp, 8 # 4-byte Folded Spill
21 ; CHECK-NEXT: st.w $s8, $sp, 4 # 4-byte Folded Spill
22 ; CHECK-NEXT: .cfi_offset 1, -4
23 ; CHECK-NEXT: .cfi_offset 22, -8
24 ; CHECK-NEXT: .cfi_offset 23, -12
25 ; CHECK-NEXT: .cfi_offset 24, -16
26 ; CHECK-NEXT: .cfi_offset 25, -20
27 ; CHECK-NEXT: .cfi_offset 26, -24
28 ; CHECK-NEXT: .cfi_offset 27, -28
29 ; CHECK-NEXT: .cfi_offset 28, -32
30 ; CHECK-NEXT: .cfi_offset 29, -36
31 ; CHECK-NEXT: .cfi_offset 30, -40
32 ; CHECK-NEXT: .cfi_offset 31, -44
34 ; CHECK-NEXT: addi.w $zero, $zero, 1
37 ; CHECK-NEXT: addi.w $ra, $zero, 1
40 ; CHECK-NEXT: addi.w $tp, $zero, 1
43 ; CHECK-NEXT: addi.w $a0, $zero, 1
46 ; CHECK-NEXT: addi.w $a1, $zero, 1
49 ; CHECK-NEXT: addi.w $a2, $zero, 1
52 ; CHECK-NEXT: addi.w $a3, $zero, 1
55 ; CHECK-NEXT: addi.w $a4, $zero, 1
58 ; CHECK-NEXT: addi.w $a5, $zero, 1
61 ; CHECK-NEXT: addi.w $a6, $zero, 1
64 ; CHECK-NEXT: addi.w $a7, $zero, 1
67 ; CHECK-NEXT: addi.w $t0, $zero, 1
70 ; CHECK-NEXT: addi.w $t1, $zero, 1
73 ; CHECK-NEXT: addi.w $t2, $zero, 1
76 ; CHECK-NEXT: addi.w $t3, $zero, 1
79 ; CHECK-NEXT: addi.w $t4, $zero, 1
82 ; CHECK-NEXT: addi.w $t5, $zero, 1
85 ; CHECK-NEXT: addi.w $t6, $zero, 1
88 ; CHECK-NEXT: addi.w $t7, $zero, 1
91 ; CHECK-NEXT: addi.w $t8, $zero, 1
94 ; CHECK-NEXT: addi.w $fp, $zero, 1
97 ; CHECK-NEXT: addi.w $s0, $zero, 1
100 ; CHECK-NEXT: addi.w $s1, $zero, 1
101 ; CHECK-NEXT: #NO_APP
103 ; CHECK-NEXT: addi.w $s2, $zero, 1
104 ; CHECK-NEXT: #NO_APP
106 ; CHECK-NEXT: addi.w $s3, $zero, 1
107 ; CHECK-NEXT: #NO_APP
109 ; CHECK-NEXT: addi.w $s4, $zero, 1
110 ; CHECK-NEXT: #NO_APP
112 ; CHECK-NEXT: addi.w $s5, $zero, 1
113 ; CHECK-NEXT: #NO_APP
115 ; CHECK-NEXT: addi.w $s6, $zero, 1
116 ; CHECK-NEXT: #NO_APP
118 ; CHECK-NEXT: addi.w $s7, $zero, 1
119 ; CHECK-NEXT: #NO_APP
121 ; CHECK-NEXT: addi.w $s8, $zero, 1
122 ; CHECK-NEXT: #NO_APP
123 ; CHECK-NEXT: beq $s7, $s8, .LBB0_1
124 ; CHECK-NEXT: # %bb.4:
125 ; CHECK-NEXT: st.w $t8, $sp, 0
126 ; CHECK-NEXT: pcalau12i $t8, %pc_hi20(.LBB0_5)
127 ; CHECK-NEXT: addi.w $t8, $t8, %pc_lo12(.LBB0_5)
129 ; CHECK-NEXT: .LBB0_1: # %iftrue
131 ; CHECK-NEXT: .space 536870912
132 ; CHECK-NEXT: #NO_APP
133 ; CHECK-NEXT: b .LBB0_3
134 ; CHECK-NEXT: .LBB0_5: # %iffalse
135 ; CHECK-NEXT: ld.w $t8, $sp, 0
136 ; CHECK-NEXT: # %bb.2: # %iffalse
138 ; CHECK-NEXT: # reg use $zero
139 ; CHECK-NEXT: #NO_APP
141 ; CHECK-NEXT: # reg use $ra
142 ; CHECK-NEXT: #NO_APP
144 ; CHECK-NEXT: # reg use $tp
145 ; CHECK-NEXT: #NO_APP
147 ; CHECK-NEXT: # reg use $a0
148 ; CHECK-NEXT: #NO_APP
150 ; CHECK-NEXT: # reg use $a1
151 ; CHECK-NEXT: #NO_APP
153 ; CHECK-NEXT: # reg use $a2
154 ; CHECK-NEXT: #NO_APP
156 ; CHECK-NEXT: # reg use $a3
157 ; CHECK-NEXT: #NO_APP
159 ; CHECK-NEXT: # reg use $a4
160 ; CHECK-NEXT: #NO_APP
162 ; CHECK-NEXT: # reg use $a5
163 ; CHECK-NEXT: #NO_APP
165 ; CHECK-NEXT: # reg use $a6
166 ; CHECK-NEXT: #NO_APP
168 ; CHECK-NEXT: # reg use $a7
169 ; CHECK-NEXT: #NO_APP
171 ; CHECK-NEXT: # reg use $t0
172 ; CHECK-NEXT: #NO_APP
174 ; CHECK-NEXT: # reg use $t1
175 ; CHECK-NEXT: #NO_APP
177 ; CHECK-NEXT: # reg use $t2
178 ; CHECK-NEXT: #NO_APP
180 ; CHECK-NEXT: # reg use $t3
181 ; CHECK-NEXT: #NO_APP
183 ; CHECK-NEXT: # reg use $t4
184 ; CHECK-NEXT: #NO_APP
186 ; CHECK-NEXT: # reg use $t5
187 ; CHECK-NEXT: #NO_APP
189 ; CHECK-NEXT: # reg use $t6
190 ; CHECK-NEXT: #NO_APP
192 ; CHECK-NEXT: # reg use $t7
193 ; CHECK-NEXT: #NO_APP
195 ; CHECK-NEXT: # reg use $t8
196 ; CHECK-NEXT: #NO_APP
198 ; CHECK-NEXT: # reg use $fp
199 ; CHECK-NEXT: #NO_APP
201 ; CHECK-NEXT: # reg use $s0
202 ; CHECK-NEXT: #NO_APP
204 ; CHECK-NEXT: # reg use $s1
205 ; CHECK-NEXT: #NO_APP
207 ; CHECK-NEXT: # reg use $s2
208 ; CHECK-NEXT: #NO_APP
210 ; CHECK-NEXT: # reg use $s3
211 ; CHECK-NEXT: #NO_APP
213 ; CHECK-NEXT: # reg use $s4
214 ; CHECK-NEXT: #NO_APP
216 ; CHECK-NEXT: # reg use $s5
217 ; CHECK-NEXT: #NO_APP
219 ; CHECK-NEXT: # reg use $s6
220 ; CHECK-NEXT: #NO_APP
222 ; CHECK-NEXT: # reg use $s7
223 ; CHECK-NEXT: #NO_APP
225 ; CHECK-NEXT: # reg use $s8
226 ; CHECK-NEXT: #NO_APP
227 ; CHECK-NEXT: .LBB0_3: # %iftrue
228 ; CHECK-NEXT: ld.w $s8, $sp, 4 # 4-byte Folded Reload
229 ; CHECK-NEXT: ld.w $s7, $sp, 8 # 4-byte Folded Reload
230 ; CHECK-NEXT: ld.w $s6, $sp, 12 # 4-byte Folded Reload
231 ; CHECK-NEXT: ld.w $s5, $sp, 16 # 4-byte Folded Reload
232 ; CHECK-NEXT: ld.w $s4, $sp, 20 # 4-byte Folded Reload
233 ; CHECK-NEXT: ld.w $s3, $sp, 24 # 4-byte Folded Reload
234 ; CHECK-NEXT: ld.w $s2, $sp, 28 # 4-byte Folded Reload
235 ; CHECK-NEXT: ld.w $s1, $sp, 32 # 4-byte Folded Reload
236 ; CHECK-NEXT: ld.w $s0, $sp, 36 # 4-byte Folded Reload
237 ; CHECK-NEXT: ld.w $fp, $sp, 40 # 4-byte Folded Reload
238 ; CHECK-NEXT: ld.w $ra, $sp, 44 # 4-byte Folded Reload
239 ; CHECK-NEXT: addi.w $sp, $sp, 48
241 %zero = call i32 asm sideeffect "addi.w $$zero, $$zero, 1", "={r0}"()
242 %ra = call i32 asm sideeffect "addi.w $$ra, $$zero, 1", "={r1}"()
243 %tp = call i32 asm sideeffect "addi.w $$tp, $$zero, 1", "={r2}"()
244 %a0 = call i32 asm sideeffect "addi.w $$a0, $$zero, 1", "={r4}"()
245 %a1 = call i32 asm sideeffect "addi.w $$a1, $$zero, 1", "={r5}"()
246 %a2 = call i32 asm sideeffect "addi.w $$a2, $$zero, 1", "={r6}"()
247 %a3 = call i32 asm sideeffect "addi.w $$a3, $$zero, 1", "={r7}"()
248 %a4 = call i32 asm sideeffect "addi.w $$a4, $$zero, 1", "={r8}"()
249 %a5 = call i32 asm sideeffect "addi.w $$a5, $$zero, 1", "={r9}"()
250 %a6 = call i32 asm sideeffect "addi.w $$a6, $$zero, 1", "={r10}"()
251 %a7 = call i32 asm sideeffect "addi.w $$a7, $$zero, 1", "={r11}"()
252 %t0 = call i32 asm sideeffect "addi.w $$t0, $$zero, 1", "={r12}"()
253 %t1 = call i32 asm sideeffect "addi.w $$t1, $$zero, 1", "={r13}"()
254 %t2 = call i32 asm sideeffect "addi.w $$t2, $$zero, 1", "={r14}"()
255 %t3 = call i32 asm sideeffect "addi.w $$t3, $$zero, 1", "={r15}"()
256 %t4 = call i32 asm sideeffect "addi.w $$t4, $$zero, 1", "={r16}"()
257 %t5 = call i32 asm sideeffect "addi.w $$t5, $$zero, 1", "={r17}"()
258 %t6 = call i32 asm sideeffect "addi.w $$t6, $$zero, 1", "={r18}"()
259 %t7 = call i32 asm sideeffect "addi.w $$t7, $$zero, 1", "={r19}"()
260 %t8 = call i32 asm sideeffect "addi.w $$t8, $$zero, 1", "={r20}"()
261 ;; r21 Reserved (Non-allocatable)
262 %s9 = call i32 asm sideeffect "addi.w $$s9, $$zero, 1", "={r22}"()
263 %s0 = call i32 asm sideeffect "addi.w $$s0, $$zero, 1", "={r23}"()
264 %s1 = call i32 asm sideeffect "addi.w $$s1, $$zero, 1", "={r24}"()
265 %s2 = call i32 asm sideeffect "addi.w $$s2, $$zero, 1", "={r25}"()
266 %s3 = call i32 asm sideeffect "addi.w $$s3, $$zero, 1", "={r26}"()
267 %s4 = call i32 asm sideeffect "addi.w $$s4, $$zero, 1", "={r27}"()
268 %s5 = call i32 asm sideeffect "addi.w $$s5, $$zero, 1", "={r28}"()
269 %s6 = call i32 asm sideeffect "addi.w $$s6, $$zero, 1", "={r29}"()
270 %s7 = call i32 asm sideeffect "addi.w $$s7, $$zero, 1", "={r30}"()
271 %s8 = call i32 asm sideeffect "addi.w $$s8, $$zero, 1", "={r31}"()
273 %cmp = icmp eq i32 %s7, %s8
274 br i1 %cmp, label %iftrue, label %iffalse
277 call void asm sideeffect ".space 536870912", ""()
281 call void asm sideeffect "# reg use $0", "{r0}"(i32 %zero)
282 call void asm sideeffect "# reg use $0", "{r1}"(i32 %ra)
283 call void asm sideeffect "# reg use $0", "{r2}"(i32 %tp)
284 call void asm sideeffect "# reg use $0", "{r4}"(i32 %a0)
285 call void asm sideeffect "# reg use $0", "{r5}"(i32 %a1)
286 call void asm sideeffect "# reg use $0", "{r6}"(i32 %a2)
287 call void asm sideeffect "# reg use $0", "{r7}"(i32 %a3)
288 call void asm sideeffect "# reg use $0", "{r8}"(i32 %a4)
289 call void asm sideeffect "# reg use $0", "{r9}"(i32 %a5)
290 call void asm sideeffect "# reg use $0", "{r10}"(i32 %a6)
291 call void asm sideeffect "# reg use $0", "{r11}"(i32 %a7)
292 call void asm sideeffect "# reg use $0", "{r12}"(i32 %t0)
293 call void asm sideeffect "# reg use $0", "{r13}"(i32 %t1)
294 call void asm sideeffect "# reg use $0", "{r14}"(i32 %t2)
295 call void asm sideeffect "# reg use $0", "{r15}"(i32 %t3)
296 call void asm sideeffect "# reg use $0", "{r16}"(i32 %t4)
297 call void asm sideeffect "# reg use $0", "{r17}"(i32 %t5)
298 call void asm sideeffect "# reg use $0", "{r18}"(i32 %t6)
299 call void asm sideeffect "# reg use $0", "{r19}"(i32 %t7)
300 call void asm sideeffect "# reg use $0", "{r20}"(i32 %t8)
301 ;; r21 Reserved (Non-allocatable)
302 call void asm sideeffect "# reg use $0", "{r22}"(i32 %s9)
303 call void asm sideeffect "# reg use $0", "{r23}"(i32 %s0)
304 call void asm sideeffect "# reg use $0", "{r24}"(i32 %s1)
305 call void asm sideeffect "# reg use $0", "{r25}"(i32 %s2)
306 call void asm sideeffect "# reg use $0", "{r26}"(i32 %s3)
307 call void asm sideeffect "# reg use $0", "{r27}"(i32 %s4)
308 call void asm sideeffect "# reg use $0", "{r28}"(i32 %s5)
309 call void asm sideeffect "# reg use $0", "{r29}"(i32 %s6)
310 call void asm sideeffect "# reg use $0", "{r30}"(i32 %s7)
311 call void asm sideeffect "# reg use $0", "{r31}"(i32 %s8)