1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=riscv32 -run-pass=regbankselect \
3 # RUN: -simplify-mir -verify-machineinstrs %s \
4 # RUN: -o - | FileCheck -check-prefix=RV32I %s
7 define i32 @jt_test(i32 signext %in) {
9 switch i32 %in, label %default [
36 default: ; preds = %entry
44 tracksRegLiveness: true
49 blocks: [ '%bb.2', '%bb.3', '%bb.4', '%bb.5', '%bb.6', '%bb.7' ]
51 ; RV32I-LABEL: name: jt_test
53 ; RV32I-NEXT: liveins: $x10
55 ; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s32) = COPY $x10
56 ; RV32I-NEXT: [[C:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 5
57 ; RV32I-NEXT: [[C1:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 200
58 ; RV32I-NEXT: [[C2:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 100
59 ; RV32I-NEXT: [[C3:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 1
60 ; RV32I-NEXT: [[C4:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 2
61 ; RV32I-NEXT: [[C5:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 3
62 ; RV32I-NEXT: [[C6:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 4
63 ; RV32I-NEXT: [[C7:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 1000
64 ; RV32I-NEXT: [[C8:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 1
65 ; RV32I-NEXT: [[SUB:%[0-9]+]]:gprb(s32) = G_SUB [[COPY]], [[C8]]
66 ; RV32I-NEXT: [[ICMP:%[0-9]+]]:gprb(s32) = G_ICMP intpred(ugt), [[SUB]](s32), [[C]]
67 ; RV32I-NEXT: G_BRCOND [[ICMP]](s32), %bb.8
69 ; RV32I-NEXT: bb.1.entry:
70 ; RV32I-NEXT: successors: %bb.2, %bb.3, %bb.4, %bb.5, %bb.6, %bb.7
72 ; RV32I-NEXT: [[JUMP_TABLE:%[0-9]+]]:gprb(p0) = G_JUMP_TABLE %jump-table.0
73 ; RV32I-NEXT: G_BRJT [[JUMP_TABLE]](p0), %jump-table.0, [[SUB]](s32)
75 ; RV32I-NEXT: bb.2.bb1:
76 ; RV32I-NEXT: $x10 = COPY [[C6]](s32)
77 ; RV32I-NEXT: PseudoRET implicit $x10
79 ; RV32I-NEXT: bb.3.bb2:
80 ; RV32I-NEXT: $x10 = COPY [[C5]](s32)
81 ; RV32I-NEXT: PseudoRET implicit $x10
83 ; RV32I-NEXT: bb.4.bb3:
84 ; RV32I-NEXT: $x10 = COPY [[C4]](s32)
85 ; RV32I-NEXT: PseudoRET implicit $x10
87 ; RV32I-NEXT: bb.5.bb4:
88 ; RV32I-NEXT: $x10 = COPY [[C3]](s32)
89 ; RV32I-NEXT: PseudoRET implicit $x10
91 ; RV32I-NEXT: bb.6.bb5:
92 ; RV32I-NEXT: $x10 = COPY [[C2]](s32)
93 ; RV32I-NEXT: PseudoRET implicit $x10
95 ; RV32I-NEXT: bb.7.bb6:
96 ; RV32I-NEXT: $x10 = COPY [[C1]](s32)
97 ; RV32I-NEXT: PseudoRET implicit $x10
99 ; RV32I-NEXT: bb.8.default:
100 ; RV32I-NEXT: $x10 = COPY [[C7]](s32)
101 ; RV32I-NEXT: PseudoRET implicit $x10
103 successors: %bb.8, %bb.9
106 %0:_(s32) = COPY $x10
107 %4:_(s32) = G_CONSTANT i32 5
108 %8:_(s32) = G_CONSTANT i32 200
109 %9:_(s32) = G_CONSTANT i32 100
110 %10:_(s32) = G_CONSTANT i32 1
111 %11:_(s32) = G_CONSTANT i32 2
112 %12:_(s32) = G_CONSTANT i32 3
113 %13:_(s32) = G_CONSTANT i32 4
114 %14:_(s32) = G_CONSTANT i32 1000
115 %1:_(s32) = G_CONSTANT i32 1
116 %2:_(s32) = G_SUB %0, %1
117 %16:_(s32) = G_ICMP intpred(ugt), %2(s32), %4
118 G_BRCOND %16(s32), %bb.8
121 successors: %bb.2, %bb.3, %bb.4, %bb.5, %bb.6, %bb.7
123 %7:_(p0) = G_JUMP_TABLE %jump-table.0
124 G_BRJT %7(p0), %jump-table.0, %2(s32)
128 PseudoRET implicit $x10
132 PseudoRET implicit $x10
136 PseudoRET implicit $x10
140 PseudoRET implicit $x10
144 PseudoRET implicit $x10
148 PseudoRET implicit $x10
152 PseudoRET implicit $x10