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 void @and_i1() {entry: ret void}
6 define void @and_i8() {entry: ret void}
7 define void @and_i16() {entry: ret void}
8 define void @and_i32() {entry: ret void}
9 define void @and_i64() {entry: ret void}
10 define void @or_i1() {entry: ret void}
11 define void @or_i8() {entry: ret void}
12 define void @or_i16() {entry: ret void}
13 define void @or_i32() {entry: ret void}
14 define void @or_i64() {entry: ret void}
15 define void @xor_i1() {entry: ret void}
16 define void @xor_i8() {entry: ret void}
17 define void @xor_i16() {entry: ret void}
18 define void @xor_i32() {entry: ret void}
19 define void @xor_i64() {entry: ret void}
20 define void @shl(i32) {entry: ret void}
21 define void @ashr(i32) {entry: ret void}
22 define void @lshr(i32) {entry: ret void}
23 define void @shlv(i32, i32) {entry: ret void}
24 define void @ashrv(i32, i32) {entry: ret void}
25 define void @lshrv(i32, i32) {entry: ret void}
31 tracksRegLiveness: true
36 ; MIPS32-LABEL: name: and_i1
37 ; MIPS32: liveins: $a0, $a1
38 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
39 ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
40 ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
41 ; MIPS32: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
42 ; MIPS32: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[COPY3]]
43 ; MIPS32: [[COPY4:%[0-9]+]]:_(s32) = COPY [[AND]](s32)
44 ; MIPS32: $v0 = COPY [[COPY4]](s32)
45 ; MIPS32: RetRA implicit $v0
47 %0:_(s1) = G_TRUNC %2(s32)
49 %1:_(s1) = G_TRUNC %3(s32)
50 %4:_(s1) = G_AND %1, %0
51 %5:_(s32) = G_ANYEXT %4(s1)
59 tracksRegLiveness: true
64 ; MIPS32-LABEL: name: and_i8
65 ; MIPS32: liveins: $a0, $a1
66 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
67 ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
68 ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
69 ; MIPS32: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
70 ; MIPS32: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[COPY3]]
71 ; MIPS32: [[COPY4:%[0-9]+]]:_(s32) = COPY [[AND]](s32)
72 ; MIPS32: $v0 = COPY [[COPY4]](s32)
73 ; MIPS32: RetRA implicit $v0
75 %0:_(s8) = G_TRUNC %2(s32)
77 %1:_(s8) = G_TRUNC %3(s32)
78 %4:_(s8) = G_AND %1, %0
79 %5:_(s32) = G_ANYEXT %4(s8)
87 tracksRegLiveness: true
92 ; MIPS32-LABEL: name: and_i16
93 ; MIPS32: liveins: $a0, $a1
94 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
95 ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
96 ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
97 ; MIPS32: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
98 ; MIPS32: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[COPY3]]
99 ; MIPS32: [[COPY4:%[0-9]+]]:_(s32) = COPY [[AND]](s32)
100 ; MIPS32: $v0 = COPY [[COPY4]](s32)
101 ; MIPS32: RetRA implicit $v0
103 %0:_(s16) = G_TRUNC %2(s32)
105 %1:_(s16) = G_TRUNC %3(s32)
106 %4:_(s16) = G_AND %1, %0
107 %5:_(s32) = G_ANYEXT %4(s16)
115 tracksRegLiveness: true
120 ; MIPS32-LABEL: name: and_i32
121 ; MIPS32: liveins: $a0, $a1
122 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
123 ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
124 ; MIPS32: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[COPY]]
125 ; MIPS32: $v0 = COPY [[AND]](s32)
126 ; MIPS32: RetRA implicit $v0
129 %2:_(s32) = G_AND %1, %0
137 tracksRegLiveness: true
140 liveins: $a0, $a1, $a2, $a3
142 ; MIPS32-LABEL: name: and_i64
143 ; MIPS32: liveins: $a0, $a1, $a2, $a3
144 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
145 ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
146 ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY $a2
147 ; MIPS32: [[COPY3:%[0-9]+]]:_(s32) = COPY $a3
148 ; MIPS32: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[COPY]]
149 ; MIPS32: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY3]], [[COPY1]]
150 ; MIPS32: $v0 = COPY [[AND]](s32)
151 ; MIPS32: $v1 = COPY [[AND1]](s32)
152 ; MIPS32: RetRA implicit $v0, implicit $v1
155 %0:_(s64) = G_MERGE_VALUES %2(s32), %3(s32)
158 %1:_(s64) = G_MERGE_VALUES %4(s32), %5(s32)
159 %6:_(s64) = G_AND %1, %0
160 %7:_(s32), %8:_(s32) = G_UNMERGE_VALUES %6(s64)
163 RetRA implicit $v0, implicit $v1
169 tracksRegLiveness: true
174 ; MIPS32-LABEL: name: or_i1
175 ; MIPS32: liveins: $a0, $a1
176 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
177 ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
178 ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
179 ; MIPS32: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
180 ; MIPS32: [[OR:%[0-9]+]]:_(s32) = G_OR [[COPY2]], [[COPY3]]
181 ; MIPS32: [[COPY4:%[0-9]+]]:_(s32) = COPY [[OR]](s32)
182 ; MIPS32: $v0 = COPY [[COPY4]](s32)
183 ; MIPS32: RetRA implicit $v0
185 %0:_(s1) = G_TRUNC %2(s32)
187 %1:_(s1) = G_TRUNC %3(s32)
188 %4:_(s1) = G_OR %1, %0
189 %5:_(s32) = G_ANYEXT %4(s1)
197 tracksRegLiveness: true
202 ; MIPS32-LABEL: name: or_i8
203 ; MIPS32: liveins: $a0, $a1
204 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
205 ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
206 ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
207 ; MIPS32: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
208 ; MIPS32: [[OR:%[0-9]+]]:_(s32) = G_OR [[COPY2]], [[COPY3]]
209 ; MIPS32: [[COPY4:%[0-9]+]]:_(s32) = COPY [[OR]](s32)
210 ; MIPS32: $v0 = COPY [[COPY4]](s32)
211 ; MIPS32: RetRA implicit $v0
213 %0:_(s8) = G_TRUNC %2(s32)
215 %1:_(s8) = G_TRUNC %3(s32)
216 %4:_(s8) = G_OR %1, %0
217 %5:_(s32) = G_ANYEXT %4(s8)
225 tracksRegLiveness: true
230 ; MIPS32-LABEL: name: or_i16
231 ; MIPS32: liveins: $a0, $a1
232 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
233 ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
234 ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
235 ; MIPS32: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
236 ; MIPS32: [[OR:%[0-9]+]]:_(s32) = G_OR [[COPY2]], [[COPY3]]
237 ; MIPS32: [[COPY4:%[0-9]+]]:_(s32) = COPY [[OR]](s32)
238 ; MIPS32: $v0 = COPY [[COPY4]](s32)
239 ; MIPS32: RetRA implicit $v0
241 %0:_(s16) = G_TRUNC %2(s32)
243 %1:_(s16) = G_TRUNC %3(s32)
244 %4:_(s16) = G_OR %1, %0
245 %5:_(s32) = G_ANYEXT %4(s16)
253 tracksRegLiveness: true
258 ; MIPS32-LABEL: name: or_i32
259 ; MIPS32: liveins: $a0, $a1
260 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
261 ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
262 ; MIPS32: [[OR:%[0-9]+]]:_(s32) = G_OR [[COPY1]], [[COPY]]
263 ; MIPS32: $v0 = COPY [[OR]](s32)
264 ; MIPS32: RetRA implicit $v0
267 %2:_(s32) = G_OR %1, %0
275 tracksRegLiveness: true
278 liveins: $a0, $a1, $a2, $a3
280 ; MIPS32-LABEL: name: or_i64
281 ; MIPS32: liveins: $a0, $a1, $a2, $a3
282 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
283 ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
284 ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY $a2
285 ; MIPS32: [[COPY3:%[0-9]+]]:_(s32) = COPY $a3
286 ; MIPS32: [[OR:%[0-9]+]]:_(s32) = G_OR [[COPY2]], [[COPY]]
287 ; MIPS32: [[OR1:%[0-9]+]]:_(s32) = G_OR [[COPY3]], [[COPY1]]
288 ; MIPS32: $v0 = COPY [[OR]](s32)
289 ; MIPS32: $v1 = COPY [[OR1]](s32)
290 ; MIPS32: RetRA implicit $v0, implicit $v1
293 %0:_(s64) = G_MERGE_VALUES %2(s32), %3(s32)
296 %1:_(s64) = G_MERGE_VALUES %4(s32), %5(s32)
297 %6:_(s64) = G_OR %1, %0
298 %7:_(s32), %8:_(s32) = G_UNMERGE_VALUES %6(s64)
301 RetRA implicit $v0, implicit $v1
307 tracksRegLiveness: true
312 ; MIPS32-LABEL: name: xor_i1
313 ; MIPS32: liveins: $a0, $a1
314 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
315 ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
316 ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
317 ; MIPS32: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
318 ; MIPS32: [[XOR:%[0-9]+]]:_(s32) = G_XOR [[COPY2]], [[COPY3]]
319 ; MIPS32: [[COPY4:%[0-9]+]]:_(s32) = COPY [[XOR]](s32)
320 ; MIPS32: $v0 = COPY [[COPY4]](s32)
321 ; MIPS32: RetRA implicit $v0
323 %0:_(s1) = G_TRUNC %2(s32)
325 %1:_(s1) = G_TRUNC %3(s32)
326 %4:_(s1) = G_XOR %1, %0
327 %5:_(s32) = G_ANYEXT %4(s1)
335 tracksRegLiveness: true
340 ; MIPS32-LABEL: name: xor_i8
341 ; MIPS32: liveins: $a0, $a1
342 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
343 ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
344 ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
345 ; MIPS32: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
346 ; MIPS32: [[XOR:%[0-9]+]]:_(s32) = G_XOR [[COPY2]], [[COPY3]]
347 ; MIPS32: [[COPY4:%[0-9]+]]:_(s32) = COPY [[XOR]](s32)
348 ; MIPS32: $v0 = COPY [[COPY4]](s32)
349 ; MIPS32: RetRA implicit $v0
351 %0:_(s8) = G_TRUNC %2(s32)
353 %1:_(s8) = G_TRUNC %3(s32)
354 %4:_(s8) = G_XOR %1, %0
355 %5:_(s32) = G_ANYEXT %4(s8)
363 tracksRegLiveness: true
368 ; MIPS32-LABEL: name: xor_i16
369 ; MIPS32: liveins: $a0, $a1
370 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
371 ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
372 ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
373 ; MIPS32: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
374 ; MIPS32: [[XOR:%[0-9]+]]:_(s32) = G_XOR [[COPY2]], [[COPY3]]
375 ; MIPS32: [[COPY4:%[0-9]+]]:_(s32) = COPY [[XOR]](s32)
376 ; MIPS32: $v0 = COPY [[COPY4]](s32)
377 ; MIPS32: RetRA implicit $v0
379 %0:_(s16) = G_TRUNC %2(s32)
381 %1:_(s16) = G_TRUNC %3(s32)
382 %4:_(s16) = G_XOR %1, %0
383 %5:_(s32) = G_ANYEXT %4(s16)
391 tracksRegLiveness: true
396 ; MIPS32-LABEL: name: xor_i32
397 ; MIPS32: liveins: $a0, $a1
398 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
399 ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
400 ; MIPS32: [[XOR:%[0-9]+]]:_(s32) = G_XOR [[COPY1]], [[COPY]]
401 ; MIPS32: $v0 = COPY [[XOR]](s32)
402 ; MIPS32: RetRA implicit $v0
405 %2:_(s32) = G_XOR %1, %0
413 tracksRegLiveness: true
416 liveins: $a0, $a1, $a2, $a3
418 ; MIPS32-LABEL: name: xor_i64
419 ; MIPS32: liveins: $a0, $a1, $a2, $a3
420 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
421 ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
422 ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY $a2
423 ; MIPS32: [[COPY3:%[0-9]+]]:_(s32) = COPY $a3
424 ; MIPS32: [[XOR:%[0-9]+]]:_(s32) = G_XOR [[COPY2]], [[COPY]]
425 ; MIPS32: [[XOR1:%[0-9]+]]:_(s32) = G_XOR [[COPY3]], [[COPY1]]
426 ; MIPS32: $v0 = COPY [[XOR]](s32)
427 ; MIPS32: $v1 = COPY [[XOR1]](s32)
428 ; MIPS32: RetRA implicit $v0, implicit $v1
431 %0:_(s64) = G_MERGE_VALUES %2(s32), %3(s32)
434 %1:_(s64) = G_MERGE_VALUES %4(s32), %5(s32)
435 %6:_(s64) = G_XOR %1, %0
436 %7:_(s32), %8:_(s32) = G_UNMERGE_VALUES %6(s64)
439 RetRA implicit $v0, implicit $v1
445 tracksRegLiveness: true
450 ; MIPS32-LABEL: name: shl
451 ; MIPS32: liveins: $a0
452 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
453 ; MIPS32: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
454 ; MIPS32: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[COPY]], [[C]]
455 ; MIPS32: $v0 = COPY [[SHL]](s32)
456 ; MIPS32: RetRA implicit $v0
458 %1:_(s32) = G_CONSTANT i32 1
459 %2:_(s32) = G_SHL %0, %1
467 tracksRegLiveness: true
472 ; MIPS32-LABEL: name: ashr
473 ; MIPS32: liveins: $a0
474 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
475 ; MIPS32: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
476 ; MIPS32: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[COPY]], [[C]]
477 ; MIPS32: $v0 = COPY [[ASHR]](s32)
478 ; MIPS32: RetRA implicit $v0
480 %1:_(s32) = G_CONSTANT i32 1
481 %2:_(s32) = G_ASHR %0, %1
489 tracksRegLiveness: true
494 ; MIPS32-LABEL: name: lshr
495 ; MIPS32: liveins: $a0
496 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
497 ; MIPS32: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
498 ; MIPS32: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[COPY]], [[C]]
499 ; MIPS32: $v0 = COPY [[LSHR]](s32)
500 ; MIPS32: RetRA implicit $v0
502 %1:_(s32) = G_CONSTANT i32 1
503 %2:_(s32) = G_LSHR %0, %1
511 tracksRegLiveness: true
516 ; MIPS32-LABEL: name: shlv
517 ; MIPS32: liveins: $a0, $a1
518 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
519 ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
520 ; MIPS32: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[COPY]], [[COPY1]]
521 ; MIPS32: $v0 = COPY [[SHL]](s32)
522 ; MIPS32: RetRA implicit $v0
525 %2:_(s32) = G_SHL %0, %1
533 tracksRegLiveness: true
538 ; MIPS32-LABEL: name: ashrv
539 ; MIPS32: liveins: $a0, $a1
540 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
541 ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
542 ; MIPS32: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[COPY]], [[COPY1]]
543 ; MIPS32: $v0 = COPY [[ASHR]](s32)
544 ; MIPS32: RetRA implicit $v0
547 %2:_(s32) = G_ASHR %0, %1
555 tracksRegLiveness: true
560 ; MIPS32-LABEL: name: lshrv
561 ; MIPS32: liveins: $a0, $a1
562 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
563 ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
564 ; MIPS32: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[COPY]], [[COPY1]]
565 ; MIPS32: $v0 = COPY [[LSHR]](s32)
566 ; MIPS32: RetRA implicit $v0
569 %2:_(s32) = G_LSHR %0, %1