1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -O0 -mtriple=mipsel-linux-gnu -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=MIPS32FP32
3 # RUN: llc -O0 -mtriple=mipsel-linux-gnu -mattr=+fp64,+mips32r2 -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=MIPS32FP64
6 define i32 @phi_i32(i1 %cnd, i32 %a, i32 %b) {
8 br i1 %cnd, label %cond.true, label %cond.false
10 cond.true: ; preds = %entry
13 cond.false: ; preds = %entry
16 cond.end: ; preds = %cond.false, %cond.true
17 %cond = phi i32 [ %a, %cond.true ], [ %b, %cond.false ]
21 define i64 @phi_i64(i1 %cnd, i64 %a, i64 %b) {
23 br i1 %cnd, label %cond.true, label %cond.false
25 cond.true: ; preds = %entry
28 cond.false: ; preds = %entry
31 cond.end: ; preds = %cond.false, %cond.true
32 %cond = phi i64 [ %a, %cond.true ], [ %b, %cond.false ]
36 define float @phi_float(i1 %cnd, float %a, float %b) {
38 br i1 %cnd, label %cond.true, label %cond.false
40 cond.true: ; preds = %entry
43 cond.false: ; preds = %entry
46 cond.end: ; preds = %cond.false, %cond.true
47 %cond = phi float [ %a, %cond.true ], [ %b, %cond.false ]
51 define double @phi_double(double %a, double %b, i1 %cnd) {
53 br i1 %cnd, label %cond.true, label %cond.false
55 cond.true: ; preds = %entry
58 cond.false: ; preds = %entry
61 cond.end: ; preds = %cond.false, %cond.true
62 %cond = phi double [ %a, %cond.true ], [ %b, %cond.false ]
72 tracksRegLiveness: true
74 ; MIPS32FP32-LABEL: name: phi_i32
75 ; MIPS32FP32: bb.0.entry:
76 ; MIPS32FP32-NEXT: successors: %bb.1(0x40000000), %bb.2(0x40000000)
77 ; MIPS32FP32-NEXT: liveins: $a0, $a1, $a2
78 ; MIPS32FP32-NEXT: {{ $}}
79 ; MIPS32FP32-NEXT: [[COPY:%[0-9]+]]:gpr32 = COPY $a0
80 ; MIPS32FP32-NEXT: [[COPY1:%[0-9]+]]:gpr32 = COPY $a1
81 ; MIPS32FP32-NEXT: [[COPY2:%[0-9]+]]:gpr32 = COPY $a2
82 ; MIPS32FP32-NEXT: [[ANDi:%[0-9]+]]:gpr32 = ANDi [[COPY]], 1
83 ; MIPS32FP32-NEXT: BNE [[ANDi]], $zero, %bb.1, implicit-def $at
84 ; MIPS32FP32-NEXT: J %bb.2, implicit-def dead $at
85 ; MIPS32FP32-NEXT: {{ $}}
86 ; MIPS32FP32-NEXT: bb.1.cond.true:
87 ; MIPS32FP32-NEXT: successors: %bb.3(0x80000000)
88 ; MIPS32FP32-NEXT: {{ $}}
89 ; MIPS32FP32-NEXT: J %bb.3, implicit-def dead $at
90 ; MIPS32FP32-NEXT: {{ $}}
91 ; MIPS32FP32-NEXT: bb.2.cond.false:
92 ; MIPS32FP32-NEXT: successors: %bb.3(0x80000000)
93 ; MIPS32FP32-NEXT: {{ $}}
94 ; MIPS32FP32-NEXT: {{ $}}
95 ; MIPS32FP32-NEXT: bb.3.cond.end:
96 ; MIPS32FP32-NEXT: [[PHI:%[0-9]+]]:gpr32 = PHI [[COPY1]], %bb.1, [[COPY2]], %bb.2
97 ; MIPS32FP32-NEXT: $v0 = COPY [[PHI]]
98 ; MIPS32FP32-NEXT: RetRA implicit $v0
100 ; MIPS32FP64-LABEL: name: phi_i32
101 ; MIPS32FP64: bb.0.entry:
102 ; MIPS32FP64-NEXT: successors: %bb.1(0x40000000), %bb.2(0x40000000)
103 ; MIPS32FP64-NEXT: liveins: $a0, $a1, $a2
104 ; MIPS32FP64-NEXT: {{ $}}
105 ; MIPS32FP64-NEXT: [[COPY:%[0-9]+]]:gpr32 = COPY $a0
106 ; MIPS32FP64-NEXT: [[COPY1:%[0-9]+]]:gpr32 = COPY $a1
107 ; MIPS32FP64-NEXT: [[COPY2:%[0-9]+]]:gpr32 = COPY $a2
108 ; MIPS32FP64-NEXT: [[ANDi:%[0-9]+]]:gpr32 = ANDi [[COPY]], 1
109 ; MIPS32FP64-NEXT: BNE [[ANDi]], $zero, %bb.1, implicit-def $at
110 ; MIPS32FP64-NEXT: J %bb.2, implicit-def dead $at
111 ; MIPS32FP64-NEXT: {{ $}}
112 ; MIPS32FP64-NEXT: bb.1.cond.true:
113 ; MIPS32FP64-NEXT: successors: %bb.3(0x80000000)
114 ; MIPS32FP64-NEXT: {{ $}}
115 ; MIPS32FP64-NEXT: J %bb.3, implicit-def dead $at
116 ; MIPS32FP64-NEXT: {{ $}}
117 ; MIPS32FP64-NEXT: bb.2.cond.false:
118 ; MIPS32FP64-NEXT: successors: %bb.3(0x80000000)
119 ; MIPS32FP64-NEXT: {{ $}}
120 ; MIPS32FP64-NEXT: {{ $}}
121 ; MIPS32FP64-NEXT: bb.3.cond.end:
122 ; MIPS32FP64-NEXT: [[PHI:%[0-9]+]]:gpr32 = PHI [[COPY1]], %bb.1, [[COPY2]], %bb.2
123 ; MIPS32FP64-NEXT: $v0 = COPY [[PHI]]
124 ; MIPS32FP64-NEXT: RetRA implicit $v0
126 liveins: $a0, $a1, $a2
128 %3:gprb(s32) = COPY $a0
129 %1:gprb(s32) = COPY $a1
130 %2:gprb(s32) = COPY $a2
131 %6:gprb(s32) = G_CONSTANT i32 1
132 %7:gprb(s32) = COPY %3(s32)
133 %5:gprb(s32) = G_AND %7, %6
134 G_BRCOND %5(s32), %bb.2
143 %4:gprb(s32) = G_PHI %1(s32), %bb.2, %2(s32), %bb.3
152 regBankSelected: true
153 tracksRegLiveness: true
155 - { id: 0, offset: 20, size: 4, alignment: 4, isImmutable: true }
156 - { id: 1, offset: 16, size: 4, alignment: 8, isImmutable: true }
158 ; MIPS32FP32-LABEL: name: phi_i64
159 ; MIPS32FP32: bb.0.entry:
160 ; MIPS32FP32-NEXT: successors: %bb.1(0x40000000), %bb.2(0x40000000)
161 ; MIPS32FP32-NEXT: liveins: $a0, $a2, $a3
162 ; MIPS32FP32-NEXT: {{ $}}
163 ; MIPS32FP32-NEXT: [[COPY:%[0-9]+]]:gpr32 = COPY $a0
164 ; MIPS32FP32-NEXT: [[COPY1:%[0-9]+]]:gpr32 = COPY $a2
165 ; MIPS32FP32-NEXT: [[COPY2:%[0-9]+]]:gpr32 = COPY $a3
166 ; MIPS32FP32-NEXT: [[ADDiu:%[0-9]+]]:gpr32 = ADDiu %fixed-stack.0, 0
167 ; MIPS32FP32-NEXT: [[LW:%[0-9]+]]:gpr32 = LW [[ADDiu]], 0 :: (load (s32) from %fixed-stack.0, align 8)
168 ; MIPS32FP32-NEXT: [[ADDiu1:%[0-9]+]]:gpr32 = ADDiu %fixed-stack.1, 0
169 ; MIPS32FP32-NEXT: [[LW1:%[0-9]+]]:gpr32 = LW [[ADDiu1]], 0 :: (load (s32) from %fixed-stack.1)
170 ; MIPS32FP32-NEXT: [[ANDi:%[0-9]+]]:gpr32 = ANDi [[COPY]], 1
171 ; MIPS32FP32-NEXT: BNE [[ANDi]], $zero, %bb.1, implicit-def $at
172 ; MIPS32FP32-NEXT: J %bb.2, implicit-def dead $at
173 ; MIPS32FP32-NEXT: {{ $}}
174 ; MIPS32FP32-NEXT: bb.1.cond.true:
175 ; MIPS32FP32-NEXT: successors: %bb.3(0x80000000)
176 ; MIPS32FP32-NEXT: {{ $}}
177 ; MIPS32FP32-NEXT: J %bb.3, implicit-def dead $at
178 ; MIPS32FP32-NEXT: {{ $}}
179 ; MIPS32FP32-NEXT: bb.2.cond.false:
180 ; MIPS32FP32-NEXT: successors: %bb.3(0x80000000)
181 ; MIPS32FP32-NEXT: {{ $}}
182 ; MIPS32FP32-NEXT: {{ $}}
183 ; MIPS32FP32-NEXT: bb.3.cond.end:
184 ; MIPS32FP32-NEXT: [[PHI:%[0-9]+]]:gpr32 = PHI [[COPY1]], %bb.1, [[LW]], %bb.2
185 ; MIPS32FP32-NEXT: [[PHI1:%[0-9]+]]:gpr32 = PHI [[COPY2]], %bb.1, [[LW1]], %bb.2
186 ; MIPS32FP32-NEXT: $v0 = COPY [[PHI]]
187 ; MIPS32FP32-NEXT: $v1 = COPY [[PHI1]]
188 ; MIPS32FP32-NEXT: RetRA implicit $v0, implicit $v1
190 ; MIPS32FP64-LABEL: name: phi_i64
191 ; MIPS32FP64: bb.0.entry:
192 ; MIPS32FP64-NEXT: successors: %bb.1(0x40000000), %bb.2(0x40000000)
193 ; MIPS32FP64-NEXT: liveins: $a0, $a2, $a3
194 ; MIPS32FP64-NEXT: {{ $}}
195 ; MIPS32FP64-NEXT: [[COPY:%[0-9]+]]:gpr32 = COPY $a0
196 ; MIPS32FP64-NEXT: [[COPY1:%[0-9]+]]:gpr32 = COPY $a2
197 ; MIPS32FP64-NEXT: [[COPY2:%[0-9]+]]:gpr32 = COPY $a3
198 ; MIPS32FP64-NEXT: [[ADDiu:%[0-9]+]]:gpr32 = ADDiu %fixed-stack.0, 0
199 ; MIPS32FP64-NEXT: [[LW:%[0-9]+]]:gpr32 = LW [[ADDiu]], 0 :: (load (s32) from %fixed-stack.0, align 8)
200 ; MIPS32FP64-NEXT: [[ADDiu1:%[0-9]+]]:gpr32 = ADDiu %fixed-stack.1, 0
201 ; MIPS32FP64-NEXT: [[LW1:%[0-9]+]]:gpr32 = LW [[ADDiu1]], 0 :: (load (s32) from %fixed-stack.1)
202 ; MIPS32FP64-NEXT: [[ANDi:%[0-9]+]]:gpr32 = ANDi [[COPY]], 1
203 ; MIPS32FP64-NEXT: BNE [[ANDi]], $zero, %bb.1, implicit-def $at
204 ; MIPS32FP64-NEXT: J %bb.2, implicit-def dead $at
205 ; MIPS32FP64-NEXT: {{ $}}
206 ; MIPS32FP64-NEXT: bb.1.cond.true:
207 ; MIPS32FP64-NEXT: successors: %bb.3(0x80000000)
208 ; MIPS32FP64-NEXT: {{ $}}
209 ; MIPS32FP64-NEXT: J %bb.3, implicit-def dead $at
210 ; MIPS32FP64-NEXT: {{ $}}
211 ; MIPS32FP64-NEXT: bb.2.cond.false:
212 ; MIPS32FP64-NEXT: successors: %bb.3(0x80000000)
213 ; MIPS32FP64-NEXT: {{ $}}
214 ; MIPS32FP64-NEXT: {{ $}}
215 ; MIPS32FP64-NEXT: bb.3.cond.end:
216 ; MIPS32FP64-NEXT: [[PHI:%[0-9]+]]:gpr32 = PHI [[COPY1]], %bb.1, [[LW]], %bb.2
217 ; MIPS32FP64-NEXT: [[PHI1:%[0-9]+]]:gpr32 = PHI [[COPY2]], %bb.1, [[LW1]], %bb.2
218 ; MIPS32FP64-NEXT: $v0 = COPY [[PHI]]
219 ; MIPS32FP64-NEXT: $v1 = COPY [[PHI1]]
220 ; MIPS32FP64-NEXT: RetRA implicit $v0, implicit $v1
222 liveins: $a0, $a2, $a3
224 %3:gprb(s32) = COPY $a0
225 %4:gprb(s32) = COPY $a2
226 %5:gprb(s32) = COPY $a3
227 %8:gprb(p0) = G_FRAME_INDEX %fixed-stack.1
228 %6:gprb(s32) = G_LOAD %8(p0) :: (load (s32) from %fixed-stack.1, align 8)
229 %9:gprb(p0) = G_FRAME_INDEX %fixed-stack.0
230 %7:gprb(s32) = G_LOAD %9(p0) :: (load (s32) from %fixed-stack.0)
231 %14:gprb(s32) = G_CONSTANT i32 1
232 %15:gprb(s32) = COPY %3(s32)
233 %13:gprb(s32) = G_AND %15, %14
234 G_BRCOND %13(s32), %bb.2
243 %20:gprb(s32) = G_PHI %4(s32), %bb.2, %6(s32), %bb.3
244 %21:gprb(s32) = G_PHI %5(s32), %bb.2, %7(s32), %bb.3
247 RetRA implicit $v0, implicit $v1
254 regBankSelected: true
255 tracksRegLiveness: true
257 ; MIPS32FP32-LABEL: name: phi_float
258 ; MIPS32FP32: bb.0.entry:
259 ; MIPS32FP32-NEXT: successors: %bb.1(0x40000000), %bb.2(0x40000000)
260 ; MIPS32FP32-NEXT: liveins: $a0, $a1, $a2
261 ; MIPS32FP32-NEXT: {{ $}}
262 ; MIPS32FP32-NEXT: [[COPY:%[0-9]+]]:gpr32 = COPY $a0
263 ; MIPS32FP32-NEXT: [[COPY1:%[0-9]+]]:gpr32 = COPY $a1
264 ; MIPS32FP32-NEXT: [[COPY2:%[0-9]+]]:gpr32 = COPY $a2
265 ; MIPS32FP32-NEXT: [[ANDi:%[0-9]+]]:gpr32 = ANDi [[COPY]], 1
266 ; MIPS32FP32-NEXT: BNE [[ANDi]], $zero, %bb.1, implicit-def $at
267 ; MIPS32FP32-NEXT: J %bb.2, implicit-def dead $at
268 ; MIPS32FP32-NEXT: {{ $}}
269 ; MIPS32FP32-NEXT: bb.1.cond.true:
270 ; MIPS32FP32-NEXT: successors: %bb.3(0x80000000)
271 ; MIPS32FP32-NEXT: {{ $}}
272 ; MIPS32FP32-NEXT: J %bb.3, implicit-def dead $at
273 ; MIPS32FP32-NEXT: {{ $}}
274 ; MIPS32FP32-NEXT: bb.2.cond.false:
275 ; MIPS32FP32-NEXT: successors: %bb.3(0x80000000)
276 ; MIPS32FP32-NEXT: {{ $}}
277 ; MIPS32FP32-NEXT: {{ $}}
278 ; MIPS32FP32-NEXT: bb.3.cond.end:
279 ; MIPS32FP32-NEXT: [[PHI:%[0-9]+]]:gpr32 = PHI [[COPY1]], %bb.1, [[COPY2]], %bb.2
280 ; MIPS32FP32-NEXT: $f0 = COPY [[PHI]]
281 ; MIPS32FP32-NEXT: RetRA implicit $f0
283 ; MIPS32FP64-LABEL: name: phi_float
284 ; MIPS32FP64: bb.0.entry:
285 ; MIPS32FP64-NEXT: successors: %bb.1(0x40000000), %bb.2(0x40000000)
286 ; MIPS32FP64-NEXT: liveins: $a0, $a1, $a2
287 ; MIPS32FP64-NEXT: {{ $}}
288 ; MIPS32FP64-NEXT: [[COPY:%[0-9]+]]:gpr32 = COPY $a0
289 ; MIPS32FP64-NEXT: [[COPY1:%[0-9]+]]:gpr32 = COPY $a1
290 ; MIPS32FP64-NEXT: [[COPY2:%[0-9]+]]:gpr32 = COPY $a2
291 ; MIPS32FP64-NEXT: [[ANDi:%[0-9]+]]:gpr32 = ANDi [[COPY]], 1
292 ; MIPS32FP64-NEXT: BNE [[ANDi]], $zero, %bb.1, implicit-def $at
293 ; MIPS32FP64-NEXT: J %bb.2, implicit-def dead $at
294 ; MIPS32FP64-NEXT: {{ $}}
295 ; MIPS32FP64-NEXT: bb.1.cond.true:
296 ; MIPS32FP64-NEXT: successors: %bb.3(0x80000000)
297 ; MIPS32FP64-NEXT: {{ $}}
298 ; MIPS32FP64-NEXT: J %bb.3, implicit-def dead $at
299 ; MIPS32FP64-NEXT: {{ $}}
300 ; MIPS32FP64-NEXT: bb.2.cond.false:
301 ; MIPS32FP64-NEXT: successors: %bb.3(0x80000000)
302 ; MIPS32FP64-NEXT: {{ $}}
303 ; MIPS32FP64-NEXT: {{ $}}
304 ; MIPS32FP64-NEXT: bb.3.cond.end:
305 ; MIPS32FP64-NEXT: [[PHI:%[0-9]+]]:gpr32 = PHI [[COPY1]], %bb.1, [[COPY2]], %bb.2
306 ; MIPS32FP64-NEXT: $f0 = COPY [[PHI]]
307 ; MIPS32FP64-NEXT: RetRA implicit $f0
309 liveins: $a0, $a1, $a2
311 %3:gprb(s32) = COPY $a0
312 %1:gprb(s32) = COPY $a1
313 %2:gprb(s32) = COPY $a2
314 %6:gprb(s32) = G_CONSTANT i32 1
315 %7:gprb(s32) = COPY %3(s32)
316 %5:gprb(s32) = G_AND %7, %6
317 G_BRCOND %5(s32), %bb.2
326 %4:gprb(s32) = G_PHI %1(s32), %bb.2, %2(s32), %bb.3
335 regBankSelected: true
336 tracksRegLiveness: true
338 - { id: 0, offset: 16, size: 4, alignment: 8, isImmutable: true }
340 ; MIPS32FP32-LABEL: name: phi_double
341 ; MIPS32FP32: bb.0.entry:
342 ; MIPS32FP32-NEXT: successors: %bb.1(0x40000000), %bb.2(0x40000000)
343 ; MIPS32FP32-NEXT: liveins: $d6, $d7
344 ; MIPS32FP32-NEXT: {{ $}}
345 ; MIPS32FP32-NEXT: [[COPY:%[0-9]+]]:afgr64 = COPY $d6
346 ; MIPS32FP32-NEXT: [[COPY1:%[0-9]+]]:afgr64 = COPY $d7
347 ; MIPS32FP32-NEXT: [[ADDiu:%[0-9]+]]:gpr32 = ADDiu %fixed-stack.0, 0
348 ; MIPS32FP32-NEXT: [[LW:%[0-9]+]]:gpr32 = LW [[ADDiu]], 0 :: (load (s32) from %fixed-stack.0, align 8)
349 ; MIPS32FP32-NEXT: [[ANDi:%[0-9]+]]:gpr32 = ANDi [[LW]], 1
350 ; MIPS32FP32-NEXT: BNE [[ANDi]], $zero, %bb.1, implicit-def $at
351 ; MIPS32FP32-NEXT: J %bb.2, implicit-def dead $at
352 ; MIPS32FP32-NEXT: {{ $}}
353 ; MIPS32FP32-NEXT: bb.1.cond.true:
354 ; MIPS32FP32-NEXT: successors: %bb.3(0x80000000)
355 ; MIPS32FP32-NEXT: {{ $}}
356 ; MIPS32FP32-NEXT: J %bb.3, implicit-def dead $at
357 ; MIPS32FP32-NEXT: {{ $}}
358 ; MIPS32FP32-NEXT: bb.2.cond.false:
359 ; MIPS32FP32-NEXT: successors: %bb.3(0x80000000)
360 ; MIPS32FP32-NEXT: {{ $}}
361 ; MIPS32FP32-NEXT: {{ $}}
362 ; MIPS32FP32-NEXT: bb.3.cond.end:
363 ; MIPS32FP32-NEXT: [[PHI:%[0-9]+]]:afgr64 = PHI [[COPY]], %bb.1, [[COPY1]], %bb.2
364 ; MIPS32FP32-NEXT: $d0 = COPY [[PHI]]
365 ; MIPS32FP32-NEXT: RetRA implicit $d0
367 ; MIPS32FP64-LABEL: name: phi_double
368 ; MIPS32FP64: bb.0.entry:
369 ; MIPS32FP64-NEXT: successors: %bb.1(0x40000000), %bb.2(0x40000000)
370 ; MIPS32FP64-NEXT: liveins: $d6, $d7
371 ; MIPS32FP64-NEXT: {{ $}}
372 ; MIPS32FP64-NEXT: [[COPY:%[0-9]+]]:fgr64 = COPY $d6
373 ; MIPS32FP64-NEXT: [[COPY1:%[0-9]+]]:fgr64 = COPY $d7
374 ; MIPS32FP64-NEXT: [[ADDiu:%[0-9]+]]:gpr32 = ADDiu %fixed-stack.0, 0
375 ; MIPS32FP64-NEXT: [[LW:%[0-9]+]]:gpr32 = LW [[ADDiu]], 0 :: (load (s32) from %fixed-stack.0, align 8)
376 ; MIPS32FP64-NEXT: [[ANDi:%[0-9]+]]:gpr32 = ANDi [[LW]], 1
377 ; MIPS32FP64-NEXT: BNE [[ANDi]], $zero, %bb.1, implicit-def $at
378 ; MIPS32FP64-NEXT: J %bb.2, implicit-def dead $at
379 ; MIPS32FP64-NEXT: {{ $}}
380 ; MIPS32FP64-NEXT: bb.1.cond.true:
381 ; MIPS32FP64-NEXT: successors: %bb.3(0x80000000)
382 ; MIPS32FP64-NEXT: {{ $}}
383 ; MIPS32FP64-NEXT: J %bb.3, implicit-def dead $at
384 ; MIPS32FP64-NEXT: {{ $}}
385 ; MIPS32FP64-NEXT: bb.2.cond.false:
386 ; MIPS32FP64-NEXT: successors: %bb.3(0x80000000)
387 ; MIPS32FP64-NEXT: {{ $}}
388 ; MIPS32FP64-NEXT: {{ $}}
389 ; MIPS32FP64-NEXT: bb.3.cond.end:
390 ; MIPS32FP64-NEXT: [[PHI:%[0-9]+]]:fgr64 = PHI [[COPY]], %bb.1, [[COPY1]], %bb.2
391 ; MIPS32FP64-NEXT: $d0 = COPY [[PHI]]
392 ; MIPS32FP64-NEXT: RetRA implicit $d0
396 %0:fprb(s64) = COPY $d6
397 %1:fprb(s64) = COPY $d7
398 %4:gprb(p0) = G_FRAME_INDEX %fixed-stack.0
399 %3:gprb(s32) = G_LOAD %4(p0) :: (load (s32) from %fixed-stack.0, align 8)
400 %7:gprb(s32) = G_CONSTANT i32 1
401 %8:gprb(s32) = COPY %3(s32)
402 %6:gprb(s32) = G_AND %8, %7
403 G_BRCOND %6(s32), %bb.2
412 %5:fprb(s64) = G_PHI %0(s64), %bb.2, %1(s64), %bb.3