| # 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: shl_i7 |
| body: | |
| bb.0.entry: |
| ; CHECK-LABEL: name: shl_i7 |
| ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 |
| ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 |
| ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 127 |
| ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]] |
| ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[COPY]], [[AND]](s32) |
| ; CHECK-NEXT: $x10 = COPY [[SHL]](s32) |
| ; CHECK-NEXT: PseudoRET implicit $x10 |
| %0:_(s32) = COPY $x10 |
| %1:_(s32) = COPY $x11 |
| %2:_(s7) = G_TRUNC %0(s32) |
| %3:_(s7) = G_TRUNC %1(s32) |
| %4:_(s7) = G_SHL %2, %3 |
| %5:_(s32) = G_ANYEXT %4(s7) |
| $x10 = COPY %5(s32) |
| PseudoRET implicit $x10 |
| |
| ... |
| --- |
| name: shl_i8 |
| body: | |
| bb.0.entry: |
| ; CHECK-LABEL: name: shl_i8 |
| ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 |
| ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 |
| ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255 |
| ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]] |
| ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[COPY]], [[AND]](s32) |
| ; CHECK-NEXT: $x10 = COPY [[SHL]](s32) |
| ; CHECK-NEXT: PseudoRET implicit $x10 |
| %0:_(s32) = COPY $x10 |
| %1:_(s32) = COPY $x11 |
| %2:_(s8) = G_TRUNC %0(s32) |
| %3:_(s8) = G_TRUNC %1(s32) |
| %4:_(s8) = G_SHL %2, %3 |
| %5:_(s32) = G_ANYEXT %4(s8) |
| $x10 = COPY %5(s32) |
| PseudoRET implicit $x10 |
| |
| ... |
| --- |
| name: shl_i16 |
| body: | |
| bb.0.entry: |
| ; CHECK-LABEL: name: shl_i16 |
| ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 |
| ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 |
| ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535 |
| ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]] |
| ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[COPY]], [[AND]](s32) |
| ; CHECK-NEXT: $x10 = COPY [[SHL]](s32) |
| ; CHECK-NEXT: PseudoRET implicit $x10 |
| %0:_(s32) = COPY $x10 |
| %1:_(s32) = COPY $x11 |
| %2:_(s16) = G_TRUNC %0(s32) |
| %3:_(s16) = G_TRUNC %1(s32) |
| %4:_(s16) = G_SHL %2, %3 |
| %5:_(s32) = G_ANYEXT %4(s16) |
| $x10 = COPY %5(s32) |
| PseudoRET implicit $x10 |
| |
| ... |
| --- |
| name: shl_i32 |
| body: | |
| bb.0.entry: |
| ; CHECK-LABEL: name: shl_i32 |
| ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 |
| ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 |
| ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[COPY]], [[COPY1]](s32) |
| ; CHECK-NEXT: $x10 = COPY [[SHL]](s32) |
| ; CHECK-NEXT: PseudoRET implicit $x10 |
| %0:_(s32) = COPY $x10 |
| %1:_(s32) = COPY $x11 |
| %2:_(s32) = G_SHL %0, %1 |
| $x10 = COPY %2(s32) |
| PseudoRET implicit $x10 |
| |
| ... |
| --- |
| name: shl_i48 |
| body: | |
| bb.0.entry: |
| ; CHECK-LABEL: name: shl_i48 |
| ; CHECK: %xlo:_(s32) = COPY $x10 |
| ; CHECK-NEXT: %xhi:_(s32) = COPY $x11 |
| ; CHECK-NEXT: %ylo:_(s32) = COPY $x12 |
| ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 32 |
| ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s32) = G_SUB %ylo, [[C]] |
| ; CHECK-NEXT: [[SUB1:%[0-9]+]]:_(s32) = G_SUB [[C]], %ylo |
| ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 0 |
| ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), %ylo(s32), [[C]] |
| ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), %ylo(s32), [[C1]] |
| ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL %xlo, %ylo(s32) |
| ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR %xlo, [[SUB1]](s32) |
| ; CHECK-NEXT: [[SHL1:%[0-9]+]]:_(s32) = G_SHL %xhi, %ylo(s32) |
| ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s32) = G_OR [[LSHR]], [[SHL1]] |
| ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 0 |
| ; CHECK-NEXT: [[SHL2:%[0-9]+]]:_(s32) = G_SHL %xlo, [[SUB]](s32) |
| ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[ICMP]](s32), [[SHL]], [[C2]] |
| ; CHECK-NEXT: [[SELECT1:%[0-9]+]]:_(s32) = G_SELECT [[ICMP]](s32), [[OR]], [[SHL2]] |
| ; CHECK-NEXT: [[SELECT2:%[0-9]+]]:_(s32) = G_SELECT [[ICMP1]](s32), %xhi, [[SELECT1]] |
| ; CHECK-NEXT: $x10 = COPY [[SELECT]](s32) |
| ; CHECK-NEXT: $x11 = COPY [[SELECT2]](s32) |
| ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11 |
| %xlo:_(s32) = COPY $x10 |
| %xhi:_(s32) = COPY $x11 |
| %ylo:_(s32) = COPY $x12 |
| %yhi:_(s32) = COPY $x13 |
| %x0:_(s64) = G_MERGE_VALUES %xlo(s32), %xhi(s32) |
| %y0:_(s64) = G_MERGE_VALUES %ylo(s32), %yhi(s32) |
| %x:_(s48) = G_TRUNC %x0(s64) |
| %y:_(s48) = G_TRUNC %y0(s64) |
| %z:_(s48) = G_SHL %x, %y |
| %z0:_(s64) = G_ANYEXT %z(s48) |
| %zlo:_(s32), %zhi:_(s32) = G_UNMERGE_VALUES %z0(s64) |
| $x10 = COPY %zlo(s32) |
| $x11 = COPY %zhi(s32) |
| PseudoRET implicit $x10, implicit $x11 |
| |
| ... |
| --- |
| name: shl_i64 |
| body: | |
| bb.0.entry: |
| ; CHECK-LABEL: name: shl_i64 |
| ; CHECK: %lo1:_(s32) = COPY $x10 |
| ; CHECK-NEXT: %hi1:_(s32) = COPY $x11 |
| ; CHECK-NEXT: %lo2:_(s32) = COPY $x12 |
| ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 32 |
| ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s32) = G_SUB %lo2, [[C]] |
| ; CHECK-NEXT: [[SUB1:%[0-9]+]]:_(s32) = G_SUB [[C]], %lo2 |
| ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 0 |
| ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), %lo2(s32), [[C]] |
| ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), %lo2(s32), [[C1]] |
| ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL %lo1, %lo2(s32) |
| ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR %lo1, [[SUB1]](s32) |
| ; CHECK-NEXT: [[SHL1:%[0-9]+]]:_(s32) = G_SHL %hi1, %lo2(s32) |
| ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s32) = G_OR [[LSHR]], [[SHL1]] |
| ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 0 |
| ; CHECK-NEXT: [[SHL2:%[0-9]+]]:_(s32) = G_SHL %lo1, [[SUB]](s32) |
| ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[ICMP]](s32), [[SHL]], [[C2]] |
| ; CHECK-NEXT: [[SELECT1:%[0-9]+]]:_(s32) = G_SELECT [[ICMP]](s32), [[OR]], [[SHL2]] |
| ; CHECK-NEXT: [[SELECT2:%[0-9]+]]:_(s32) = G_SELECT [[ICMP1]](s32), %hi1, [[SELECT1]] |
| ; CHECK-NEXT: $x10 = COPY [[SELECT]](s32) |
| ; CHECK-NEXT: $x11 = COPY [[SELECT2]](s32) |
| ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11 |
| %lo1:_(s32) = COPY $x10 |
| %hi1:_(s32) = COPY $x11 |
| %lo2:_(s32) = COPY $x12 |
| %hi2:_(s32) = COPY $x13 |
| %x1:_(s64) = G_MERGE_VALUES %lo1(s32), %hi1(s32) |
| %x2:_(s64) = G_MERGE_VALUES %lo2(s32), %hi2(s32) |
| %y:_(s64) = G_SHL %x1, %x2 |
| %loy:_(s32), %hiy:_(s32) = G_UNMERGE_VALUES %y(s64) |
| $x10 = COPY %loy(s32) |
| $x11 = COPY %hiy(s32) |
| PseudoRET implicit $x10, implicit $x11 |
| |
| ... |
| --- |
| name: shl_i96 |
| body: | |
| bb.0.entry: |
| ; CHECK-LABEL: name: shl_i96 |
| ; CHECK: %lo1:_(s32) = COPY $x10 |
| ; CHECK-NEXT: %mid1:_(s32) = COPY $x11 |
| ; CHECK-NEXT: %hi1:_(s32) = COPY $x12 |
| ; CHECK-NEXT: %lo2:_(s32) = COPY $x13 |
| ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 64 |
| ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s32) = G_SUB %lo2, [[C]] |
| ; CHECK-NEXT: [[SUB1:%[0-9]+]]:_(s32) = G_SUB [[C]], %lo2 |
| ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 0 |
| ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), %lo2(s32), [[C]] |
| ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), %lo2(s32), [[C1]] |
| ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 32 |
| ; CHECK-NEXT: [[SUB2:%[0-9]+]]:_(s32) = G_SUB %lo2, [[C2]] |
| ; CHECK-NEXT: [[SUB3:%[0-9]+]]:_(s32) = G_SUB [[C2]], %lo2 |
| ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s32) = G_CONSTANT i32 0 |
| ; CHECK-NEXT: [[ICMP2:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), %lo2(s32), [[C2]] |
| ; CHECK-NEXT: [[ICMP3:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), %lo2(s32), [[C3]] |
| ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL %lo1, %lo2(s32) |
| ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR %lo1, [[SUB3]](s32) |
| ; CHECK-NEXT: [[SHL1:%[0-9]+]]:_(s32) = G_SHL %mid1, %lo2(s32) |
| ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s32) = G_OR [[LSHR]], [[SHL1]] |
| ; CHECK-NEXT: [[C4:%[0-9]+]]:_(s32) = G_CONSTANT i32 0 |
| ; CHECK-NEXT: [[SHL2:%[0-9]+]]:_(s32) = G_SHL %lo1, [[SUB2]](s32) |
| ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[ICMP2]](s32), [[SHL]], [[C4]] |
| ; CHECK-NEXT: [[SELECT1:%[0-9]+]]:_(s32) = G_SELECT [[ICMP2]](s32), [[OR]], [[SHL2]] |
| ; CHECK-NEXT: [[SELECT2:%[0-9]+]]:_(s32) = G_SELECT [[ICMP3]](s32), %mid1, [[SELECT1]] |
| ; CHECK-NEXT: [[C5:%[0-9]+]]:_(s32) = G_CONSTANT i32 32 |
| ; CHECK-NEXT: [[SUB4:%[0-9]+]]:_(s32) = G_SUB [[SUB1]], [[C5]] |
| ; CHECK-NEXT: [[SUB5:%[0-9]+]]:_(s32) = G_SUB [[C5]], [[SUB1]] |
| ; CHECK-NEXT: [[C6:%[0-9]+]]:_(s32) = G_CONSTANT i32 0 |
| ; CHECK-NEXT: [[ICMP4:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[SUB1]](s32), [[C5]] |
| ; CHECK-NEXT: [[ICMP5:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[SUB1]](s32), [[C6]] |
| ; CHECK-NEXT: [[LSHR1:%[0-9]+]]:_(s32) = G_LSHR %lo1, [[SUB1]](s32) |
| ; CHECK-NEXT: [[SHL3:%[0-9]+]]:_(s32) = G_SHL %mid1, [[SUB5]](s32) |
| ; CHECK-NEXT: [[OR1:%[0-9]+]]:_(s32) = G_OR [[LSHR1]], [[SHL3]] |
| ; CHECK-NEXT: [[LSHR2:%[0-9]+]]:_(s32) = G_LSHR %mid1, [[SUB4]](s32) |
| ; CHECK-NEXT: [[SELECT3:%[0-9]+]]:_(s32) = G_SELECT [[ICMP4]](s32), [[OR1]], [[LSHR2]] |
| ; CHECK-NEXT: [[SELECT4:%[0-9]+]]:_(s32) = G_SELECT [[ICMP5]](s32), %lo1, [[SELECT3]] |
| ; CHECK-NEXT: [[C7:%[0-9]+]]:_(s32) = G_CONSTANT i32 32 |
| ; CHECK-NEXT: [[ICMP6:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), %lo2(s32), [[C7]] |
| ; CHECK-NEXT: [[SHL4:%[0-9]+]]:_(s32) = G_SHL %hi1, %lo2(s32) |
| ; CHECK-NEXT: [[C8:%[0-9]+]]:_(s32) = G_CONSTANT i32 0 |
| ; CHECK-NEXT: [[SELECT5:%[0-9]+]]:_(s32) = G_SELECT [[ICMP6]](s32), [[SHL4]], [[C8]] |
| ; CHECK-NEXT: [[OR2:%[0-9]+]]:_(s32) = G_OR [[SELECT4]], [[SELECT5]] |
| ; CHECK-NEXT: [[C9:%[0-9]+]]:_(s32) = G_CONSTANT i32 0 |
| ; CHECK-NEXT: [[C10:%[0-9]+]]:_(s32) = G_CONSTANT i32 0 |
| ; CHECK-NEXT: [[C11:%[0-9]+]]:_(s32) = G_CONSTANT i32 32 |
| ; CHECK-NEXT: [[ICMP7:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[SUB]](s32), [[C11]] |
| ; CHECK-NEXT: [[SHL5:%[0-9]+]]:_(s32) = G_SHL %lo1, [[SUB]](s32) |
| ; CHECK-NEXT: [[C12:%[0-9]+]]:_(s32) = G_CONSTANT i32 0 |
| ; CHECK-NEXT: [[SELECT6:%[0-9]+]]:_(s32) = G_SELECT [[ICMP7]](s32), [[SHL5]], [[C12]] |
| ; CHECK-NEXT: [[SELECT7:%[0-9]+]]:_(s32) = G_SELECT [[ICMP]](s32), [[SELECT]], [[C9]] |
| ; CHECK-NEXT: [[SELECT8:%[0-9]+]]:_(s32) = G_SELECT [[ICMP]](s32), [[SELECT2]], [[C10]] |
| ; CHECK-NEXT: [[SELECT9:%[0-9]+]]:_(s32) = G_SELECT [[ICMP]](s32), [[OR2]], [[SELECT6]] |
| ; CHECK-NEXT: [[SELECT10:%[0-9]+]]:_(s32) = G_SELECT [[ICMP1]](s32), %hi1, [[SELECT9]] |
| ; CHECK-NEXT: $x10 = COPY [[SELECT7]](s32) |
| ; CHECK-NEXT: $x11 = COPY [[SELECT8]](s32) |
| ; CHECK-NEXT: $x12 = COPY [[SELECT10]](s32) |
| ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11, implicit $x12 |
| %lo1:_(s32) = COPY $x10 |
| %mid1:_(s32) = COPY $x11 |
| %hi1:_(s32) = COPY $x12 |
| %lo2:_(s32) = COPY $x13 |
| %mid2:_(s32) = COPY $x14 |
| %hi2:_(s32) = COPY $x15 |
| %x1:_(s96) = G_MERGE_VALUES %lo1(s32), %mid1(s32), %hi1(s32) |
| %x2:_(s96) = G_MERGE_VALUES %lo2(s32), %mid2(s32), %hi2(s32) |
| %y:_(s96) = G_SHL %x1, %x2 |
| %lo:_(s32), %mid:_(s32), %hi:_(s32) = G_UNMERGE_VALUES %y(s96) |
| $x10 = COPY %lo(s32) |
| $x11 = COPY %mid(s32) |
| $x12 = COPY %hi(s32) |
| PseudoRET implicit $x10, implicit $x11, implicit $x12 |
| |
| ... |