1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -O0 -mtriple=mipsel-linux-gnu -run-pass=regbankselect -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=MIPS32
5 define i32 @phi_i32(i1 %cnd, i32 %a, i32 %b) {
7 br i1 %cnd, label %cond.true, label %cond.false
9 cond.true: ; preds = %entry
12 cond.false: ; preds = %entry
15 cond.end: ; preds = %cond.false, %cond.true
16 %cond = phi i32 [ %a, %cond.true ], [ %b, %cond.false ]
20 define i64 @phi_i64(i1 %cnd, i64 %a, i64 %b) {
22 br i1 %cnd, label %cond.true, label %cond.false
24 cond.true: ; preds = %entry
27 cond.false: ; preds = %entry
30 cond.end: ; preds = %cond.false, %cond.true
31 %cond = phi i64 [ %a, %cond.true ], [ %b, %cond.false ]
35 define void @phi_ambiguous_i64_in_fpr(i1 %cnd, ptr %i64_ptr_a, ptr %i64_ptr_b, ptr %i64_ptr_c) {
37 %0 = load i64, ptr %i64_ptr_a, align 8
38 %1 = load i64, ptr %i64_ptr_b, align 8
39 br i1 %cnd, label %cond.true, label %cond.false
41 cond.true: ; preds = %entry
44 cond.false: ; preds = %entry
47 cond.end: ; preds = %cond.false, %cond.true
48 %cond = phi i64 [ %0, %cond.true ], [ %1, %cond.false ]
49 store i64 %cond, ptr %i64_ptr_c, align 8
53 define float @phi_float(i1 %cnd, float %a, float %b) {
55 br i1 %cnd, label %cond.true, label %cond.false
57 cond.true: ; preds = %entry
60 cond.false: ; preds = %entry
63 cond.end: ; preds = %cond.false, %cond.true
64 %cond = phi float [ %a, %cond.true ], [ %b, %cond.false ]
68 define void @phi_ambiguous_float_in_gpr(i1 %cnd, ptr %f32_ptr_a, ptr %f32_ptr_b, ptr %f32_ptr_c) {
70 %0 = load float, ptr %f32_ptr_a, align 4
71 %1 = load float, ptr %f32_ptr_b, align 4
72 br i1 %cnd, label %cond.true, label %cond.false
74 cond.true: ; preds = %entry
77 cond.false: ; preds = %entry
80 cond.end: ; preds = %cond.false, %cond.true
81 %cond = phi float [ %0, %cond.true ], [ %1, %cond.false ]
82 store float %cond, ptr %f32_ptr_c, align 4
86 define double @phi_double(double %a, double %b, i1 %cnd) {
88 br i1 %cnd, label %cond.true, label %cond.false
90 cond.true: ; preds = %entry
93 cond.false: ; preds = %entry
96 cond.end: ; preds = %cond.false, %cond.true
97 %cond = phi double [ %a, %cond.true ], [ %b, %cond.false ]
106 tracksRegLiveness: true
108 ; MIPS32-LABEL: name: phi_i32
109 ; MIPS32: bb.0.entry:
110 ; MIPS32: successors: %bb.1(0x40000000), %bb.2(0x40000000)
111 ; MIPS32: liveins: $a0, $a1, $a2
112 ; MIPS32: [[COPY:%[0-9]+]]:gprb(s32) = COPY $a0
113 ; MIPS32: [[COPY1:%[0-9]+]]:gprb(s32) = COPY $a1
114 ; MIPS32: [[COPY2:%[0-9]+]]:gprb(s32) = COPY $a2
115 ; MIPS32: [[C:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 1
116 ; MIPS32: [[COPY3:%[0-9]+]]:gprb(s32) = COPY [[COPY]](s32)
117 ; MIPS32: [[AND:%[0-9]+]]:gprb(s32) = G_AND [[COPY3]], [[C]]
118 ; MIPS32: G_BRCOND [[AND]](s32), %bb.1
120 ; MIPS32: bb.1.cond.true:
121 ; MIPS32: successors: %bb.3(0x80000000)
123 ; MIPS32: bb.2.cond.false:
124 ; MIPS32: successors: %bb.3(0x80000000)
125 ; MIPS32: bb.3.cond.end:
126 ; MIPS32: [[PHI:%[0-9]+]]:gprb(s32) = G_PHI [[COPY1]](s32), %bb.1, [[COPY2]](s32), %bb.2
127 ; MIPS32: $v0 = COPY [[PHI]](s32)
128 ; MIPS32: RetRA implicit $v0
130 liveins: $a0, $a1, $a2
135 %6:_(s32) = G_CONSTANT i32 1
136 %7:_(s32) = COPY %3(s32)
137 %5:_(s32) = G_AND %7, %6
138 G_BRCOND %5(s32), %bb.2
147 %4:_(s32) = G_PHI %1(s32), %bb.2, %2(s32), %bb.3
156 tracksRegLiveness: true
158 - { id: 0, offset: 20, size: 4, alignment: 4, isImmutable: true }
159 - { id: 1, offset: 16, size: 4, alignment: 8, isImmutable: true }
161 ; MIPS32-LABEL: name: phi_i64
162 ; MIPS32: bb.0.entry:
163 ; MIPS32: successors: %bb.1(0x40000000), %bb.2(0x40000000)
164 ; MIPS32: liveins: $a0, $a2, $a3
165 ; MIPS32: [[COPY:%[0-9]+]]:gprb(s32) = COPY $a0
166 ; MIPS32: [[COPY1:%[0-9]+]]:gprb(s32) = COPY $a2
167 ; MIPS32: [[COPY2:%[0-9]+]]:gprb(s32) = COPY $a3
168 ; MIPS32: [[FRAME_INDEX:%[0-9]+]]:gprb(p0) = G_FRAME_INDEX %fixed-stack.0
169 ; MIPS32: [[LOAD:%[0-9]+]]:gprb(s32) = G_LOAD [[FRAME_INDEX]](p0) :: (load (s32) from %fixed-stack.0, align 8)
170 ; MIPS32: [[FRAME_INDEX1:%[0-9]+]]:gprb(p0) = G_FRAME_INDEX %fixed-stack.1
171 ; MIPS32: [[LOAD1:%[0-9]+]]:gprb(s32) = G_LOAD [[FRAME_INDEX1]](p0) :: (load (s32) from %fixed-stack.1)
172 ; MIPS32: [[C:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 1
173 ; MIPS32: [[COPY3:%[0-9]+]]:gprb(s32) = COPY [[COPY]](s32)
174 ; MIPS32: [[AND:%[0-9]+]]:gprb(s32) = G_AND [[COPY3]], [[C]]
175 ; MIPS32: G_BRCOND [[AND]](s32), %bb.1
177 ; MIPS32: bb.1.cond.true:
178 ; MIPS32: successors: %bb.3(0x80000000)
180 ; MIPS32: bb.2.cond.false:
181 ; MIPS32: successors: %bb.3(0x80000000)
182 ; MIPS32: bb.3.cond.end:
183 ; MIPS32: [[PHI:%[0-9]+]]:gprb(s32) = G_PHI [[COPY1]](s32), %bb.1, [[LOAD]](s32), %bb.2
184 ; MIPS32: [[PHI1:%[0-9]+]]:gprb(s32) = G_PHI [[COPY2]](s32), %bb.1, [[LOAD1]](s32), %bb.2
185 ; MIPS32: $v0 = COPY [[PHI]](s32)
186 ; MIPS32: $v1 = COPY [[PHI1]](s32)
187 ; MIPS32: RetRA implicit $v0, implicit $v1
189 liveins: $a0, $a2, $a3
194 %1:_(s64) = G_MERGE_VALUES %4(s32), %5(s32)
195 %8:_(p0) = G_FRAME_INDEX %fixed-stack.1
196 %6:_(s32) = G_LOAD %8(p0) :: (load (s32) from %fixed-stack.1, align 8)
197 %9:_(p0) = G_FRAME_INDEX %fixed-stack.0
198 %7:_(s32) = G_LOAD %9(p0) :: (load (s32) from %fixed-stack.0)
199 %2:_(s64) = G_MERGE_VALUES %6(s32), %7(s32)
200 %14:_(s32) = G_CONSTANT i32 1
201 %15:_(s32) = COPY %3(s32)
202 %13:_(s32) = G_AND %15, %14
203 G_BRCOND %13(s32), %bb.2
212 %10:_(s64) = G_PHI %1(s64), %bb.2, %2(s64), %bb.3
213 %11:_(s32), %12:_(s32) = G_UNMERGE_VALUES %10(s64)
216 RetRA implicit $v0, implicit $v1
220 name: phi_ambiguous_i64_in_fpr
223 tracksRegLiveness: true
225 ; MIPS32-LABEL: name: phi_ambiguous_i64_in_fpr
226 ; MIPS32: bb.0.entry:
227 ; MIPS32: successors: %bb.1(0x40000000), %bb.2(0x40000000)
228 ; MIPS32: liveins: $a0, $a1, $a2, $a3
229 ; MIPS32: [[COPY:%[0-9]+]]:gprb(s32) = COPY $a0
230 ; MIPS32: [[COPY1:%[0-9]+]]:gprb(p0) = COPY $a1
231 ; MIPS32: [[COPY2:%[0-9]+]]:gprb(p0) = COPY $a2
232 ; MIPS32: [[COPY3:%[0-9]+]]:gprb(p0) = COPY $a3
233 ; MIPS32: [[LOAD:%[0-9]+]]:fprb(s64) = G_LOAD [[COPY1]](p0) :: (load (s64) from %ir.i64_ptr_a)
234 ; MIPS32: [[LOAD1:%[0-9]+]]:fprb(s64) = G_LOAD [[COPY2]](p0) :: (load (s64) from %ir.i64_ptr_b)
235 ; MIPS32: [[C:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 1
236 ; MIPS32: [[COPY4:%[0-9]+]]:gprb(s32) = COPY [[COPY]](s32)
237 ; MIPS32: [[AND:%[0-9]+]]:gprb(s32) = G_AND [[COPY4]], [[C]]
238 ; MIPS32: G_BRCOND [[AND]](s32), %bb.1
240 ; MIPS32: bb.1.cond.true:
241 ; MIPS32: successors: %bb.3(0x80000000)
243 ; MIPS32: bb.2.cond.false:
244 ; MIPS32: successors: %bb.3(0x80000000)
245 ; MIPS32: bb.3.cond.end:
246 ; MIPS32: [[PHI:%[0-9]+]]:fprb(s64) = G_PHI [[LOAD]](s64), %bb.1, [[LOAD1]](s64), %bb.2
247 ; MIPS32: G_STORE [[PHI]](s64), [[COPY3]](p0) :: (store (s64) into %ir.i64_ptr_c)
250 liveins: $a0, $a1, $a2, $a3
256 %5:_(s64) = G_LOAD %1(p0) :: (load (s64) from %ir.i64_ptr_a)
257 %6:_(s64) = G_LOAD %2(p0) :: (load (s64) from %ir.i64_ptr_b)
258 %9:_(s32) = G_CONSTANT i32 1
259 %10:_(s32) = COPY %4(s32)
260 %8:_(s32) = G_AND %10, %9
261 G_BRCOND %8(s32), %bb.2
270 %7:_(s64) = G_PHI %5(s64), %bb.2, %6(s64), %bb.3
271 G_STORE %7(s64), %3(p0) :: (store (s64) into %ir.i64_ptr_c)
279 tracksRegLiveness: true
281 ; MIPS32-LABEL: name: phi_float
282 ; MIPS32: bb.0.entry:
283 ; MIPS32: successors: %bb.1(0x40000000), %bb.2(0x40000000)
284 ; MIPS32: liveins: $a0, $a1, $a2
285 ; MIPS32: [[COPY:%[0-9]+]]:gprb(s32) = COPY $a0
286 ; MIPS32: [[COPY1:%[0-9]+]]:gprb(s32) = COPY $a1
287 ; MIPS32: [[COPY2:%[0-9]+]]:gprb(s32) = COPY $a2
288 ; MIPS32: [[C:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 1
289 ; MIPS32: [[COPY3:%[0-9]+]]:gprb(s32) = COPY [[COPY]](s32)
290 ; MIPS32: [[AND:%[0-9]+]]:gprb(s32) = G_AND [[COPY3]], [[C]]
291 ; MIPS32: G_BRCOND [[AND]](s32), %bb.1
293 ; MIPS32: bb.1.cond.true:
294 ; MIPS32: successors: %bb.3(0x80000000)
296 ; MIPS32: bb.2.cond.false:
297 ; MIPS32: successors: %bb.3(0x80000000)
298 ; MIPS32: bb.3.cond.end:
299 ; MIPS32: [[PHI:%[0-9]+]]:gprb(s32) = G_PHI [[COPY1]](s32), %bb.1, [[COPY2]](s32), %bb.2
300 ; MIPS32: $f0 = COPY [[PHI]](s32)
301 ; MIPS32: RetRA implicit $f0
303 liveins: $a0, $a1, $a2
308 %6:_(s32) = G_CONSTANT i32 1
309 %7:_(s32) = COPY %3(s32)
310 %5:_(s32) = G_AND %7, %6
311 G_BRCOND %5(s32), %bb.2
320 %4:_(s32) = G_PHI %1(s32), %bb.2, %2(s32), %bb.3
326 name: phi_ambiguous_float_in_gpr
329 tracksRegLiveness: true
331 ; MIPS32-LABEL: name: phi_ambiguous_float_in_gpr
332 ; MIPS32: bb.0.entry:
333 ; MIPS32: successors: %bb.1(0x40000000), %bb.2(0x40000000)
334 ; MIPS32: liveins: $a0, $a1, $a2, $a3
335 ; MIPS32: [[COPY:%[0-9]+]]:gprb(s32) = COPY $a0
336 ; MIPS32: [[COPY1:%[0-9]+]]:gprb(p0) = COPY $a1
337 ; MIPS32: [[COPY2:%[0-9]+]]:gprb(p0) = COPY $a2
338 ; MIPS32: [[COPY3:%[0-9]+]]:gprb(p0) = COPY $a3
339 ; MIPS32: [[LOAD:%[0-9]+]]:gprb(s32) = G_LOAD [[COPY1]](p0) :: (load (s32) from %ir.f32_ptr_a)
340 ; MIPS32: [[LOAD1:%[0-9]+]]:gprb(s32) = G_LOAD [[COPY2]](p0) :: (load (s32) from %ir.f32_ptr_b)
341 ; MIPS32: [[C:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 1
342 ; MIPS32: [[COPY4:%[0-9]+]]:gprb(s32) = COPY [[COPY]](s32)
343 ; MIPS32: [[AND:%[0-9]+]]:gprb(s32) = G_AND [[COPY4]], [[C]]
344 ; MIPS32: G_BRCOND [[AND]](s32), %bb.1
346 ; MIPS32: bb.1.cond.true:
347 ; MIPS32: successors: %bb.3(0x80000000)
349 ; MIPS32: bb.2.cond.false:
350 ; MIPS32: successors: %bb.3(0x80000000)
351 ; MIPS32: bb.3.cond.end:
352 ; MIPS32: [[PHI:%[0-9]+]]:gprb(s32) = G_PHI [[LOAD]](s32), %bb.1, [[LOAD1]](s32), %bb.2
353 ; MIPS32: G_STORE [[PHI]](s32), [[COPY3]](p0) :: (store (s32) into %ir.f32_ptr_c)
356 liveins: $a0, $a1, $a2, $a3
362 %5:_(s32) = G_LOAD %1(p0) :: (load (s32) from %ir.f32_ptr_a)
363 %6:_(s32) = G_LOAD %2(p0) :: (load (s32) from %ir.f32_ptr_b)
364 %9:_(s32) = G_CONSTANT i32 1
365 %10:_(s32) = COPY %4(s32)
366 %8:_(s32) = G_AND %10, %9
367 G_BRCOND %8(s32), %bb.2
376 %7:_(s32) = G_PHI %5(s32), %bb.2, %6(s32), %bb.3
377 G_STORE %7(s32), %3(p0) :: (store (s32) into %ir.f32_ptr_c)
385 tracksRegLiveness: true
387 - { id: 0, offset: 16, size: 4, alignment: 8, isImmutable: true }
389 ; MIPS32-LABEL: name: phi_double
390 ; MIPS32: bb.0.entry:
391 ; MIPS32: successors: %bb.1(0x40000000), %bb.2(0x40000000)
392 ; MIPS32: liveins: $d6, $d7
393 ; MIPS32: [[COPY:%[0-9]+]]:fprb(s64) = COPY $d6
394 ; MIPS32: [[COPY1:%[0-9]+]]:fprb(s64) = COPY $d7
395 ; MIPS32: [[FRAME_INDEX:%[0-9]+]]:gprb(p0) = G_FRAME_INDEX %fixed-stack.0
396 ; MIPS32: [[LOAD:%[0-9]+]]:gprb(s32) = G_LOAD [[FRAME_INDEX]](p0) :: (load (s32) from %fixed-stack.0, align 8)
397 ; MIPS32: [[C:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 1
398 ; MIPS32: [[COPY2:%[0-9]+]]:gprb(s32) = COPY [[LOAD]](s32)
399 ; MIPS32: [[AND:%[0-9]+]]:gprb(s32) = G_AND [[COPY2]], [[C]]
400 ; MIPS32: G_BRCOND [[AND]](s32), %bb.1
402 ; MIPS32: bb.1.cond.true:
403 ; MIPS32: successors: %bb.3(0x80000000)
405 ; MIPS32: bb.2.cond.false:
406 ; MIPS32: successors: %bb.3(0x80000000)
407 ; MIPS32: bb.3.cond.end:
408 ; MIPS32: [[PHI:%[0-9]+]]:fprb(s64) = G_PHI [[COPY]](s64), %bb.1, [[COPY1]](s64), %bb.2
409 ; MIPS32: $d0 = COPY [[PHI]](s64)
410 ; MIPS32: RetRA implicit $d0
416 %4:_(p0) = G_FRAME_INDEX %fixed-stack.0
417 %3:_(s32) = G_LOAD %4(p0) :: (load (s32) from %fixed-stack.0, align 8)
418 %7:_(s32) = G_CONSTANT i32 1
419 %8:_(s32) = COPY %3(s32)
420 %6:_(s32) = G_AND %8, %7
421 G_BRCOND %6(s32), %bb.2
430 %5:_(s64) = G_PHI %0(s64), %bb.2, %1(s64), %bb.3