1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=riscv64 -run-pass=legalizer %s -o - \
3 # RUN: -code-model=small | FileCheck %s
6 define i32 @jt_test(i32 signext %in) {
8 %0 = sext i32 %in to i64
9 switch i64 %0, label %default [
43 tracksRegLiveness: true
48 blocks: [ '%bb.2', '%bb.3', '%bb.4', '%bb.5', '%bb.6', '%bb.7' ]
50 ; CHECK-LABEL: name: jt_test
52 ; CHECK-NEXT: successors: %bb.8(0x40000000), %bb.1(0x40000000)
53 ; CHECK-NEXT: liveins: $x10
55 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
56 ; CHECK-NEXT: [[ASSERT_SEXT:%[0-9]+]]:_(s64) = G_ASSERT_SEXT [[COPY]], 32
57 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 5
58 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
59 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s64) = G_SUB [[ASSERT_SEXT]], [[C1]]
60 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(ugt), [[SUB]](s64), [[C]]
61 ; CHECK-NEXT: G_BRCOND [[ICMP]](s64), %bb.8
63 ; CHECK-NEXT: bb.1.entry:
64 ; CHECK-NEXT: successors: %bb.2(0x15555555), %bb.3(0x15555555), %bb.4(0x15555555), %bb.5(0x15555555), %bb.6(0x15555555), %bb.7(0x15555555)
66 ; CHECK-NEXT: [[JUMP_TABLE:%[0-9]+]]:_(p0) = G_JUMP_TABLE %jump-table.0
67 ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 2
68 ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[SUB]], [[C2]](s64)
69 ; CHECK-NEXT: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[JUMP_TABLE]], [[SHL]](s64)
70 ; CHECK-NEXT: [[SEXTLOAD:%[0-9]+]]:_(s64) = G_SEXTLOAD [[PTR_ADD]](p0) :: (load (s32) from jump-table)
71 ; CHECK-NEXT: [[INTTOPTR:%[0-9]+]]:_(p0) = G_INTTOPTR [[SEXTLOAD]](s64)
72 ; CHECK-NEXT: G_BRINDIRECT [[INTTOPTR]](p0)
74 ; CHECK-NEXT: bb.2.bb1:
75 ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s64) = G_CONSTANT i64 4
76 ; CHECK-NEXT: $x10 = COPY [[C3]](s64)
77 ; CHECK-NEXT: PseudoRET implicit $x10
79 ; CHECK-NEXT: bb.3.bb2:
80 ; CHECK-NEXT: [[C4:%[0-9]+]]:_(s64) = G_CONSTANT i64 3
81 ; CHECK-NEXT: $x10 = COPY [[C4]](s64)
82 ; CHECK-NEXT: PseudoRET implicit $x10
84 ; CHECK-NEXT: bb.4.bb3:
85 ; CHECK-NEXT: [[C5:%[0-9]+]]:_(s64) = G_CONSTANT i64 2
86 ; CHECK-NEXT: $x10 = COPY [[C5]](s64)
87 ; CHECK-NEXT: PseudoRET implicit $x10
89 ; CHECK-NEXT: bb.5.bb4:
90 ; CHECK-NEXT: [[C6:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
91 ; CHECK-NEXT: $x10 = COPY [[C6]](s64)
92 ; CHECK-NEXT: PseudoRET implicit $x10
94 ; CHECK-NEXT: bb.6.bb5:
95 ; CHECK-NEXT: [[C7:%[0-9]+]]:_(s64) = G_CONSTANT i64 100
96 ; CHECK-NEXT: $x10 = COPY [[C7]](s64)
97 ; CHECK-NEXT: PseudoRET implicit $x10
99 ; CHECK-NEXT: bb.7.bb6:
100 ; CHECK-NEXT: [[C8:%[0-9]+]]:_(s64) = G_CONSTANT i64 200
101 ; CHECK-NEXT: $x10 = COPY [[C8]](s64)
102 ; CHECK-NEXT: PseudoRET implicit $x10
104 ; CHECK-NEXT: bb.8.default:
105 ; CHECK-NEXT: [[C9:%[0-9]+]]:_(s64) = G_CONSTANT i64 1000
106 ; CHECK-NEXT: $x10 = COPY [[C9]](s64)
107 ; CHECK-NEXT: PseudoRET implicit $x10
109 successors: %bb.8, %bb.9
112 %1:_(s64) = COPY $x10
113 %2:_(s64) = G_ASSERT_SEXT %1, 32
114 %0:_(s32) = G_TRUNC %2(s64)
115 %7:_(s64) = G_CONSTANT i64 5
116 %3:_(s64) = G_SEXT %0(s32)
117 %4:_(s64) = G_CONSTANT i64 1
118 %5:_(s64) = G_SUB %3, %4
119 %9:_(s1) = G_ICMP intpred(ugt), %5(s64), %7
120 G_BRCOND %9(s1), %bb.8
123 successors: %bb.2, %bb.3, %bb.4, %bb.5, %bb.6, %bb.7
125 %10:_(p0) = G_JUMP_TABLE %jump-table.0
126 G_BRJT %10(p0), %jump-table.0, %5(s64)
129 %22:_(s64) = G_CONSTANT i64 4
131 PseudoRET implicit $x10
134 %20:_(s64) = G_CONSTANT i64 3
136 PseudoRET implicit $x10
139 %18:_(s64) = G_CONSTANT i64 2
141 PseudoRET implicit $x10
144 %16:_(s64) = G_CONSTANT i64 1
146 PseudoRET implicit $x10
149 %14:_(s64) = G_CONSTANT i64 100
151 PseudoRET implicit $x10
154 %12:_(s64) = G_CONSTANT i64 200
156 PseudoRET implicit $x10
159 %24:_(s64) = G_CONSTANT i64 1000
161 PseudoRET implicit $x10