| # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py |
| # RUN: llc -mtriple=riscv32 -run-pass=legalizer %s -o - \ |
| # RUN: | FileCheck %s |
| --- |
| name: select_i7 |
| body: | |
| bb.0.entry: |
| ; CHECK-LABEL: name: select_i7 |
| ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 |
| ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 |
| ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $x12 |
| ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 |
| ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[C]] |
| ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s32), [[COPY]], [[COPY1]] |
| ; CHECK-NEXT: $x10 = COPY [[SELECT]](s32) |
| ; CHECK-NEXT: PseudoRET implicit $x10 |
| %0:_(s32) = COPY $x10 |
| %1:_(s32) = COPY $x11 |
| %2:_(s32) = COPY $x12 |
| %3:_(s7) = G_TRUNC %0(s32) |
| %4:_(s7) = G_TRUNC %1(s32) |
| %5:_(s1) = G_TRUNC %2(s32) |
| %6:_(s7) = G_SELECT %5(s1), %3(s7), %4 |
| %7:_(s32) = G_ANYEXT %6(s7) |
| $x10 = COPY %7(s32) |
| PseudoRET implicit $x10 |
| |
| ... |
| --- |
| name: select_i8 |
| body: | |
| bb.0.entry: |
| ; CHECK-LABEL: name: select_i8 |
| ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 |
| ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 |
| ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $x12 |
| ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 |
| ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[C]] |
| ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s32), [[COPY]], [[COPY1]] |
| ; CHECK-NEXT: $x10 = COPY [[SELECT]](s32) |
| ; CHECK-NEXT: PseudoRET implicit $x10 |
| %0:_(s32) = COPY $x10 |
| %1:_(s32) = COPY $x11 |
| %2:_(s32) = COPY $x12 |
| %3:_(s8) = G_TRUNC %0(s32) |
| %4:_(s8) = G_TRUNC %1(s32) |
| %5:_(s1) = G_TRUNC %2(s32) |
| %6:_(s8) = G_SELECT %5(s1), %3(s8), %4 |
| %7:_(s32) = G_ANYEXT %6(s8) |
| $x10 = COPY %7(s32) |
| PseudoRET implicit $x10 |
| |
| ... |
| --- |
| name: select_i16 |
| body: | |
| bb.0.entry: |
| ; CHECK-LABEL: name: select_i16 |
| ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 |
| ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 |
| ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $x12 |
| ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 |
| ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[C]] |
| ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s32), [[COPY]], [[COPY1]] |
| ; CHECK-NEXT: $x10 = COPY [[SELECT]](s32) |
| ; CHECK-NEXT: PseudoRET implicit $x10 |
| %0:_(s32) = COPY $x10 |
| %1:_(s32) = COPY $x11 |
| %2:_(s32) = COPY $x12 |
| %3:_(s16) = G_TRUNC %0(s32) |
| %4:_(s16) = G_TRUNC %1(s32) |
| %5:_(s1) = G_TRUNC %2(s32) |
| %6:_(s16) = G_SELECT %5(s1), %3(s16), %4 |
| %7:_(s32) = G_ANYEXT %6(s16) |
| $x10 = COPY %7(s32) |
| PseudoRET implicit $x10 |
| |
| ... |
| --- |
| name: select_i32 |
| body: | |
| bb.0.entry: |
| ; CHECK-LABEL: name: select_i32 |
| ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 |
| ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 |
| ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $x12 |
| ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 |
| ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[C]] |
| ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s32), [[COPY]], [[COPY1]] |
| ; CHECK-NEXT: $x10 = COPY [[SELECT]](s32) |
| ; CHECK-NEXT: PseudoRET implicit $x10 |
| %0:_(s32) = COPY $x10 |
| %1:_(s32) = COPY $x11 |
| %2:_(s32) = COPY $x12 |
| %3:_(s1) = G_TRUNC %2(s32) |
| %4:_(s32) = G_SELECT %3(s1), %0(s32), %1(s32) |
| $x10 = COPY %4(s32) |
| PseudoRET implicit $x10 |
| |
| ... |
| --- |
| name: select_i48 |
| body: | |
| bb.0.entry: |
| ; CHECK-LABEL: name: select_i48 |
| ; CHECK: %xhi:_(s32) = COPY $x10 |
| ; CHECK-NEXT: %xlo:_(s32) = COPY $x11 |
| ; CHECK-NEXT: %yhi:_(s32) = COPY $x12 |
| ; CHECK-NEXT: %ylo:_(s32) = COPY $x13 |
| ; CHECK-NEXT: %c0:_(s32) = COPY $x14 |
| ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 |
| ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND %c0, [[C]] |
| ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s32), %xhi, %yhi |
| ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 |
| ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND %c0, [[C1]] |
| ; CHECK-NEXT: [[SELECT1:%[0-9]+]]:_(s32) = G_SELECT [[AND1]](s32), %xlo, %ylo |
| ; CHECK-NEXT: $x10 = COPY [[SELECT]](s32) |
| ; CHECK-NEXT: $x11 = COPY [[SELECT1]](s32) |
| ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11 |
| %xhi:_(s32) = COPY $x10 |
| %xlo:_(s32) = COPY $x11 |
| %yhi:_(s32) = COPY $x12 |
| %ylo:_(s32) = COPY $x13 |
| %c0:_(s32) = COPY $x14 |
| %x0:_(s64) = G_MERGE_VALUES %xhi(s32), %xlo(s32) |
| %y0:_(s64) = G_MERGE_VALUES %yhi(s32), %ylo(s32) |
| %x:_(s48) = G_TRUNC %x0(s64) |
| %y:_(s48) = G_TRUNC %y0(s64) |
| %c:_(s1) = G_TRUNC %c0(s32) |
| %z:_(s48) = G_SELECT %c(s1), %x(s48), %y |
| %z0:_(s64) = G_ANYEXT %z(s48) |
| %zhi:_(s32), %zlo:_(s32) = G_UNMERGE_VALUES %z0(s64) |
| $x10 = COPY %zhi(s32) |
| $x11 = COPY %zlo(s32) |
| PseudoRET implicit $x10, implicit $x11 |
| |
| ... |
| --- |
| name: select_i64 |
| body: | |
| bb.0.entry: |
| ; CHECK-LABEL: name: select_i64 |
| ; CHECK: %xhi:_(s32) = COPY $x10 |
| ; CHECK-NEXT: %xlo:_(s32) = COPY $x11 |
| ; CHECK-NEXT: %yhi:_(s32) = COPY $x12 |
| ; CHECK-NEXT: %ylo:_(s32) = COPY $x13 |
| ; CHECK-NEXT: %c0:_(s32) = COPY $x14 |
| ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 |
| ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND %c0, [[C]] |
| ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s32), %xhi, %yhi |
| ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 |
| ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND %c0, [[C1]] |
| ; CHECK-NEXT: [[SELECT1:%[0-9]+]]:_(s32) = G_SELECT [[AND1]](s32), %xlo, %ylo |
| ; CHECK-NEXT: $x10 = COPY [[SELECT]](s32) |
| ; CHECK-NEXT: $x11 = COPY [[SELECT1]](s32) |
| ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11 |
| %xhi:_(s32) = COPY $x10 |
| %xlo:_(s32) = COPY $x11 |
| %yhi:_(s32) = COPY $x12 |
| %ylo:_(s32) = COPY $x13 |
| %c0:_(s32) = COPY $x14 |
| %x:_(s64) = G_MERGE_VALUES %xhi(s32), %xlo(s32) |
| %y:_(s64) = G_MERGE_VALUES %yhi(s32), %ylo(s32) |
| %c:_(s1) = G_TRUNC %c0(s32) |
| %z:_(s64) = G_SELECT %c(s1), %x(s64), %y |
| %zhi:_(s32), %zlo:_(s32) = G_UNMERGE_VALUES %z(s64) |
| $x10 = COPY %zhi(s32) |
| $x11 = COPY %zlo(s32) |
| PseudoRET implicit $x10, implicit $x11 |
| |
| ... |
| --- |
| name: select_i96 |
| body: | |
| bb.0.entry: |
| ; CHECK-LABEL: name: select_i96 |
| ; CHECK: %yhi:_(s32) = COPY $x13 |
| ; CHECK-NEXT: %ymid:_(s32) = COPY $x14 |
| ; CHECK-NEXT: %ylo:_(s32) = COPY $x15 |
| ; CHECK-NEXT: $x10 = COPY %yhi(s32) |
| ; CHECK-NEXT: $x11 = COPY %ymid(s32) |
| ; CHECK-NEXT: $x12 = COPY %ylo(s32) |
| ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11, implicit $x12 |
| %xhi:_(s32) = COPY $x10 |
| %xmid:_(s32) = COPY $x11 |
| %xlo:_(s32) = COPY $x12 |
| %yhi:_(s32) = COPY $x13 |
| %ymid:_(s32) = COPY $x14 |
| %ylo:_(s32) = COPY $x15 |
| %c0:_(s32) = COPY $x16 |
| %x:_(s96) = G_MERGE_VALUES %xhi(s32), %xmid(s32), %xlo(s32) |
| %y:_(s96) = G_MERGE_VALUES %yhi(s32), %ymid(s32), %ylo(s32) |
| %c:_(s1) = G_TRUNC %c0(s32) |
| %z:_(s96) = G_SELECT %c(s1), %x(s96), %y |
| %zhi:_(s32), %zmid:_(s32), %zlo:_(s32) = G_UNMERGE_VALUES %y(s96) |
| $x10 = COPY %zhi(s32) |
| $x11 = COPY %zmid(s32) |
| $x12 = COPY %zlo(s32) |
| PseudoRET implicit $x10, implicit $x11, implicit $x12 |
| |
| ... |
| --- |
| name: select_ptr |
| body: | |
| bb.0.entry: |
| ; CHECK-LABEL: name: select_ptr |
| ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $x10 |
| ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $x11 |
| ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $x12 |
| ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 |
| ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[C]] |
| ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(p0) = G_SELECT [[AND]](s32), [[COPY]], [[COPY1]] |
| ; CHECK-NEXT: $x10 = COPY [[SELECT]](p0) |
| ; CHECK-NEXT: PseudoRET implicit $x10 |
| %0:_(p0) = COPY $x10 |
| %1:_(p0) = COPY $x11 |
| %2:_(s32) = COPY $x12 |
| %3:_(s1) = G_TRUNC %2(s32) |
| %4:_(p0) = G_SELECT %3(s1), %0(p0), %1(p0) |
| $x10 = COPY %4(p0) |
| PseudoRET implicit $x10 |
| |
| ... |