1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=riscv32 -run-pass=legalizer %s -o - \
3 # RUN: -code-model=small | FileCheck %s
4 # RUN: llc -mtriple=riscv32 -run-pass=legalizer %s -o - \
5 # RUN: -code-model=medium | FileCheck %s
8 define i32 @jt_test(i32 signext %in) {
10 switch i32 %in, label %default [
37 default: ; preds = %entry
44 tracksRegLiveness: true
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]+]]:_(s32) = COPY $x10
57 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 5
58 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 200
59 ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 100
60 ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
61 ; CHECK-NEXT: [[C4:%[0-9]+]]:_(s32) = G_CONSTANT i32 2
62 ; CHECK-NEXT: [[C5:%[0-9]+]]:_(s32) = G_CONSTANT i32 3
63 ; CHECK-NEXT: [[C6:%[0-9]+]]:_(s32) = G_CONSTANT i32 4
64 ; CHECK-NEXT: [[C7:%[0-9]+]]:_(s32) = G_CONSTANT i32 1000
65 ; CHECK-NEXT: [[C8:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
66 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[COPY]], [[C8]]
67 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ugt), [[SUB]](s32), [[C]]
68 ; CHECK-NEXT: G_BRCOND [[ICMP]](s32), %bb.8
70 ; CHECK-NEXT: bb.1.entry:
71 ; CHECK-NEXT: successors: %bb.2(0x15555555), %bb.3(0x15555555), %bb.4(0x15555555), %bb.5(0x15555555), %bb.6(0x15555555), %bb.7(0x15555555)
73 ; CHECK-NEXT: [[JUMP_TABLE:%[0-9]+]]:_(p0) = G_JUMP_TABLE %jump-table.0
74 ; CHECK-NEXT: [[C9:%[0-9]+]]:_(s32) = G_CONSTANT i32 2
75 ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[SUB]], [[C9]](s32)
76 ; CHECK-NEXT: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[JUMP_TABLE]], [[SHL]](s32)
77 ; CHECK-NEXT: [[LOAD:%[0-9]+]]:_(p0) = G_LOAD [[PTR_ADD]](p0) :: (load (s32) from jump-table)
78 ; CHECK-NEXT: G_BRINDIRECT [[LOAD]](p0)
80 ; CHECK-NEXT: bb.2.bb1:
81 ; CHECK-NEXT: $x10 = COPY [[C6]](s32)
82 ; CHECK-NEXT: PseudoRET implicit $x10
84 ; CHECK-NEXT: bb.3.bb2:
85 ; CHECK-NEXT: $x10 = COPY [[C5]](s32)
86 ; CHECK-NEXT: PseudoRET implicit $x10
88 ; CHECK-NEXT: bb.4.bb3:
89 ; CHECK-NEXT: $x10 = COPY [[C4]](s32)
90 ; CHECK-NEXT: PseudoRET implicit $x10
92 ; CHECK-NEXT: bb.5.bb4:
93 ; CHECK-NEXT: $x10 = COPY [[C3]](s32)
94 ; CHECK-NEXT: PseudoRET implicit $x10
96 ; CHECK-NEXT: bb.6.bb5:
97 ; CHECK-NEXT: $x10 = COPY [[C2]](s32)
98 ; CHECK-NEXT: PseudoRET implicit $x10
100 ; CHECK-NEXT: bb.7.bb6:
101 ; CHECK-NEXT: $x10 = COPY [[C1]](s32)
102 ; CHECK-NEXT: PseudoRET implicit $x10
104 ; CHECK-NEXT: bb.8.default:
105 ; CHECK-NEXT: $x10 = COPY [[C7]](s32)
106 ; CHECK-NEXT: PseudoRET implicit $x10
108 successors: %bb.8, %bb.9
111 %0:_(s32) = COPY $x10
112 %4:_(s32) = G_CONSTANT i32 5
113 %8:_(s32) = G_CONSTANT i32 200
114 %9:_(s32) = G_CONSTANT i32 100
115 %10:_(s32) = G_CONSTANT i32 1
116 %11:_(s32) = G_CONSTANT i32 2
117 %12:_(s32) = G_CONSTANT i32 3
118 %13:_(s32) = G_CONSTANT i32 4
119 %14:_(s32) = G_CONSTANT i32 1000
120 %1:_(s32) = G_CONSTANT i32 1
121 %2:_(s32) = G_SUB %0, %1
122 %6:_(s1) = G_ICMP intpred(ugt), %2(s32), %4
123 G_BRCOND %6(s1), %bb.8
126 successors: %bb.2, %bb.3, %bb.4, %bb.5, %bb.6, %bb.7
128 %7:_(p0) = G_JUMP_TABLE %jump-table.0
129 G_BRJT %7(p0), %jump-table.0, %2(s32)
133 PseudoRET implicit $x10
137 PseudoRET implicit $x10
141 PseudoRET implicit $x10
145 PseudoRET implicit $x10
149 PseudoRET implicit $x10
153 PseudoRET implicit $x10
157 PseudoRET implicit $x10