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: successors: %bb.1(0x40000000), %bb.2(0x40000000)
77 ; MIPS32FP32: liveins: $a0, $a1, $a2
78 ; MIPS32FP32: [[COPY:%[0-9]+]]:gpr32 = COPY $a0
79 ; MIPS32FP32: [[COPY1:%[0-9]+]]:gpr32 = COPY $a1
80 ; MIPS32FP32: [[COPY2:%[0-9]+]]:gpr32 = COPY $a2
81 ; MIPS32FP32: [[ORi:%[0-9]+]]:gpr32 = ORi $zero, 1
82 ; MIPS32FP32: [[AND:%[0-9]+]]:gpr32 = AND [[COPY]], [[ORi]]
83 ; MIPS32FP32: BNE [[AND]], $zero, %bb.1, implicit-def $at
84 ; MIPS32FP32: J %bb.2, implicit-def $at
85 ; MIPS32FP32: bb.1.cond.true:
86 ; MIPS32FP32: successors: %bb.3(0x80000000)
87 ; MIPS32FP32: J %bb.3, implicit-def $at
88 ; MIPS32FP32: bb.2.cond.false:
89 ; MIPS32FP32: successors: %bb.3(0x80000000)
90 ; MIPS32FP32: bb.3.cond.end:
91 ; MIPS32FP32: [[PHI:%[0-9]+]]:gpr32 = PHI [[COPY1]], %bb.1, [[COPY2]], %bb.2
92 ; MIPS32FP32: $v0 = COPY [[PHI]]
93 ; MIPS32FP32: RetRA implicit $v0
94 ; MIPS32FP64-LABEL: name: phi_i32
95 ; MIPS32FP64: bb.0.entry:
96 ; MIPS32FP64: successors: %bb.1(0x40000000), %bb.2(0x40000000)
97 ; MIPS32FP64: liveins: $a0, $a1, $a2
98 ; MIPS32FP64: [[COPY:%[0-9]+]]:gpr32 = COPY $a0
99 ; MIPS32FP64: [[COPY1:%[0-9]+]]:gpr32 = COPY $a1
100 ; MIPS32FP64: [[COPY2:%[0-9]+]]:gpr32 = COPY $a2
101 ; MIPS32FP64: [[ORi:%[0-9]+]]:gpr32 = ORi $zero, 1
102 ; MIPS32FP64: [[AND:%[0-9]+]]:gpr32 = AND [[COPY]], [[ORi]]
103 ; MIPS32FP64: BNE [[AND]], $zero, %bb.1, implicit-def $at
104 ; MIPS32FP64: J %bb.2, implicit-def $at
105 ; MIPS32FP64: bb.1.cond.true:
106 ; MIPS32FP64: successors: %bb.3(0x80000000)
107 ; MIPS32FP64: J %bb.3, implicit-def $at
108 ; MIPS32FP64: bb.2.cond.false:
109 ; MIPS32FP64: successors: %bb.3(0x80000000)
110 ; MIPS32FP64: bb.3.cond.end:
111 ; MIPS32FP64: [[PHI:%[0-9]+]]:gpr32 = PHI [[COPY1]], %bb.1, [[COPY2]], %bb.2
112 ; MIPS32FP64: $v0 = COPY [[PHI]]
113 ; MIPS32FP64: RetRA implicit $v0
115 liveins: $a0, $a1, $a2
117 %3:gprb(s32) = COPY $a0
118 %1:gprb(s32) = COPY $a1
119 %2:gprb(s32) = COPY $a2
120 %6:gprb(s32) = G_CONSTANT i32 1
121 %7:gprb(s32) = COPY %3(s32)
122 %5:gprb(s32) = G_AND %7, %6
123 G_BRCOND %5(s32), %bb.2
132 %4:gprb(s32) = G_PHI %1(s32), %bb.2, %2(s32), %bb.3
141 regBankSelected: true
142 tracksRegLiveness: true
144 - { id: 0, offset: 20, size: 4, alignment: 4, isImmutable: true }
145 - { id: 1, offset: 16, size: 4, alignment: 8, isImmutable: true }
147 ; MIPS32FP32-LABEL: name: phi_i64
148 ; MIPS32FP32: bb.0.entry:
149 ; MIPS32FP32: successors: %bb.1(0x40000000), %bb.2(0x40000000)
150 ; MIPS32FP32: liveins: $a0, $a2, $a3
151 ; MIPS32FP32: [[COPY:%[0-9]+]]:gpr32 = COPY $a0
152 ; MIPS32FP32: [[COPY1:%[0-9]+]]:gpr32 = COPY $a2
153 ; MIPS32FP32: [[COPY2:%[0-9]+]]:gpr32 = COPY $a3
154 ; MIPS32FP32: [[ADDiu:%[0-9]+]]:gpr32 = ADDiu %fixed-stack.0, 0
155 ; MIPS32FP32: [[LW:%[0-9]+]]:gpr32 = LW [[ADDiu]], 0 :: (load 4 from %fixed-stack.0, align 8)
156 ; MIPS32FP32: [[ADDiu1:%[0-9]+]]:gpr32 = ADDiu %fixed-stack.1, 0
157 ; MIPS32FP32: [[LW1:%[0-9]+]]:gpr32 = LW [[ADDiu1]], 0 :: (load 4 from %fixed-stack.1)
158 ; MIPS32FP32: [[ORi:%[0-9]+]]:gpr32 = ORi $zero, 1
159 ; MIPS32FP32: [[AND:%[0-9]+]]:gpr32 = AND [[COPY]], [[ORi]]
160 ; MIPS32FP32: BNE [[AND]], $zero, %bb.1, implicit-def $at
161 ; MIPS32FP32: J %bb.2, implicit-def $at
162 ; MIPS32FP32: bb.1.cond.true:
163 ; MIPS32FP32: successors: %bb.3(0x80000000)
164 ; MIPS32FP32: J %bb.3, implicit-def $at
165 ; MIPS32FP32: bb.2.cond.false:
166 ; MIPS32FP32: successors: %bb.3(0x80000000)
167 ; MIPS32FP32: bb.3.cond.end:
168 ; MIPS32FP32: [[PHI:%[0-9]+]]:gpr32 = PHI [[COPY1]], %bb.1, [[LW]], %bb.2
169 ; MIPS32FP32: [[PHI1:%[0-9]+]]:gpr32 = PHI [[COPY2]], %bb.1, [[LW1]], %bb.2
170 ; MIPS32FP32: $v0 = COPY [[PHI]]
171 ; MIPS32FP32: $v1 = COPY [[PHI1]]
172 ; MIPS32FP32: RetRA implicit $v0, implicit $v1
173 ; MIPS32FP64-LABEL: name: phi_i64
174 ; MIPS32FP64: bb.0.entry:
175 ; MIPS32FP64: successors: %bb.1(0x40000000), %bb.2(0x40000000)
176 ; MIPS32FP64: liveins: $a0, $a2, $a3
177 ; MIPS32FP64: [[COPY:%[0-9]+]]:gpr32 = COPY $a0
178 ; MIPS32FP64: [[COPY1:%[0-9]+]]:gpr32 = COPY $a2
179 ; MIPS32FP64: [[COPY2:%[0-9]+]]:gpr32 = COPY $a3
180 ; MIPS32FP64: [[ADDiu:%[0-9]+]]:gpr32 = ADDiu %fixed-stack.0, 0
181 ; MIPS32FP64: [[LW:%[0-9]+]]:gpr32 = LW [[ADDiu]], 0 :: (load 4 from %fixed-stack.0, align 8)
182 ; MIPS32FP64: [[ADDiu1:%[0-9]+]]:gpr32 = ADDiu %fixed-stack.1, 0
183 ; MIPS32FP64: [[LW1:%[0-9]+]]:gpr32 = LW [[ADDiu1]], 0 :: (load 4 from %fixed-stack.1)
184 ; MIPS32FP64: [[ORi:%[0-9]+]]:gpr32 = ORi $zero, 1
185 ; MIPS32FP64: [[AND:%[0-9]+]]:gpr32 = AND [[COPY]], [[ORi]]
186 ; MIPS32FP64: BNE [[AND]], $zero, %bb.1, implicit-def $at
187 ; MIPS32FP64: J %bb.2, implicit-def $at
188 ; MIPS32FP64: bb.1.cond.true:
189 ; MIPS32FP64: successors: %bb.3(0x80000000)
190 ; MIPS32FP64: J %bb.3, implicit-def $at
191 ; MIPS32FP64: bb.2.cond.false:
192 ; MIPS32FP64: successors: %bb.3(0x80000000)
193 ; MIPS32FP64: bb.3.cond.end:
194 ; MIPS32FP64: [[PHI:%[0-9]+]]:gpr32 = PHI [[COPY1]], %bb.1, [[LW]], %bb.2
195 ; MIPS32FP64: [[PHI1:%[0-9]+]]:gpr32 = PHI [[COPY2]], %bb.1, [[LW1]], %bb.2
196 ; MIPS32FP64: $v0 = COPY [[PHI]]
197 ; MIPS32FP64: $v1 = COPY [[PHI1]]
198 ; MIPS32FP64: RetRA implicit $v0, implicit $v1
200 liveins: $a0, $a2, $a3
202 %3:gprb(s32) = COPY $a0
203 %4:gprb(s32) = COPY $a2
204 %5:gprb(s32) = COPY $a3
205 %8:gprb(p0) = G_FRAME_INDEX %fixed-stack.1
206 %6:gprb(s32) = G_LOAD %8(p0) :: (load 4 from %fixed-stack.1, align 8)
207 %9:gprb(p0) = G_FRAME_INDEX %fixed-stack.0
208 %7:gprb(s32) = G_LOAD %9(p0) :: (load 4 from %fixed-stack.0)
209 %14:gprb(s32) = G_CONSTANT i32 1
210 %15:gprb(s32) = COPY %3(s32)
211 %13:gprb(s32) = G_AND %15, %14
212 G_BRCOND %13(s32), %bb.2
221 %20:gprb(s32) = G_PHI %4(s32), %bb.2, %6(s32), %bb.3
222 %21:gprb(s32) = G_PHI %5(s32), %bb.2, %7(s32), %bb.3
225 RetRA implicit $v0, implicit $v1
232 regBankSelected: true
233 tracksRegLiveness: true
235 ; MIPS32FP32-LABEL: name: phi_float
236 ; MIPS32FP32: bb.0.entry:
237 ; MIPS32FP32: successors: %bb.1(0x40000000), %bb.2(0x40000000)
238 ; MIPS32FP32: liveins: $a0, $a1, $a2
239 ; MIPS32FP32: [[COPY:%[0-9]+]]:gpr32 = COPY $a0
240 ; MIPS32FP32: [[MTC1_:%[0-9]+]]:fgr32 = MTC1 $a1
241 ; MIPS32FP32: [[MTC1_1:%[0-9]+]]:fgr32 = MTC1 $a2
242 ; MIPS32FP32: [[ORi:%[0-9]+]]:gpr32 = ORi $zero, 1
243 ; MIPS32FP32: [[AND:%[0-9]+]]:gpr32 = AND [[COPY]], [[ORi]]
244 ; MIPS32FP32: BNE [[AND]], $zero, %bb.1, implicit-def $at
245 ; MIPS32FP32: J %bb.2, implicit-def $at
246 ; MIPS32FP32: bb.1.cond.true:
247 ; MIPS32FP32: successors: %bb.3(0x80000000)
248 ; MIPS32FP32: J %bb.3, implicit-def $at
249 ; MIPS32FP32: bb.2.cond.false:
250 ; MIPS32FP32: successors: %bb.3(0x80000000)
251 ; MIPS32FP32: bb.3.cond.end:
252 ; MIPS32FP32: [[PHI:%[0-9]+]]:fgr32 = PHI [[MTC1_]], %bb.1, [[MTC1_1]], %bb.2
253 ; MIPS32FP32: $f0 = COPY [[PHI]]
254 ; MIPS32FP32: RetRA implicit $f0
255 ; MIPS32FP64-LABEL: name: phi_float
256 ; MIPS32FP64: bb.0.entry:
257 ; MIPS32FP64: successors: %bb.1(0x40000000), %bb.2(0x40000000)
258 ; MIPS32FP64: liveins: $a0, $a1, $a2
259 ; MIPS32FP64: [[COPY:%[0-9]+]]:gpr32 = COPY $a0
260 ; MIPS32FP64: [[MTC1_:%[0-9]+]]:fgr32 = MTC1 $a1
261 ; MIPS32FP64: [[MTC1_1:%[0-9]+]]:fgr32 = MTC1 $a2
262 ; MIPS32FP64: [[ORi:%[0-9]+]]:gpr32 = ORi $zero, 1
263 ; MIPS32FP64: [[AND:%[0-9]+]]:gpr32 = AND [[COPY]], [[ORi]]
264 ; MIPS32FP64: BNE [[AND]], $zero, %bb.1, implicit-def $at
265 ; MIPS32FP64: J %bb.2, implicit-def $at
266 ; MIPS32FP64: bb.1.cond.true:
267 ; MIPS32FP64: successors: %bb.3(0x80000000)
268 ; MIPS32FP64: J %bb.3, implicit-def $at
269 ; MIPS32FP64: bb.2.cond.false:
270 ; MIPS32FP64: successors: %bb.3(0x80000000)
271 ; MIPS32FP64: bb.3.cond.end:
272 ; MIPS32FP64: [[PHI:%[0-9]+]]:fgr32 = PHI [[MTC1_]], %bb.1, [[MTC1_1]], %bb.2
273 ; MIPS32FP64: $f0 = COPY [[PHI]]
274 ; MIPS32FP64: RetRA implicit $f0
276 liveins: $a0, $a1, $a2
278 %3:gprb(s32) = COPY $a0
279 %1:fgr32(s32) = MTC1 $a1
280 %2:fgr32(s32) = MTC1 $a2
281 %6:gprb(s32) = G_CONSTANT i32 1
282 %7:gprb(s32) = COPY %3(s32)
283 %5:gprb(s32) = G_AND %7, %6
284 G_BRCOND %5(s32), %bb.2
293 %4:fprb(s32) = G_PHI %1(s32), %bb.2, %2(s32), %bb.3
302 regBankSelected: true
303 tracksRegLiveness: true
305 - { id: 0, offset: 16, size: 4, alignment: 8, isImmutable: true }
307 ; MIPS32FP32-LABEL: name: phi_double
308 ; MIPS32FP32: bb.0.entry:
309 ; MIPS32FP32: successors: %bb.1(0x40000000), %bb.2(0x40000000)
310 ; MIPS32FP32: liveins: $d6, $d7
311 ; MIPS32FP32: [[COPY:%[0-9]+]]:afgr64 = COPY $d6
312 ; MIPS32FP32: [[COPY1:%[0-9]+]]:afgr64 = COPY $d7
313 ; MIPS32FP32: [[ADDiu:%[0-9]+]]:gpr32 = ADDiu %fixed-stack.0, 0
314 ; MIPS32FP32: [[LW:%[0-9]+]]:gpr32 = LW [[ADDiu]], 0 :: (load 4 from %fixed-stack.0, align 8)
315 ; MIPS32FP32: [[ORi:%[0-9]+]]:gpr32 = ORi $zero, 1
316 ; MIPS32FP32: [[AND:%[0-9]+]]:gpr32 = AND [[LW]], [[ORi]]
317 ; MIPS32FP32: BNE [[AND]], $zero, %bb.1, implicit-def $at
318 ; MIPS32FP32: J %bb.2, implicit-def $at
319 ; MIPS32FP32: bb.1.cond.true:
320 ; MIPS32FP32: successors: %bb.3(0x80000000)
321 ; MIPS32FP32: J %bb.3, implicit-def $at
322 ; MIPS32FP32: bb.2.cond.false:
323 ; MIPS32FP32: successors: %bb.3(0x80000000)
324 ; MIPS32FP32: bb.3.cond.end:
325 ; MIPS32FP32: [[PHI:%[0-9]+]]:afgr64 = PHI [[COPY]], %bb.1, [[COPY1]], %bb.2
326 ; MIPS32FP32: $d0 = COPY [[PHI]]
327 ; MIPS32FP32: RetRA implicit $d0
328 ; MIPS32FP64-LABEL: name: phi_double
329 ; MIPS32FP64: bb.0.entry:
330 ; MIPS32FP64: successors: %bb.1(0x40000000), %bb.2(0x40000000)
331 ; MIPS32FP64: liveins: $d6, $d7
332 ; MIPS32FP64: [[COPY:%[0-9]+]]:fgr64 = COPY $d6
333 ; MIPS32FP64: [[COPY1:%[0-9]+]]:fgr64 = COPY $d7
334 ; MIPS32FP64: [[ADDiu:%[0-9]+]]:gpr32 = ADDiu %fixed-stack.0, 0
335 ; MIPS32FP64: [[LW:%[0-9]+]]:gpr32 = LW [[ADDiu]], 0 :: (load 4 from %fixed-stack.0, align 8)
336 ; MIPS32FP64: [[ORi:%[0-9]+]]:gpr32 = ORi $zero, 1
337 ; MIPS32FP64: [[AND:%[0-9]+]]:gpr32 = AND [[LW]], [[ORi]]
338 ; MIPS32FP64: BNE [[AND]], $zero, %bb.1, implicit-def $at
339 ; MIPS32FP64: J %bb.2, implicit-def $at
340 ; MIPS32FP64: bb.1.cond.true:
341 ; MIPS32FP64: successors: %bb.3(0x80000000)
342 ; MIPS32FP64: J %bb.3, implicit-def $at
343 ; MIPS32FP64: bb.2.cond.false:
344 ; MIPS32FP64: successors: %bb.3(0x80000000)
345 ; MIPS32FP64: bb.3.cond.end:
346 ; MIPS32FP64: [[PHI:%[0-9]+]]:fgr64 = PHI [[COPY]], %bb.1, [[COPY1]], %bb.2
347 ; MIPS32FP64: $d0 = COPY [[PHI]]
348 ; MIPS32FP64: RetRA implicit $d0
352 %0:fprb(s64) = COPY $d6
353 %1:fprb(s64) = COPY $d7
354 %4:gprb(p0) = G_FRAME_INDEX %fixed-stack.0
355 %3:gprb(s32) = G_LOAD %4(p0) :: (load 4 from %fixed-stack.0, align 8)
356 %7:gprb(s32) = G_CONSTANT i32 1
357 %8:gprb(s32) = COPY %3(s32)
358 %6:gprb(s32) = G_AND %8, %7
359 G_BRCOND %6(s32), %bb.2
368 %5:fprb(s64) = G_PHI %0(s64), %bb.2, %1(s64), %bb.3