1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=riscv64 -run-pass=regbankselect \
3 # RUN: -simplify-mir -verify-machineinstrs %s \
4 # RUN: -o - | FileCheck -check-prefix=RV64I %s
7 define i32 @jt_test(i32 signext %in) {
9 %0 = sext i32 %in to i64
10 switch i64 %0, label %default [
37 default: ; preds = %entry
45 tracksRegLiveness: true
50 blocks: [ '%bb.2', '%bb.3', '%bb.4', '%bb.5', '%bb.6', '%bb.7' ]
52 ; RV64I-LABEL: name: jt_test
54 ; RV64I-NEXT: liveins: $x10
56 ; RV64I-NEXT: [[COPY:%[0-9]+]]:gprb(s64) = COPY $x10
57 ; RV64I-NEXT: [[ASSERT_SEXT:%[0-9]+]]:gprb(s64) = G_ASSERT_SEXT [[COPY]], 32
58 ; RV64I-NEXT: [[C:%[0-9]+]]:gprb(s64) = G_CONSTANT i64 5
59 ; RV64I-NEXT: [[SEXT_INREG:%[0-9]+]]:gprb(s64) = G_SEXT_INREG [[ASSERT_SEXT]], 32
60 ; RV64I-NEXT: [[C1:%[0-9]+]]:gprb(s64) = G_CONSTANT i64 1
61 ; RV64I-NEXT: [[SUB:%[0-9]+]]:gprb(s64) = G_SUB [[SEXT_INREG]], [[C1]]
62 ; RV64I-NEXT: [[ICMP:%[0-9]+]]:gprb(s64) = G_ICMP intpred(ugt), [[SUB]](s64), [[C]]
63 ; RV64I-NEXT: G_BRCOND [[ICMP]](s64), %bb.8
65 ; RV64I-NEXT: bb.1.entry:
66 ; RV64I-NEXT: successors: %bb.2, %bb.3, %bb.4, %bb.5, %bb.6, %bb.7
68 ; RV64I-NEXT: [[JUMP_TABLE:%[0-9]+]]:gprb(p0) = G_JUMP_TABLE %jump-table.0
69 ; RV64I-NEXT: G_BRJT [[JUMP_TABLE]](p0), %jump-table.0, [[SUB]](s64)
71 ; RV64I-NEXT: bb.2.bb1:
72 ; RV64I-NEXT: [[C2:%[0-9]+]]:gprb(s64) = G_CONSTANT i64 4
73 ; RV64I-NEXT: $x10 = COPY [[C2]](s64)
74 ; RV64I-NEXT: PseudoRET implicit $x10
76 ; RV64I-NEXT: bb.3.bb2:
77 ; RV64I-NEXT: [[C3:%[0-9]+]]:gprb(s64) = G_CONSTANT i64 3
78 ; RV64I-NEXT: $x10 = COPY [[C3]](s64)
79 ; RV64I-NEXT: PseudoRET implicit $x10
81 ; RV64I-NEXT: bb.4.bb3:
82 ; RV64I-NEXT: [[C4:%[0-9]+]]:gprb(s64) = G_CONSTANT i64 2
83 ; RV64I-NEXT: $x10 = COPY [[C4]](s64)
84 ; RV64I-NEXT: PseudoRET implicit $x10
86 ; RV64I-NEXT: bb.5.bb4:
87 ; RV64I-NEXT: [[C5:%[0-9]+]]:gprb(s64) = G_CONSTANT i64 1
88 ; RV64I-NEXT: $x10 = COPY [[C5]](s64)
89 ; RV64I-NEXT: PseudoRET implicit $x10
91 ; RV64I-NEXT: bb.6.bb5:
92 ; RV64I-NEXT: [[C6:%[0-9]+]]:gprb(s64) = G_CONSTANT i64 100
93 ; RV64I-NEXT: $x10 = COPY [[C6]](s64)
94 ; RV64I-NEXT: PseudoRET implicit $x10
96 ; RV64I-NEXT: bb.7.bb6:
97 ; RV64I-NEXT: [[C7:%[0-9]+]]:gprb(s64) = G_CONSTANT i64 200
98 ; RV64I-NEXT: $x10 = COPY [[C7]](s64)
99 ; RV64I-NEXT: PseudoRET implicit $x10
101 ; RV64I-NEXT: bb.8.default:
102 ; RV64I-NEXT: [[C8:%[0-9]+]]:gprb(s64) = G_CONSTANT i64 1000
103 ; RV64I-NEXT: $x10 = COPY [[C8]](s64)
104 ; RV64I-NEXT: PseudoRET implicit $x10
106 successors: %bb.8, %bb.9
109 %1:_(s64) = COPY $x10
110 %2:_(s64) = G_ASSERT_SEXT %1, 32
111 %7:_(s64) = G_CONSTANT i64 5
112 %3:_(s64) = G_SEXT_INREG %2, 32
113 %4:_(s64) = G_CONSTANT i64 1
114 %5:_(s64) = G_SUB %3, %4
115 %26:_(s64) = G_ICMP intpred(ugt), %5(s64), %7
116 G_BRCOND %26(s64), %bb.8
119 successors: %bb.2, %bb.3, %bb.4, %bb.5, %bb.6, %bb.7
121 %10:_(p0) = G_JUMP_TABLE %jump-table.0
122 G_BRJT %10(p0), %jump-table.0, %5(s64)
125 %22:_(s64) = G_CONSTANT i64 4
127 PseudoRET implicit $x10
130 %20:_(s64) = G_CONSTANT i64 3
132 PseudoRET implicit $x10
135 %18:_(s64) = G_CONSTANT i64 2
137 PseudoRET implicit $x10
140 %16:_(s64) = G_CONSTANT i64 1
142 PseudoRET implicit $x10
145 %14:_(s64) = G_CONSTANT i64 100
147 PseudoRET implicit $x10
150 %12:_(s64) = G_CONSTANT i64 200
152 PseudoRET implicit $x10
155 %24:_(s64) = G_CONSTANT i64 1000
157 PseudoRET implicit $x10