1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=riscv32 -run-pass=instruction-select %s -o - \
3 # RUN: -relocation-model=pic | FileCheck %s
6 define i32 @jt_test(i32 signext %in) {
8 switch i32 %in, label %default [
35 default: ; preds = %entry
44 tracksRegLiveness: true
46 kind: label-difference32
49 blocks: [ '%bb.2', '%bb.3', '%bb.4', '%bb.5', '%bb.6', '%bb.7' ]
51 ; CHECK-LABEL: name: jt_test
53 ; CHECK-NEXT: successors: %bb.8(0x40000000), %bb.1(0x40000000)
54 ; CHECK-NEXT: liveins: $x10
56 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
57 ; CHECK-NEXT: [[ADDI:%[0-9]+]]:gpr = ADDI $x0, 5
58 ; CHECK-NEXT: [[ADDI1:%[0-9]+]]:gpr = ADDI $x0, 200
59 ; CHECK-NEXT: [[ADDI2:%[0-9]+]]:gpr = ADDI $x0, 100
60 ; CHECK-NEXT: [[ADDI3:%[0-9]+]]:gpr = ADDI $x0, 1
61 ; CHECK-NEXT: [[ADDI4:%[0-9]+]]:gpr = ADDI $x0, 2
62 ; CHECK-NEXT: [[ADDI5:%[0-9]+]]:gpr = ADDI $x0, 3
63 ; CHECK-NEXT: [[ADDI6:%[0-9]+]]:gpr = ADDI $x0, 4
64 ; CHECK-NEXT: [[ADDI7:%[0-9]+]]:gpr = ADDI $x0, 1000
65 ; CHECK-NEXT: [[ADDI8:%[0-9]+]]:gpr = ADDI [[COPY]], -1
66 ; CHECK-NEXT: BLTU [[ADDI]], [[ADDI8]], %bb.8
68 ; CHECK-NEXT: bb.1.entry:
69 ; CHECK-NEXT: successors: %bb.2(0x15555555), %bb.3(0x15555555), %bb.4(0x15555555), %bb.5(0x15555555), %bb.6(0x15555555), %bb.7(0x15555555)
71 ; CHECK-NEXT: [[PseudoLLA:%[0-9]+]]:gpr = PseudoLLA %jump-table.0
72 ; CHECK-NEXT: [[SLLI:%[0-9]+]]:gpr = SLLI [[ADDI8]], 2
73 ; CHECK-NEXT: [[ADD:%[0-9]+]]:gpr = ADD [[PseudoLLA]], [[SLLI]]
74 ; CHECK-NEXT: [[LW:%[0-9]+]]:gpr = LW [[ADD]], 0 :: (load (s32) from jump-table)
75 ; CHECK-NEXT: [[ADD1:%[0-9]+]]:gprjalr = ADD [[LW]], [[PseudoLLA]]
76 ; CHECK-NEXT: PseudoBRIND [[ADD1]], 0
78 ; CHECK-NEXT: bb.2.bb1:
79 ; CHECK-NEXT: $x10 = COPY [[ADDI6]]
80 ; CHECK-NEXT: PseudoRET implicit $x10
82 ; CHECK-NEXT: bb.3.bb2:
83 ; CHECK-NEXT: $x10 = COPY [[ADDI5]]
84 ; CHECK-NEXT: PseudoRET implicit $x10
86 ; CHECK-NEXT: bb.4.bb3:
87 ; CHECK-NEXT: $x10 = COPY [[ADDI4]]
88 ; CHECK-NEXT: PseudoRET implicit $x10
90 ; CHECK-NEXT: bb.5.bb4:
91 ; CHECK-NEXT: $x10 = COPY [[ADDI3]]
92 ; CHECK-NEXT: PseudoRET implicit $x10
94 ; CHECK-NEXT: bb.6.bb5:
95 ; CHECK-NEXT: $x10 = COPY [[ADDI2]]
96 ; CHECK-NEXT: PseudoRET implicit $x10
98 ; CHECK-NEXT: bb.7.bb6:
99 ; CHECK-NEXT: $x10 = COPY [[ADDI1]]
100 ; CHECK-NEXT: PseudoRET implicit $x10
102 ; CHECK-NEXT: bb.8.default:
103 ; CHECK-NEXT: $x10 = COPY [[ADDI7]]
104 ; CHECK-NEXT: PseudoRET implicit $x10
106 successors: %bb.8, %bb.9
109 %0:gprb(s32) = COPY $x10
110 %4:gprb(s32) = G_CONSTANT i32 5
111 %8:gprb(s32) = G_CONSTANT i32 200
112 %9:gprb(s32) = G_CONSTANT i32 100
113 %10:gprb(s32) = G_CONSTANT i32 1
114 %11:gprb(s32) = G_CONSTANT i32 2
115 %12:gprb(s32) = G_CONSTANT i32 3
116 %13:gprb(s32) = G_CONSTANT i32 4
117 %14:gprb(s32) = G_CONSTANT i32 1000
118 %1:gprb(s32) = G_CONSTANT i32 1
119 %2:gprb(s32) = G_SUB %0, %1
120 %16:gprb(s32) = G_ICMP intpred(ugt), %2(s32), %4
121 G_BRCOND %16(s32), %bb.8
124 successors: %bb.2, %bb.3, %bb.4, %bb.5, %bb.6, %bb.7
126 %7:gprb(p0) = G_JUMP_TABLE %jump-table.0
127 G_BRJT %7(p0), %jump-table.0, %2(s32)
131 PseudoRET implicit $x10
135 PseudoRET implicit $x10
139 PseudoRET implicit $x10
143 PseudoRET implicit $x10
147 PseudoRET implicit $x10
151 PseudoRET implicit $x10
155 PseudoRET implicit $x10