| # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py |
| # RUN: llc -O0 -mtriple=mipsel-linux-gnu -run-pass=legalizer -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=MIPS32 |
| --- | |
| |
| define void @select_i8() {entry: ret void} |
| define void @select_i16() {entry: ret void} |
| define void @select_i32() {entry: ret void} |
| define void @select_ptr() {entry: ret void} |
| define void @select_with_negation() {entry: ret void} |
| |
| ... |
| --- |
| name: select_i8 |
| alignment: 2 |
| tracksRegLiveness: true |
| body: | |
| bb.1.entry: |
| liveins: $a0, $a1, $a2 |
| |
| ; MIPS32-LABEL: name: select_i8 |
| ; MIPS32: liveins: $a0, $a1, $a2 |
| ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0 |
| ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1 |
| ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY $a2 |
| ; MIPS32: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32) |
| ; MIPS32: [[COPY4:%[0-9]+]]:_(s32) = COPY [[COPY2]](s32) |
| ; MIPS32: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 |
| ; MIPS32: [[COPY5:%[0-9]+]]:_(s32) = COPY [[COPY]](s32) |
| ; MIPS32: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY5]], [[C]] |
| ; MIPS32: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s32), [[COPY3]], [[COPY4]] |
| ; MIPS32: [[COPY6:%[0-9]+]]:_(s32) = COPY [[SELECT]](s32) |
| ; MIPS32: $v0 = COPY [[COPY6]](s32) |
| ; MIPS32: RetRA implicit $v0 |
| %3:_(s32) = COPY $a0 |
| %0:_(s1) = G_TRUNC %3(s32) |
| %4:_(s32) = COPY $a1 |
| %1:_(s8) = G_TRUNC %4(s32) |
| %5:_(s32) = COPY $a2 |
| %2:_(s8) = G_TRUNC %5(s32) |
| %6:_(s8) = G_SELECT %0(s1), %1, %2 |
| %7:_(s32) = G_ANYEXT %6(s8) |
| $v0 = COPY %7(s32) |
| RetRA implicit $v0 |
| |
| ... |
| --- |
| name: select_i16 |
| alignment: 2 |
| tracksRegLiveness: true |
| body: | |
| bb.1.entry: |
| liveins: $a0, $a1, $a2 |
| |
| ; MIPS32-LABEL: name: select_i16 |
| ; MIPS32: liveins: $a0, $a1, $a2 |
| ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0 |
| ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1 |
| ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY $a2 |
| ; MIPS32: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32) |
| ; MIPS32: [[COPY4:%[0-9]+]]:_(s32) = COPY [[COPY2]](s32) |
| ; MIPS32: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 |
| ; MIPS32: [[COPY5:%[0-9]+]]:_(s32) = COPY [[COPY]](s32) |
| ; MIPS32: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY5]], [[C]] |
| ; MIPS32: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s32), [[COPY3]], [[COPY4]] |
| ; MIPS32: [[COPY6:%[0-9]+]]:_(s32) = COPY [[SELECT]](s32) |
| ; MIPS32: $v0 = COPY [[COPY6]](s32) |
| ; MIPS32: RetRA implicit $v0 |
| %3:_(s32) = COPY $a0 |
| %0:_(s1) = G_TRUNC %3(s32) |
| %4:_(s32) = COPY $a1 |
| %1:_(s16) = G_TRUNC %4(s32) |
| %5:_(s32) = COPY $a2 |
| %2:_(s16) = G_TRUNC %5(s32) |
| %6:_(s16) = G_SELECT %0(s1), %1, %2 |
| %7:_(s32) = G_ANYEXT %6(s16) |
| $v0 = COPY %7(s32) |
| RetRA implicit $v0 |
| |
| ... |
| --- |
| name: select_i32 |
| alignment: 2 |
| tracksRegLiveness: true |
| body: | |
| bb.1.entry: |
| liveins: $a0, $a1, $a2 |
| |
| ; MIPS32-LABEL: name: select_i32 |
| ; MIPS32: liveins: $a0, $a1, $a2 |
| ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0 |
| ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1 |
| ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY $a2 |
| ; MIPS32: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 |
| ; MIPS32: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY]](s32) |
| ; MIPS32: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY3]], [[C]] |
| ; MIPS32: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s32), [[COPY1]], [[COPY2]] |
| ; MIPS32: $v0 = COPY [[SELECT]](s32) |
| ; MIPS32: RetRA implicit $v0 |
| %3:_(s32) = COPY $a0 |
| %0:_(s1) = G_TRUNC %3(s32) |
| %1:_(s32) = COPY $a1 |
| %2:_(s32) = COPY $a2 |
| %4:_(s32) = G_SELECT %0(s1), %1, %2 |
| $v0 = COPY %4(s32) |
| RetRA implicit $v0 |
| |
| ... |
| --- |
| name: select_ptr |
| alignment: 2 |
| tracksRegLiveness: true |
| body: | |
| bb.1.entry: |
| liveins: $a0, $a1, $a2 |
| |
| ; MIPS32-LABEL: name: select_ptr |
| ; MIPS32: liveins: $a0, $a1, $a2 |
| ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0 |
| ; MIPS32: [[COPY1:%[0-9]+]]:_(p0) = COPY $a1 |
| ; MIPS32: [[COPY2:%[0-9]+]]:_(p0) = COPY $a2 |
| ; MIPS32: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 |
| ; MIPS32: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY]](s32) |
| ; MIPS32: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY3]], [[C]] |
| ; MIPS32: [[SELECT:%[0-9]+]]:_(p0) = G_SELECT [[AND]](s32), [[COPY1]], [[COPY2]] |
| ; MIPS32: $v0 = COPY [[SELECT]](p0) |
| ; MIPS32: RetRA implicit $v0 |
| %3:_(s32) = COPY $a0 |
| %0:_(s1) = G_TRUNC %3(s32) |
| %1:_(p0) = COPY $a1 |
| %2:_(p0) = COPY $a2 |
| %4:_(p0) = G_SELECT %0(s1), %1, %2 |
| $v0 = COPY %4(p0) |
| RetRA implicit $v0 |
| |
| ... |
| --- |
| name: select_with_negation |
| alignment: 2 |
| tracksRegLiveness: true |
| body: | |
| bb.1.entry: |
| liveins: $a0, $a1, $a2, $a3 |
| |
| ; MIPS32-LABEL: name: select_with_negation |
| ; MIPS32: liveins: $a0, $a1, $a2, $a3 |
| ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0 |
| ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1 |
| ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY $a2 |
| ; MIPS32: [[COPY3:%[0-9]+]]:_(s32) = COPY $a3 |
| ; MIPS32: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 -1 |
| ; MIPS32: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(slt), [[COPY]](s32), [[COPY1]] |
| ; MIPS32: [[COPY4:%[0-9]+]]:_(s32) = COPY [[ICMP]](s32) |
| ; MIPS32: [[COPY5:%[0-9]+]]:_(s32) = COPY [[C]](s32) |
| ; MIPS32: [[XOR:%[0-9]+]]:_(s32) = G_XOR [[COPY4]], [[COPY5]] |
| ; MIPS32: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 |
| ; MIPS32: [[COPY6:%[0-9]+]]:_(s32) = COPY [[XOR]](s32) |
| ; MIPS32: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY6]], [[C1]] |
| ; MIPS32: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s32), [[COPY2]], [[COPY3]] |
| ; MIPS32: $v0 = COPY [[SELECT]](s32) |
| ; MIPS32: RetRA implicit $v0 |
| %0:_(s32) = COPY $a0 |
| %1:_(s32) = COPY $a1 |
| %2:_(s32) = COPY $a2 |
| %3:_(s32) = COPY $a3 |
| %5:_(s1) = G_CONSTANT i1 true |
| %4:_(s1) = G_ICMP intpred(slt), %0(s32), %1 |
| %6:_(s1) = G_XOR %4, %5 |
| %7:_(s32) = G_SELECT %6(s1), %2, %3 |
| $v0 = COPY %7(s32) |
| RetRA implicit $v0 |
| |
| ... |