1 ; RUN: llc %s -O2 -print-machineinstrs -mtriple=aarch64-linux-gnu -jump-table-density=40 -o /dev/null 2> %t; FileCheck %s --check-prefixes=CHECK,CHECK0 < %t
2 ; RUN: llc %s -O2 -print-machineinstrs -mtriple=aarch64-linux-gnu -jump-table-density=40 -max-jump-table-size=4 -o /dev/null 2> %t; FileCheck %s --check-prefixes=CHECK,CHECK4 < %t
3 ; RUN: llc %s -O2 -print-machineinstrs -mtriple=aarch64-linux-gnu -jump-table-density=40 -max-jump-table-size=8 -o /dev/null 2> %t; FileCheck %s --check-prefixes=CHECK,CHECK8 < %t
4 ; RUN: llc %s -O2 -print-machineinstrs -mtriple=aarch64-linux-gnu -jump-table-density=40 -max-jump-table-size=16 -o /dev/null 2> %t; FileCheck %s --check-prefixes=CHECK,CHECK16 < %t
5 ; RUN: llc %s -O2 -print-machineinstrs -mtriple=aarch64-linux-gnu -jump-table-density=40 -mcpu=exynos-m1 -o /dev/null 2> %t; FileCheck %s --check-prefixes=CHECK,CHECKM1 < %t
6 ; RUN: llc %s -O2 -print-machineinstrs -mtriple=aarch64-linux-gnu -jump-table-density=40 -mcpu=exynos-m3 -o /dev/null 2> %t; FileCheck %s --check-prefixes=CHECK,CHECKM3 < %t
8 declare void @ext(i32, i32)
10 define i32 @jt1(i32 %a, i32 %b) {
12 switch i32 %a, label %return [
31 ; CHECK-LABEL: function jt1:
32 ; CHECK-NEXT: Jump Tables:
33 ; CHECK0-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4 %bb.5 %bb.6 %bb.7 %bb.8 %bb.9 %bb.10 %bb.11 %bb.12 %bb.13 %bb.14 %bb.15 %bb.16 %bb.17
34 ; CHECK0-NOT: %jump-table.1:
35 ; CHECK4-NEXT: %jump-table.0: %bb.2 %bb.3 %bb.4 %bb.5
36 ; CHECK4-NEXT: %jump-table.1: %bb.6 %bb.7 %bb.8 %bb.9
37 ; CHECK4-NEXT: %jump-table.2: %bb.10 %bb.11 %bb.12 %bb.13
38 ; CHECK4-NEXT: %jump-table.3: %bb.14 %bb.15 %bb.16 %bb.17
39 ; CHECK4-NOT: %jump-table.4:
40 ; CHECK8-NEXT: %jump-table.0: %bb.2 %bb.3 %bb.4 %bb.5 %bb.6 %bb.7 %bb.8 %bb.9
41 ; CHECK8-NEXT: %jump-table.1: %bb.10 %bb.11 %bb.12 %bb.13 %bb.14 %bb.15 %bb.16 %bb.17
42 ; CHECK8-NOT: %jump-table.2:
43 ; CHECK16-NEXT: %jump-table.0: %bb.2 %bb.3 %bb.4 %bb.5 %bb.6 %bb.7 %bb.8 %bb.9 %bb.10 %bb.11 %bb.12 %bb.13 %bb.14 %bb.15 %bb.16 %bb.17
44 ; CHECK16-NOT: %jump-table.1:
45 ; CHECKM1-NEXT: %jump-table.0: %bb.2 %bb.3 %bb.4 %bb.5 %bb.6 %bb.7 %bb.8 %bb.9
46 ; CHECKM1-NEXT: %jump-table.1: %bb.10 %bb.11 %bb.12 %bb.13 %bb.14 %bb.15 %bb.16 %bb.17
47 ; CHECKM1-NOT: %jump-table.2:
48 ; CHECKM3-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4 %bb.5 %bb.6 %bb.7 %bb.8 %bb.9 %bb.10 %bb.11 %bb.12 %bb.13 %bb.14 %bb.15 %bb.16 %bb.17
49 ; CHECKM3-NOT: %jump-table.1:
51 bb1: tail call void @ext(i32 1, i32 0) br label %return
52 bb2: tail call void @ext(i32 2, i32 2) br label %return
53 bb3: tail call void @ext(i32 3, i32 4) br label %return
54 bb4: tail call void @ext(i32 4, i32 6) br label %return
55 bb5: tail call void @ext(i32 5, i32 8) br label %return
56 bb6: tail call void @ext(i32 6, i32 10) br label %return
57 bb7: tail call void @ext(i32 7, i32 12) br label %return
58 bb8: tail call void @ext(i32 8, i32 14) br label %return
59 bb9: tail call void @ext(i32 9, i32 16) br label %return
60 bb10: tail call void @ext(i32 1, i32 18) br label %return
61 bb11: tail call void @ext(i32 2, i32 20) br label %return
62 bb12: tail call void @ext(i32 3, i32 22) br label %return
63 bb13: tail call void @ext(i32 4, i32 24) br label %return
64 bb14: tail call void @ext(i32 5, i32 26) br label %return
65 bb15: tail call void @ext(i32 6, i32 28) br label %return
66 bb16: tail call void @ext(i32 7, i32 30) br label %return
67 bb17: tail call void @ext(i32 8, i32 32) br label %return
72 define void @jt2(i32 %x) {
74 switch i32 %x, label %return [
83 ; CHECK-LABEL: function jt2:
84 ; CHECK-NEXT: Jump Tables:
85 ; CHECK0-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4 %bb.7 %bb.7 %bb.7 %bb.7 %bb.7 %bb.7 %bb.7 %bb.7 %bb.7 %bb.5 %bb.6{{$}}
86 ; CHECK0-NOT: %jump-table.1:
87 ; CHECK4-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4{{$}}
88 ; CHECK4-NOT: %jump-table.1:
89 ; CHECK8-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4{{$}}
90 ; CHECK8-NOT: %jump-table.1:
91 ; CHECK16-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4 %bb.7 %bb.7 %bb.7 %bb.7 %bb.7 %bb.7 %bb.7 %bb.7 %bb.7 %bb.5 %bb.6{{$}}
92 ; CHECK16-NOT: %jump-table.1:
93 ; CHECKM1-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4{{$}}
94 ; CHECKM1-NOT: %jump-table.1:
95 ; CHECKM3-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4 %bb.7 %bb.7 %bb.7 %bb.7 %bb.7 %bb.7 %bb.7 %bb.7 %bb.7 %bb.5 %bb.6{{$}}
96 ; CHECKM3-NOT: %jump-table.1:
97 ; CHECK-DAG: End machine code for function jt2.
99 bb1: tail call void @ext(i32 6, i32 1) br label %return
100 bb2: tail call void @ext(i32 5, i32 2) br label %return
101 bb3: tail call void @ext(i32 4, i32 3) br label %return
102 bb4: tail call void @ext(i32 3, i32 4) br label %return
103 bb5: tail call void @ext(i32 2, i32 5) br label %return
104 bb6: tail call void @ext(i32 1, i32 6) br label %return
108 define void @jt3(i32 %x) {
110 switch i32 %x, label %return [
127 ; CHECK-LABEL: function jt3:
128 ; CHECK-NEXT: Jump Tables:
129 ; CHECK0-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.5 %bb.6 %bb.7 %bb.8 %bb.13 %bb.9 %bb.10 %bb.13 %bb.11 %bb.12
130 ; CHECK0-NOT: %jump-table.1:
131 ; CHECK4-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4
132 ; CHECK4-NEXT: %jump-table.1: %bb.5 %bb.6 %bb.7 %bb.8
133 ; CHECK4-NOT: %jump-table.2:
134 ; CHECK8-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4
135 ; CHECK8-NEXT: %jump-table.1: %bb.5 %bb.6 %bb.7 %bb.8 %bb.13 %bb.9 %bb.10
136 ; CHECK8-NOT: %jump-table.2:
137 ; CHECK16-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.5 %bb.6 %bb.7
138 ; CHECK16-NEXT: %jump-table.1: %bb.8 %bb.13 %bb.9 %bb.10 %bb.13 %bb.11 %bb.12
139 ; CHECK16-NOT: %jump-table.2:
140 ; CHECKM1-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4
141 ; CHECKM1-NEXT: %jump-table.1: %bb.5 %bb.6 %bb.7 %bb.8 %bb.13 %bb.9 %bb.10
142 ; CHECKM1-NOT: %jump-table.2:
143 ; CHECKM3-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.5 %bb.6 %bb.7 %bb.8 %bb.13 %bb.9 %bb.10
144 ; CHECKM3-NOT: %jump-table.1:
145 ; CHECK-DAG: End machine code for function jt3.
147 bb1: tail call void @ext(i32 1, i32 12) br label %return
148 bb2: tail call void @ext(i32 2, i32 11) br label %return
149 bb3: tail call void @ext(i32 3, i32 10) br label %return
150 bb4: tail call void @ext(i32 4, i32 9) br label %return
151 bb5: tail call void @ext(i32 5, i32 8) br label %return
152 bb6: tail call void @ext(i32 6, i32 7) br label %return
153 bb7: tail call void @ext(i32 7, i32 6) br label %return
154 bb8: tail call void @ext(i32 8, i32 5) br label %return
155 bb9: tail call void @ext(i32 9, i32 4) br label %return
156 bb10: tail call void @ext(i32 10, i32 3) br label %return
157 bb11: tail call void @ext(i32 11, i32 2) br label %return
158 bb12: tail call void @ext(i32 12, i32 1) br label %return
163 define void @jt4(i32 %x) {
165 switch i32 %x, label %default [
182 ; CHECK-LABEL: function jt4:
183 ; CHECK-NEXT: Jump Tables:
184 ; CHECK0-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.5 %bb.6 %bb.7 %bb.8 %bb.13 %bb.9 %bb.10 %bb.13 %bb.11 %bb.12
185 ; CHECK0-NOT: %jump-table.1:
186 ; CHECK4-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4
187 ; CHECK4-NEXT: %jump-table.1: %bb.5 %bb.6 %bb.7 %bb.8
188 ; CHECK4-NOT: %jump-table.2:
189 ; CHECK8-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4
190 ; CHECK8-NEXT: %jump-table.1: %bb.5 %bb.6 %bb.7 %bb.8 %bb.13 %bb.9 %bb.10
191 ; CHECK8-NOT: %jump-table.2:
192 ; CHECK16-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.5 %bb.6 %bb.7
193 ; CHECK16-NEXT: %jump-table.1: %bb.8 %bb.13 %bb.9 %bb.10 %bb.13 %bb.11 %bb.12
194 ; CHECK16-NOT: %jump-table.2:
195 ; CHECKM1-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4
196 ; CHECKM1-NEXT: %jump-table.1: %bb.5 %bb.6 %bb.7 %bb.8 %bb.13 %bb.9 %bb.10
197 ; CHECKM1-NOT: %jump-table.2:
198 ; CHECKM3-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.5 %bb.6 %bb.7 %bb.8 %bb.13 %bb.9 %bb.10
199 ; CHECKM3-NOT: %jump-table.1:
200 ; CHECK-DAG: End machine code for function jt4.
202 bb1: tail call void @ext(i32 1, i32 12) br label %return
203 bb2: tail call void @ext(i32 2, i32 11) br label %return
204 bb3: tail call void @ext(i32 3, i32 10) br label %return
205 bb4: tail call void @ext(i32 4, i32 9) br label %return
206 bb5: tail call void @ext(i32 5, i32 8) br label %return
207 bb6: tail call void @ext(i32 6, i32 7) br label %return
208 bb7: tail call void @ext(i32 7, i32 6) br label %return
209 bb8: tail call void @ext(i32 8, i32 5) br label %return
210 bb9: tail call void @ext(i32 9, i32 4) br label %return
211 bb10: tail call void @ext(i32 10, i32 3) br label %return
212 bb11: tail call void @ext(i32 11, i32 2) br label %return
213 bb12: tail call void @ext(i32 12, i32 1) br label %return