• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc %s -O2 -print-after-isel -mtriple=aarch64-linux-gnu -jump-table-density=40 -min-jump-table-entries=0 -o /dev/null 2> %t; FileCheck %s --check-prefixes=CHECK,CHECK0  < %t
2; RUN: llc %s -O2 -print-after-isel -mtriple=aarch64-linux-gnu -jump-table-density=40 -min-jump-table-entries=2 -o /dev/null 2> %t; FileCheck %s --check-prefixes=CHECK,CHECK2  < %t
3; RUN: llc %s -O2 -print-after-isel -mtriple=aarch64-linux-gnu -jump-table-density=40 -min-jump-table-entries=4 -o /dev/null 2> %t; FileCheck %s --check-prefixes=CHECK,CHECK4  < %t
4; RUN: llc %s -O2 -print-after-isel -mtriple=aarch64-linux-gnu -jump-table-density=40 -min-jump-table-entries=8 -o /dev/null 2> %t; FileCheck %s --check-prefixes=CHECK,CHECK8  < %t
5
6declare void @ext(i32, i32)
7
8define i32 @jt2(i32 %a, i32 %b) {
9entry:
10  switch i32 %a, label %return [
11    i32 1, label %bb1
12    i32 3, label %bb2
13  ]
14; CHECK-LABEL: function jt2:
15; CHECK0-NEXT: Jump Tables:
16; CHECK2-NEXT: Jump Tables:
17; CHECK4-NOT: {{^}}Jump Tables:
18; CHECK8-NOT: {{^}}Jump Tables:
19
20bb1: tail call void @ext(i32 1, i32 0) br label %return
21bb2: tail call void @ext(i32 2, i32 2) br label %return
22
23return: ret i32 %b
24}
25
26define i32 @jt4(i32 %a, i32 %b) {
27entry:
28  switch i32 %a, label %return [
29    i32 1, label %bb1
30    i32 2, label %bb2
31    i32 3, label %bb3
32    i32 5, label %bb4
33  ]
34; CHECK-LABEL: function jt4:
35; CHECK0-NEXT: Jump Tables:
36; CHECK2-NEXT: Jump Tables:
37; CHECK4-NEXT: Jump Tables:
38; CHECK8-NOT: {{^}}Jump Tables:
39
40bb1: tail call void @ext(i32 1, i32 0) br label %return
41bb2: tail call void @ext(i32 3, i32 2) br label %return
42bb3: tail call void @ext(i32 4, i32 4) br label %return
43bb4: tail call void @ext(i32 5, i32 6) br label %return
44
45return: ret i32 %b
46}
47
48define i32 @jt8(i32 %a, i32 %b) {
49entry:
50  switch i32 %a, label %return [
51    i32 1, label %bb1
52    i32 2, label %bb2
53    i32 3, label %bb3
54    i32 4, label %bb4
55    i32 5, label %bb5
56    i32 6, label %bb6
57    i32 7, label %bb7
58    i32 9, label %bb8
59  ]
60; CHECK-LABEL: function jt8:
61; CHECK-NEXT: Jump Tables:
62
63bb1: tail call void @ext(i32 1, i32 0) br label %return
64bb2: tail call void @ext(i32 2, i32 2) br label %return
65bb3: tail call void @ext(i32 3, i32 4) br label %return
66bb4: tail call void @ext(i32 4, i32 6) br label %return
67bb5: tail call void @ext(i32 5, i32 8) br label %return
68bb6: tail call void @ext(i32 6, i32 10) br label %return
69bb7: tail call void @ext(i32 7, i32 12) br label %return
70bb8: tail call void @ext(i32 8, i32 14) br label %return
71
72return: ret i32 %b
73}
74