1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -O0 -mtriple=mipsel-linux-gnu -global-isel -verify-machineinstrs %s -o -| FileCheck %s -check-prefixes=MIPS32
4 define i1 @phi_i1(i1 %cnd, i1 %a, i1 %b) {
5 ; MIPS32-LABEL: phi_i1:
6 ; MIPS32: # %bb.0: # %entry
7 ; MIPS32-NEXT: addiu $sp, $sp, -16
8 ; MIPS32-NEXT: .cfi_def_cfa_offset 16
9 ; MIPS32-NEXT: ori $1, $zero, 1
10 ; MIPS32-NEXT: and $1, $4, $1
11 ; MIPS32-NEXT: sw $5, 12($sp) # 4-byte Folded Spill
12 ; MIPS32-NEXT: sw $6, 8($sp) # 4-byte Folded Spill
13 ; MIPS32-NEXT: bnez $1, $BB0_2
15 ; MIPS32-NEXT: # %bb.1: # %entry
16 ; MIPS32-NEXT: j $BB0_3
18 ; MIPS32-NEXT: $BB0_2: # %cond.true
19 ; MIPS32-NEXT: lw $1, 12($sp) # 4-byte Folded Reload
20 ; MIPS32-NEXT: sw $1, 4($sp) # 4-byte Folded Spill
21 ; MIPS32-NEXT: j $BB0_4
23 ; MIPS32-NEXT: $BB0_3: # %cond.false
24 ; MIPS32-NEXT: lw $1, 8($sp) # 4-byte Folded Reload
25 ; MIPS32-NEXT: sw $1, 4($sp) # 4-byte Folded Spill
26 ; MIPS32-NEXT: $BB0_4: # %cond.end
27 ; MIPS32-NEXT: lw $1, 4($sp) # 4-byte Folded Reload
28 ; MIPS32-NEXT: move $2, $1
29 ; MIPS32-NEXT: addiu $sp, $sp, 16
33 br i1 %cnd, label %cond.true, label %cond.false
42 %cond = phi i1 [ %a, %cond.true ], [ %b, %cond.false ]
46 define i8 @phi_i8(i1 %cnd, i8 %a, i8 %b) {
47 ; MIPS32-LABEL: phi_i8:
48 ; MIPS32: # %bb.0: # %entry
49 ; MIPS32-NEXT: addiu $sp, $sp, -16
50 ; MIPS32-NEXT: .cfi_def_cfa_offset 16
51 ; MIPS32-NEXT: ori $1, $zero, 1
52 ; MIPS32-NEXT: and $1, $4, $1
53 ; MIPS32-NEXT: sw $5, 12($sp) # 4-byte Folded Spill
54 ; MIPS32-NEXT: sw $6, 8($sp) # 4-byte Folded Spill
55 ; MIPS32-NEXT: bnez $1, $BB1_2
57 ; MIPS32-NEXT: # %bb.1: # %entry
58 ; MIPS32-NEXT: j $BB1_3
60 ; MIPS32-NEXT: $BB1_2: # %cond.true
61 ; MIPS32-NEXT: lw $1, 12($sp) # 4-byte Folded Reload
62 ; MIPS32-NEXT: sw $1, 4($sp) # 4-byte Folded Spill
63 ; MIPS32-NEXT: j $BB1_4
65 ; MIPS32-NEXT: $BB1_3: # %cond.false
66 ; MIPS32-NEXT: lw $1, 8($sp) # 4-byte Folded Reload
67 ; MIPS32-NEXT: sw $1, 4($sp) # 4-byte Folded Spill
68 ; MIPS32-NEXT: $BB1_4: # %cond.end
69 ; MIPS32-NEXT: lw $1, 4($sp) # 4-byte Folded Reload
70 ; MIPS32-NEXT: move $2, $1
71 ; MIPS32-NEXT: addiu $sp, $sp, 16
75 br i1 %cnd, label %cond.true, label %cond.false
84 %cond = phi i8 [ %a, %cond.true ], [ %b, %cond.false ]
88 define i16 @phi_i16(i1 %cnd, i16 %a, i16 %b) {
89 ; MIPS32-LABEL: phi_i16:
90 ; MIPS32: # %bb.0: # %entry
91 ; MIPS32-NEXT: addiu $sp, $sp, -16
92 ; MIPS32-NEXT: .cfi_def_cfa_offset 16
93 ; MIPS32-NEXT: ori $1, $zero, 1
94 ; MIPS32-NEXT: and $1, $4, $1
95 ; MIPS32-NEXT: sw $5, 12($sp) # 4-byte Folded Spill
96 ; MIPS32-NEXT: sw $6, 8($sp) # 4-byte Folded Spill
97 ; MIPS32-NEXT: bnez $1, $BB2_2
99 ; MIPS32-NEXT: # %bb.1: # %entry
100 ; MIPS32-NEXT: j $BB2_3
102 ; MIPS32-NEXT: $BB2_2: # %cond.true
103 ; MIPS32-NEXT: lw $1, 12($sp) # 4-byte Folded Reload
104 ; MIPS32-NEXT: sw $1, 4($sp) # 4-byte Folded Spill
105 ; MIPS32-NEXT: j $BB2_4
107 ; MIPS32-NEXT: $BB2_3: # %cond.false
108 ; MIPS32-NEXT: lw $1, 8($sp) # 4-byte Folded Reload
109 ; MIPS32-NEXT: sw $1, 4($sp) # 4-byte Folded Spill
110 ; MIPS32-NEXT: $BB2_4: # %cond.end
111 ; MIPS32-NEXT: lw $1, 4($sp) # 4-byte Folded Reload
112 ; MIPS32-NEXT: move $2, $1
113 ; MIPS32-NEXT: addiu $sp, $sp, 16
114 ; MIPS32-NEXT: jr $ra
117 br i1 %cnd, label %cond.true, label %cond.false
126 %cond = phi i16 [ %a, %cond.true ], [ %b, %cond.false ]
130 define i32 @phi_i32(i1 %cnd, i32 %a, i32 %b) {
131 ; MIPS32-LABEL: phi_i32:
132 ; MIPS32: # %bb.0: # %entry
133 ; MIPS32-NEXT: addiu $sp, $sp, -16
134 ; MIPS32-NEXT: .cfi_def_cfa_offset 16
135 ; MIPS32-NEXT: ori $1, $zero, 1
136 ; MIPS32-NEXT: and $1, $4, $1
137 ; MIPS32-NEXT: sw $5, 12($sp) # 4-byte Folded Spill
138 ; MIPS32-NEXT: sw $6, 8($sp) # 4-byte Folded Spill
139 ; MIPS32-NEXT: bnez $1, $BB3_2
141 ; MIPS32-NEXT: # %bb.1: # %entry
142 ; MIPS32-NEXT: j $BB3_3
144 ; MIPS32-NEXT: $BB3_2: # %cond.true
145 ; MIPS32-NEXT: lw $1, 12($sp) # 4-byte Folded Reload
146 ; MIPS32-NEXT: sw $1, 4($sp) # 4-byte Folded Spill
147 ; MIPS32-NEXT: j $BB3_4
149 ; MIPS32-NEXT: $BB3_3: # %cond.false
150 ; MIPS32-NEXT: lw $1, 8($sp) # 4-byte Folded Reload
151 ; MIPS32-NEXT: sw $1, 4($sp) # 4-byte Folded Spill
152 ; MIPS32-NEXT: $BB3_4: # %cond.end
153 ; MIPS32-NEXT: lw $1, 4($sp) # 4-byte Folded Reload
154 ; MIPS32-NEXT: move $2, $1
155 ; MIPS32-NEXT: addiu $sp, $sp, 16
156 ; MIPS32-NEXT: jr $ra
159 br i1 %cnd, label %cond.true, label %cond.false
168 %cond = phi i32 [ %a, %cond.true ], [ %b, %cond.false ]
172 define i64 @phi_i64(i1 %cnd, i64 %a, i64 %b) {
173 ; MIPS32-LABEL: phi_i64:
174 ; MIPS32: # %bb.0: # %entry
175 ; MIPS32-NEXT: addiu $sp, $sp, -24
176 ; MIPS32-NEXT: .cfi_def_cfa_offset 24
177 ; MIPS32-NEXT: addiu $1, $sp, 40
178 ; MIPS32-NEXT: lw $1, 0($1)
179 ; MIPS32-NEXT: addiu $2, $sp, 44
180 ; MIPS32-NEXT: lw $2, 0($2)
181 ; MIPS32-NEXT: ori $3, $zero, 1
182 ; MIPS32-NEXT: and $3, $4, $3
183 ; MIPS32-NEXT: sw $1, 20($sp) # 4-byte Folded Spill
184 ; MIPS32-NEXT: sw $6, 16($sp) # 4-byte Folded Spill
185 ; MIPS32-NEXT: sw $7, 12($sp) # 4-byte Folded Spill
186 ; MIPS32-NEXT: sw $2, 8($sp) # 4-byte Folded Spill
187 ; MIPS32-NEXT: bnez $3, $BB4_2
189 ; MIPS32-NEXT: # %bb.1: # %entry
190 ; MIPS32-NEXT: j $BB4_3
192 ; MIPS32-NEXT: $BB4_2: # %cond.true
193 ; MIPS32-NEXT: lw $1, 16($sp) # 4-byte Folded Reload
194 ; MIPS32-NEXT: lw $2, 12($sp) # 4-byte Folded Reload
195 ; MIPS32-NEXT: sw $1, 4($sp) # 4-byte Folded Spill
196 ; MIPS32-NEXT: sw $2, 0($sp) # 4-byte Folded Spill
197 ; MIPS32-NEXT: j $BB4_4
199 ; MIPS32-NEXT: $BB4_3: # %cond.false
200 ; MIPS32-NEXT: lw $1, 20($sp) # 4-byte Folded Reload
201 ; MIPS32-NEXT: lw $2, 8($sp) # 4-byte Folded Reload
202 ; MIPS32-NEXT: sw $1, 4($sp) # 4-byte Folded Spill
203 ; MIPS32-NEXT: sw $2, 0($sp) # 4-byte Folded Spill
204 ; MIPS32-NEXT: $BB4_4: # %cond.end
205 ; MIPS32-NEXT: lw $1, 0($sp) # 4-byte Folded Reload
206 ; MIPS32-NEXT: lw $2, 4($sp) # 4-byte Folded Reload
207 ; MIPS32-NEXT: move $3, $1
208 ; MIPS32-NEXT: addiu $sp, $sp, 24
209 ; MIPS32-NEXT: jr $ra
212 br i1 %cnd, label %cond.true, label %cond.false
221 %cond = phi i64 [ %a, %cond.true ], [ %b, %cond.false ]
225 define void @phi_ambiguous_i64_in_fpr(i1 %cnd, i64* %i64_ptr_a, i64* %i64_ptr_b, i64* %i64_ptr_c) {
226 ; MIPS32-LABEL: phi_ambiguous_i64_in_fpr:
227 ; MIPS32: # %bb.0: # %entry
228 ; MIPS32-NEXT: addiu $sp, $sp, -32
229 ; MIPS32-NEXT: .cfi_def_cfa_offset 32
230 ; MIPS32-NEXT: ldc1 $f0, 0($5)
231 ; MIPS32-NEXT: ldc1 $f2, 0($6)
232 ; MIPS32-NEXT: ori $1, $zero, 1
233 ; MIPS32-NEXT: and $1, $4, $1
234 ; MIPS32-NEXT: sw $7, 28($sp) # 4-byte Folded Spill
235 ; MIPS32-NEXT: sdc1 $f0, 16($sp) # 8-byte Folded Spill
236 ; MIPS32-NEXT: sdc1 $f2, 8($sp) # 8-byte Folded Spill
237 ; MIPS32-NEXT: bnez $1, $BB5_2
239 ; MIPS32-NEXT: # %bb.1: # %entry
240 ; MIPS32-NEXT: j $BB5_3
242 ; MIPS32-NEXT: $BB5_2: # %cond.true
243 ; MIPS32-NEXT: ldc1 $f0, 16($sp) # 8-byte Folded Reload
244 ; MIPS32-NEXT: sdc1 $f0, 0($sp) # 8-byte Folded Spill
245 ; MIPS32-NEXT: j $BB5_4
247 ; MIPS32-NEXT: $BB5_3: # %cond.false
248 ; MIPS32-NEXT: ldc1 $f0, 8($sp) # 8-byte Folded Reload
249 ; MIPS32-NEXT: sdc1 $f0, 0($sp) # 8-byte Folded Spill
250 ; MIPS32-NEXT: $BB5_4: # %cond.end
251 ; MIPS32-NEXT: ldc1 $f0, 0($sp) # 8-byte Folded Reload
252 ; MIPS32-NEXT: lw $1, 28($sp) # 4-byte Folded Reload
253 ; MIPS32-NEXT: sdc1 $f0, 0($1)
254 ; MIPS32-NEXT: addiu $sp, $sp, 32
255 ; MIPS32-NEXT: jr $ra
258 %0 = load i64, i64* %i64_ptr_a, align 4
259 %1 = load i64, i64* %i64_ptr_b, align 4
260 br i1 %cnd, label %cond.true, label %cond.false
269 %cond = phi i64 [ %0, %cond.true ], [ %1, %cond.false ]
270 store i64 %cond, i64* %i64_ptr_c, align 4
274 define float @phi_float(i1 %cnd, float %a, float %b) {
275 ; MIPS32-LABEL: phi_float:
276 ; MIPS32: # %bb.0: # %entry
277 ; MIPS32-NEXT: addiu $sp, $sp, -16
278 ; MIPS32-NEXT: .cfi_def_cfa_offset 16
279 ; MIPS32-NEXT: mtc1 $5, $f0
280 ; MIPS32-NEXT: mtc1 $6, $f1
281 ; MIPS32-NEXT: ori $1, $zero, 1
282 ; MIPS32-NEXT: and $1, $4, $1
283 ; MIPS32-NEXT: swc1 $f0, 12($sp) # 4-byte Folded Spill
284 ; MIPS32-NEXT: swc1 $f1, 8($sp) # 4-byte Folded Spill
285 ; MIPS32-NEXT: bnez $1, $BB6_2
287 ; MIPS32-NEXT: # %bb.1: # %entry
288 ; MIPS32-NEXT: j $BB6_3
290 ; MIPS32-NEXT: $BB6_2: # %cond.true
291 ; MIPS32-NEXT: lwc1 $f0, 12($sp) # 4-byte Folded Reload
292 ; MIPS32-NEXT: swc1 $f0, 4($sp) # 4-byte Folded Spill
293 ; MIPS32-NEXT: j $BB6_4
295 ; MIPS32-NEXT: $BB6_3: # %cond.false
296 ; MIPS32-NEXT: lwc1 $f0, 8($sp) # 4-byte Folded Reload
297 ; MIPS32-NEXT: swc1 $f0, 4($sp) # 4-byte Folded Spill
298 ; MIPS32-NEXT: $BB6_4: # %cond.end
299 ; MIPS32-NEXT: lwc1 $f0, 4($sp) # 4-byte Folded Reload
300 ; MIPS32-NEXT: addiu $sp, $sp, 16
301 ; MIPS32-NEXT: jr $ra
304 br i1 %cnd, label %cond.true, label %cond.false
313 %cond = phi float [ %a, %cond.true ], [ %b, %cond.false ]
317 define void @phi_ambiguous_float_in_gpr(i1 %cnd, float* %f32_ptr_a, float* %f32_ptr_b, float* %f32_ptr_c) {
318 ; MIPS32-LABEL: phi_ambiguous_float_in_gpr:
319 ; MIPS32: # %bb.0: # %entry
320 ; MIPS32-NEXT: addiu $sp, $sp, -16
321 ; MIPS32-NEXT: .cfi_def_cfa_offset 16
322 ; MIPS32-NEXT: lw $1, 0($5)
323 ; MIPS32-NEXT: lw $2, 0($6)
324 ; MIPS32-NEXT: ori $3, $zero, 1
325 ; MIPS32-NEXT: and $3, $4, $3
326 ; MIPS32-NEXT: sw $1, 12($sp) # 4-byte Folded Spill
327 ; MIPS32-NEXT: sw $7, 8($sp) # 4-byte Folded Spill
328 ; MIPS32-NEXT: sw $2, 4($sp) # 4-byte Folded Spill
329 ; MIPS32-NEXT: bnez $3, $BB7_2
331 ; MIPS32-NEXT: # %bb.1: # %entry
332 ; MIPS32-NEXT: j $BB7_3
334 ; MIPS32-NEXT: $BB7_2: # %cond.true
335 ; MIPS32-NEXT: lw $1, 12($sp) # 4-byte Folded Reload
336 ; MIPS32-NEXT: sw $1, 0($sp) # 4-byte Folded Spill
337 ; MIPS32-NEXT: j $BB7_4
339 ; MIPS32-NEXT: $BB7_3: # %cond.false
340 ; MIPS32-NEXT: lw $1, 4($sp) # 4-byte Folded Reload
341 ; MIPS32-NEXT: sw $1, 0($sp) # 4-byte Folded Spill
342 ; MIPS32-NEXT: $BB7_4: # %cond.end
343 ; MIPS32-NEXT: lw $1, 0($sp) # 4-byte Folded Reload
344 ; MIPS32-NEXT: lw $2, 8($sp) # 4-byte Folded Reload
345 ; MIPS32-NEXT: sw $1, 0($2)
346 ; MIPS32-NEXT: addiu $sp, $sp, 16
347 ; MIPS32-NEXT: jr $ra
350 %0 = load float, float* %f32_ptr_a, align 4
351 %1 = load float, float* %f32_ptr_b, align 4
352 br i1 %cnd, label %cond.true, label %cond.false
361 %cond = phi float [ %0, %cond.true ], [ %1, %cond.false ]
362 store float %cond, float* %f32_ptr_c, align 4
366 define double @phi_double(double %a, double %b, i1 %cnd) {
367 ; MIPS32-LABEL: phi_double:
368 ; MIPS32: # %bb.0: # %entry
369 ; MIPS32-NEXT: addiu $sp, $sp, -24
370 ; MIPS32-NEXT: .cfi_def_cfa_offset 24
371 ; MIPS32-NEXT: addiu $1, $sp, 40
372 ; MIPS32-NEXT: lw $1, 0($1)
373 ; MIPS32-NEXT: ori $2, $zero, 1
374 ; MIPS32-NEXT: and $1, $1, $2
375 ; MIPS32-NEXT: sdc1 $f12, 16($sp) # 8-byte Folded Spill
376 ; MIPS32-NEXT: sdc1 $f14, 8($sp) # 8-byte Folded Spill
377 ; MIPS32-NEXT: bnez $1, $BB8_2
379 ; MIPS32-NEXT: # %bb.1: # %entry
380 ; MIPS32-NEXT: j $BB8_3
382 ; MIPS32-NEXT: $BB8_2: # %cond.true
383 ; MIPS32-NEXT: ldc1 $f0, 16($sp) # 8-byte Folded Reload
384 ; MIPS32-NEXT: sdc1 $f0, 0($sp) # 8-byte Folded Spill
385 ; MIPS32-NEXT: j $BB8_4
387 ; MIPS32-NEXT: $BB8_3: # %cond.false
388 ; MIPS32-NEXT: ldc1 $f0, 8($sp) # 8-byte Folded Reload
389 ; MIPS32-NEXT: sdc1 $f0, 0($sp) # 8-byte Folded Spill
390 ; MIPS32-NEXT: $BB8_4: # %cond.end
391 ; MIPS32-NEXT: ldc1 $f0, 0($sp) # 8-byte Folded Reload
392 ; MIPS32-NEXT: addiu $sp, $sp, 24
393 ; MIPS32-NEXT: jr $ra
396 br i1 %cnd, label %cond.true, label %cond.false
405 %cond = phi double [ %a, %cond.true ], [ %b, %cond.false ]