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 -mcpu=exynos-m1 -o /dev/null 2> %t; FileCheck %s --check-prefixes=CHECK,CHECKM1 < %t 5 ; 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 6 7 declare void @ext(i32) 8 9 define i32 @jt1(i32 %a, i32 %b) { 10 entry: 11 switch i32 %a, label %return [ 12 i32 1, label %bb1 13 i32 2, label %bb2 14 i32 3, label %bb3 15 i32 4, label %bb4 16 i32 5, label %bb5 17 i32 6, label %bb6 18 i32 7, label %bb7 19 i32 8, label %bb8 20 i32 9, label %bb9 21 i32 10, label %bb10 22 i32 11, label %bb11 23 i32 12, label %bb12 24 i32 13, label %bb13 25 i32 14, label %bb14 26 i32 15, label %bb15 27 i32 16, label %bb16 28 i32 17, label %bb17 29 ] 30 ; CHECK-LABEL: function jt1: 31 ; CHECK-NEXT: Jump Tables: 32 ; CHECK0-NEXT: %jump-table.0: 33 ; CHECK0-NOT: %jump-table.1: 34 ; CHECK4-NEXT: %jump-table.0: 35 ; CHECK4-SAME: %jump-table.1: 36 ; CHECK4-SAME: %jump-table.2: 37 ; CHECK4-SAME: %jump-table.3: 38 ; CHECK4-NOT: %jump-table.4: 39 ; CHECK8-NEXT: %jump-table.0: 40 ; CHECK8-SAME: %jump-table.1: 41 ; CHECK8-NOT: %jump-table.2: 42 ; CHECKM1-NEXT: %jump-table.0: 43 ; CHECKM1-SAME: %jump-table.1 44 ; CHECKM1-NOT: %jump-table.2: 45 ; CHECKM3-NEXT: %jump-table.0: 46 ; CHECKM3-NOT: %jump-table.1: 47 48 bb1: tail call void @ext(i32 0) br label %return 49 bb2: tail call void @ext(i32 2) br label %return 50 bb3: tail call void @ext(i32 4) br label %return 51 bb4: tail call void @ext(i32 6) br label %return 52 bb5: tail call void @ext(i32 8) br label %return 53 bb6: tail call void @ext(i32 10) br label %return 54 bb7: tail call void @ext(i32 12) br label %return 55 bb8: tail call void @ext(i32 14) br label %return 56 bb9: tail call void @ext(i32 16) br label %return 57 bb10: tail call void @ext(i32 18) br label %return 58 bb11: tail call void @ext(i32 20) br label %return 59 bb12: tail call void @ext(i32 22) br label %return 60 bb13: tail call void @ext(i32 24) br label %return 61 bb14: tail call void @ext(i32 26) br label %return 62 bb15: tail call void @ext(i32 28) br label %return 63 bb16: tail call void @ext(i32 30) br label %return 64 bb17: tail call void @ext(i32 32) br label %return 65 66 return: ret i32 %b 67 } 68 69 define void @jt2(i32 %x) { 70 entry: 71 switch i32 %x, label %return [ 72 i32 1, label %bb1 73 i32 2, label %bb2 74 i32 3, label %bb3 75 i32 4, label %bb4 76 77 i32 14, label %bb5 78 i32 15, label %bb6 79 ] 80 ; CHECK-LABEL: function jt2: 81 ; CHECK-NEXT: Jump Tables: 82 ; 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{{$}} 83 ; CHECK0-NOT: %jump-table.1 84 ; CHECK4-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4{{$}} 85 ; CHECK4-NOT: %jump-table.1 86 ; CHECK8-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4{{$}} 87 ; CHECK8-NOT: %jump-table.1 88 ; CHECKM1-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4{{$}} 89 ; CHECKM1-NOT: %jump-table.1 90 ; 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{{$}} 91 ; CHECKM3-NOT: %jump-table.1 92 ; CHECK-DAG: End machine code for function jt2. 93 94 bb1: tail call void @ext(i32 1) br label %return 95 bb2: tail call void @ext(i32 2) br label %return 96 bb3: tail call void @ext(i32 3) br label %return 97 bb4: tail call void @ext(i32 4) br label %return 98 bb5: tail call void @ext(i32 5) br label %return 99 bb6: tail call void @ext(i32 6) br label %return 100 return: ret void 101 } 102