1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -O0 -mtriple=mipsel-linux-gnu -run-pass=legalizer -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=MIPS32
5 define i1 @phi_i1(i1 %cnd, i1 %a, i1 %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 i1 [ %a, %cond.true ], [ %b, %cond.false ]
20 define i8 @phi_i8(i1 %cnd, i8 %a, i8 %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 i8 [ %a, %cond.true ], [ %b, %cond.false ]
35 define i16 @phi_i16(i1 %cnd, i16 %a, i16 %b) {
37 br i1 %cnd, label %cond.true, label %cond.false
39 cond.true: ; preds = %entry
42 cond.false: ; preds = %entry
45 cond.end: ; preds = %cond.false, %cond.true
46 %cond = phi i16 [ %a, %cond.true ], [ %b, %cond.false ]
50 define i32 @phi_i32(i1 %cnd, i32 %a, i32 %b) {
52 br i1 %cnd, label %cond.true, label %cond.false
54 cond.true: ; preds = %entry
57 cond.false: ; preds = %entry
60 cond.end: ; preds = %cond.false, %cond.true
61 %cond = phi i32 [ %a, %cond.true ], [ %b, %cond.false ]
65 define i64 @phi_i64(i1 %cnd, i64 %a, i64 %b) {
67 br i1 %cnd, label %cond.true, label %cond.false
69 cond.true: ; preds = %entry
72 cond.false: ; preds = %entry
75 cond.end: ; preds = %cond.false, %cond.true
76 %cond = phi i64 [ %a, %cond.true ], [ %b, %cond.false ]
80 define float @phi_float(i1 %cnd, float %a, float %b) {
82 br i1 %cnd, label %cond.true, label %cond.false
84 cond.true: ; preds = %entry
87 cond.false: ; preds = %entry
90 cond.end: ; preds = %cond.false, %cond.true
91 %cond = phi float [ %a, %cond.true ], [ %b, %cond.false ]
95 define double @phi_double(double %a, double %b, i1 %cnd) {
97 br i1 %cnd, label %cond.true, label %cond.false
99 cond.true: ; preds = %entry
102 cond.false: ; preds = %entry
105 cond.end: ; preds = %cond.false, %cond.true
106 %cond = phi double [ %a, %cond.true ], [ %b, %cond.false ]
114 tracksRegLiveness: true
116 ; MIPS32-LABEL: name: phi_i1
117 ; MIPS32: bb.0.entry:
118 ; MIPS32: successors: %bb.1(0x40000000), %bb.2(0x40000000)
119 ; MIPS32: liveins: $a0, $a1, $a2
120 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
121 ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
122 ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY $a2
123 ; MIPS32: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
124 ; MIPS32: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
125 ; MIPS32: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY3]], [[C]]
126 ; MIPS32: G_BRCOND [[AND]](s32), %bb.1
128 ; MIPS32: bb.1.cond.true:
129 ; MIPS32: successors: %bb.3(0x80000000)
130 ; MIPS32: [[COPY4:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
132 ; MIPS32: bb.2.cond.false:
133 ; MIPS32: successors: %bb.3(0x80000000)
134 ; MIPS32: [[COPY5:%[0-9]+]]:_(s32) = COPY [[COPY2]](s32)
135 ; MIPS32: bb.3.cond.end:
136 ; MIPS32: [[PHI:%[0-9]+]]:_(s32) = G_PHI [[COPY4]](s32), %bb.1, [[COPY5]](s32), %bb.2
137 ; MIPS32: [[COPY6:%[0-9]+]]:_(s32) = COPY [[PHI]](s32)
138 ; MIPS32: $v0 = COPY [[COPY6]](s32)
139 ; MIPS32: RetRA implicit $v0
141 liveins: $a0, $a1, $a2
144 %0:_(s1) = G_TRUNC %3(s32)
146 %1:_(s1) = G_TRUNC %4(s32)
148 %2:_(s1) = G_TRUNC %5(s32)
149 G_BRCOND %0(s1), %bb.2
158 %6:_(s1) = G_PHI %1(s1), %bb.2, %2(s1), %bb.3
159 %7:_(s32) = G_ANYEXT %6(s1)
167 tracksRegLiveness: true
169 ; MIPS32-LABEL: name: phi_i8
170 ; MIPS32: bb.0.entry:
171 ; MIPS32: successors: %bb.1(0x40000000), %bb.2(0x40000000)
172 ; MIPS32: liveins: $a0, $a1, $a2
173 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
174 ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
175 ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY $a2
176 ; MIPS32: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
177 ; MIPS32: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
178 ; MIPS32: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY3]], [[C]]
179 ; MIPS32: G_BRCOND [[AND]](s32), %bb.1
181 ; MIPS32: bb.1.cond.true:
182 ; MIPS32: successors: %bb.3(0x80000000)
183 ; MIPS32: [[COPY4:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
185 ; MIPS32: bb.2.cond.false:
186 ; MIPS32: successors: %bb.3(0x80000000)
187 ; MIPS32: [[COPY5:%[0-9]+]]:_(s32) = COPY [[COPY2]](s32)
188 ; MIPS32: bb.3.cond.end:
189 ; MIPS32: [[PHI:%[0-9]+]]:_(s32) = G_PHI [[COPY4]](s32), %bb.1, [[COPY5]](s32), %bb.2
190 ; MIPS32: [[COPY6:%[0-9]+]]:_(s32) = COPY [[PHI]](s32)
191 ; MIPS32: $v0 = COPY [[COPY6]](s32)
192 ; MIPS32: RetRA implicit $v0
194 liveins: $a0, $a1, $a2
197 %0:_(s1) = G_TRUNC %3(s32)
199 %1:_(s8) = G_TRUNC %4(s32)
201 %2:_(s8) = G_TRUNC %5(s32)
202 G_BRCOND %0(s1), %bb.2
211 %6:_(s8) = G_PHI %1(s8), %bb.2, %2(s8), %bb.3
212 %7:_(s32) = G_ANYEXT %6(s8)
220 tracksRegLiveness: true
222 ; MIPS32-LABEL: name: phi_i16
223 ; MIPS32: bb.0.entry:
224 ; MIPS32: successors: %bb.1(0x40000000), %bb.2(0x40000000)
225 ; MIPS32: liveins: $a0, $a1, $a2
226 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
227 ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
228 ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY $a2
229 ; MIPS32: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
230 ; MIPS32: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
231 ; MIPS32: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY3]], [[C]]
232 ; MIPS32: G_BRCOND [[AND]](s32), %bb.1
234 ; MIPS32: bb.1.cond.true:
235 ; MIPS32: successors: %bb.3(0x80000000)
236 ; MIPS32: [[COPY4:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
238 ; MIPS32: bb.2.cond.false:
239 ; MIPS32: successors: %bb.3(0x80000000)
240 ; MIPS32: [[COPY5:%[0-9]+]]:_(s32) = COPY [[COPY2]](s32)
241 ; MIPS32: bb.3.cond.end:
242 ; MIPS32: [[PHI:%[0-9]+]]:_(s32) = G_PHI [[COPY4]](s32), %bb.1, [[COPY5]](s32), %bb.2
243 ; MIPS32: [[COPY6:%[0-9]+]]:_(s32) = COPY [[PHI]](s32)
244 ; MIPS32: $v0 = COPY [[COPY6]](s32)
245 ; MIPS32: RetRA implicit $v0
247 liveins: $a0, $a1, $a2
250 %0:_(s1) = G_TRUNC %3(s32)
252 %1:_(s16) = G_TRUNC %4(s32)
254 %2:_(s16) = G_TRUNC %5(s32)
255 G_BRCOND %0(s1), %bb.2
264 %6:_(s16) = G_PHI %1(s16), %bb.2, %2(s16), %bb.3
265 %7:_(s32) = G_ANYEXT %6(s16)
273 tracksRegLiveness: true
275 ; MIPS32-LABEL: name: phi_i32
276 ; MIPS32: bb.0.entry:
277 ; MIPS32: successors: %bb.1(0x40000000), %bb.2(0x40000000)
278 ; MIPS32: liveins: $a0, $a1, $a2
279 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
280 ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
281 ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY $a2
282 ; MIPS32: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
283 ; MIPS32: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
284 ; MIPS32: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY3]], [[C]]
285 ; MIPS32: G_BRCOND [[AND]](s32), %bb.1
287 ; MIPS32: bb.1.cond.true:
288 ; MIPS32: successors: %bb.3(0x80000000)
290 ; MIPS32: bb.2.cond.false:
291 ; MIPS32: successors: %bb.3(0x80000000)
292 ; MIPS32: bb.3.cond.end:
293 ; MIPS32: [[PHI:%[0-9]+]]:_(s32) = G_PHI [[COPY1]](s32), %bb.1, [[COPY2]](s32), %bb.2
294 ; MIPS32: $v0 = COPY [[PHI]](s32)
295 ; MIPS32: RetRA implicit $v0
297 liveins: $a0, $a1, $a2
300 %0:_(s1) = G_TRUNC %3(s32)
303 G_BRCOND %0(s1), %bb.2
312 %4:_(s32) = G_PHI %1(s32), %bb.2, %2(s32), %bb.3
320 tracksRegLiveness: true
322 - { id: 0, offset: 20, size: 4, alignment: 4, isImmutable: true }
323 - { id: 1, offset: 16, size: 4, alignment: 8, isImmutable: true }
325 ; MIPS32-LABEL: name: phi_i64
326 ; MIPS32: bb.0.entry:
327 ; MIPS32: successors: %bb.1(0x40000000), %bb.2(0x40000000)
328 ; MIPS32: liveins: $a0, $a2, $a3
329 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
330 ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a2
331 ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY $a3
332 ; MIPS32: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[COPY1]](s32), [[COPY2]](s32)
333 ; MIPS32: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0
334 ; MIPS32: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX]](p0) :: (load 4 from %fixed-stack.0, align 8)
335 ; MIPS32: [[FRAME_INDEX1:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.1
336 ; MIPS32: [[LOAD1:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX1]](p0) :: (load 4 from %fixed-stack.1)
337 ; MIPS32: [[MV1:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[LOAD]](s32), [[LOAD1]](s32)
338 ; MIPS32: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
339 ; MIPS32: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
340 ; MIPS32: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY3]], [[C]]
341 ; MIPS32: G_BRCOND [[AND]](s32), %bb.1
343 ; MIPS32: bb.1.cond.true:
344 ; MIPS32: successors: %bb.3(0x80000000)
346 ; MIPS32: bb.2.cond.false:
347 ; MIPS32: successors: %bb.3(0x80000000)
348 ; MIPS32: bb.3.cond.end:
349 ; MIPS32: [[PHI:%[0-9]+]]:_(s64) = G_PHI [[MV]](s64), %bb.1, [[MV1]](s64), %bb.2
350 ; MIPS32: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[PHI]](s64)
351 ; MIPS32: $v0 = COPY [[UV]](s32)
352 ; MIPS32: $v1 = COPY [[UV1]](s32)
353 ; MIPS32: RetRA implicit $v0, implicit $v1
355 liveins: $a0, $a2, $a3
358 %0:_(s1) = G_TRUNC %3(s32)
361 %1:_(s64) = G_MERGE_VALUES %4(s32), %5(s32)
362 %8:_(p0) = G_FRAME_INDEX %fixed-stack.1
363 %6:_(s32) = G_LOAD %8(p0) :: (load 4 from %fixed-stack.1, align 8)
364 %9:_(p0) = G_FRAME_INDEX %fixed-stack.0
365 %7:_(s32) = G_LOAD %9(p0) :: (load 4 from %fixed-stack.0)
366 %2:_(s64) = G_MERGE_VALUES %6(s32), %7(s32)
367 G_BRCOND %0(s1), %bb.2
376 %10:_(s64) = G_PHI %1(s64), %bb.2, %2(s64), %bb.3
377 %11:_(s32), %12:_(s32) = G_UNMERGE_VALUES %10(s64)
380 RetRA implicit $v0, implicit $v1
386 tracksRegLiveness: true
388 ; MIPS32-LABEL: name: phi_float
389 ; MIPS32: bb.0.entry:
390 ; MIPS32: successors: %bb.1(0x40000000), %bb.2(0x40000000)
391 ; MIPS32: liveins: $a0, $a1, $a2
392 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
393 ; MIPS32: [[MTC1_:%[0-9]+]]:fgr32(s32) = MTC1 $a1
394 ; MIPS32: [[MTC1_1:%[0-9]+]]:fgr32(s32) = MTC1 $a2
395 ; MIPS32: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
396 ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
397 ; MIPS32: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
398 ; MIPS32: G_BRCOND [[AND]](s32), %bb.1
400 ; MIPS32: bb.1.cond.true:
401 ; MIPS32: successors: %bb.3(0x80000000)
403 ; MIPS32: bb.2.cond.false:
404 ; MIPS32: successors: %bb.3(0x80000000)
405 ; MIPS32: bb.3.cond.end:
406 ; MIPS32: [[PHI:%[0-9]+]]:_(s32) = G_PHI [[MTC1_]](s32), %bb.1, [[MTC1_1]](s32), %bb.2
407 ; MIPS32: $f0 = COPY [[PHI]](s32)
408 ; MIPS32: RetRA implicit $f0
410 liveins: $a0, $a1, $a2
413 %0:_(s1) = G_TRUNC %3(s32)
414 %1:fgr32(s32) = MTC1 $a1
415 %2:fgr32(s32) = MTC1 $a2
416 G_BRCOND %0(s1), %bb.2
425 %4:_(s32) = G_PHI %1(s32), %bb.2, %2(s32), %bb.3
433 tracksRegLiveness: true
435 - { id: 0, offset: 16, size: 4, alignment: 8, isImmutable: true }
437 ; MIPS32-LABEL: name: phi_double
438 ; MIPS32: bb.0.entry:
439 ; MIPS32: successors: %bb.1(0x40000000), %bb.2(0x40000000)
440 ; MIPS32: liveins: $d6, $d7
441 ; MIPS32: [[COPY:%[0-9]+]]:_(s64) = COPY $d6
442 ; MIPS32: [[COPY1:%[0-9]+]]:_(s64) = COPY $d7
443 ; MIPS32: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0
444 ; MIPS32: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX]](p0) :: (load 4 from %fixed-stack.0, align 8)
445 ; MIPS32: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
446 ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY [[LOAD]](s32)
447 ; MIPS32: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[C]]
448 ; MIPS32: G_BRCOND [[AND]](s32), %bb.1
450 ; MIPS32: bb.1.cond.true:
451 ; MIPS32: successors: %bb.3(0x80000000)
453 ; MIPS32: bb.2.cond.false:
454 ; MIPS32: successors: %bb.3(0x80000000)
455 ; MIPS32: bb.3.cond.end:
456 ; MIPS32: [[PHI:%[0-9]+]]:_(s64) = G_PHI [[COPY]](s64), %bb.1, [[COPY1]](s64), %bb.2
457 ; MIPS32: $d0 = COPY [[PHI]](s64)
458 ; MIPS32: RetRA implicit $d0
464 %4:_(p0) = G_FRAME_INDEX %fixed-stack.0
465 %3:_(s32) = G_LOAD %4(p0) :: (load 4 from %fixed-stack.0, align 8)
466 %2:_(s1) = G_TRUNC %3(s32)
467 G_BRCOND %2(s1), %bb.2
476 %5:_(s64) = G_PHI %0(s64), %bb.2, %1(s64), %bb.3