Home | History | Annotate | Download | only in AArch64
      1 ; RUN: llc %s -O2 -print-machineinstrs -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-machineinstrs -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
      3 ; RUN: llc %s -O2 -print-machineinstrs -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
      4 
      5 declare void @ext(i32)
      6 
      7 define i32 @jt2(i32 %a, i32 %b) {
      8 entry:
      9   switch i32 %a, label %return [
     10     i32 1, label %bb1
     11     i32 2, label %bb2
     12   ]
     13 ; CHECK-LABEL: function jt2:
     14 ; CHECK0-NEXT: Jump Tables:
     15 ; CHECK0-NEXT: %jump-table.0:
     16 ; CHECK0-NOT: %jump-table.1:
     17 ; CHECK4-NOT: Jump Tables:
     18 ; CHECK8-NOT: Jump Tables:
     19 
     20 bb1: tail call void @ext(i32 0) br label %return
     21 bb2: tail call void @ext(i32 2) br label %return
     22 
     23 return: ret i32 %b
     24 }
     25 
     26 define i32 @jt4(i32 %a, i32 %b) {
     27 entry:
     28   switch i32 %a, label %return [
     29     i32 1, label %bb1
     30     i32 2, label %bb2
     31     i32 3, label %bb3
     32     i32 4, label %bb4
     33   ]
     34 ; CHECK-LABEL: function jt4:
     35 ; CHECK0-NEXT: Jump Tables:
     36 ; CHECK0-NEXT: %jump-table.0:
     37 ; CHECK0-NOT: %jump-table.1:
     38 ; CHECK4-NEXT: Jump Tables:
     39 ; CHECK4-NEXT: %jump-table.0:
     40 ; CHECK4-NOT: %jump-table.1:
     41 ; CHECK8-NOT: Jump Tables:
     42 
     43 bb1: tail call void @ext(i32 0) br label %return
     44 bb2: tail call void @ext(i32 2) br label %return
     45 bb3: tail call void @ext(i32 4) br label %return
     46 bb4: tail call void @ext(i32 6) br label %return
     47 
     48 return: ret i32 %b
     49 }
     50 
     51 define i32 @jt8(i32 %a, i32 %b) {
     52 entry:
     53   switch i32 %a, label %return [
     54     i32 1, label %bb1
     55     i32 2, label %bb2
     56     i32 3, label %bb3
     57     i32 4, label %bb4
     58     i32 5, label %bb5
     59     i32 6, label %bb6
     60     i32 7, label %bb7
     61     i32 8, label %bb8
     62   ]
     63 ; CHECK-LABEL: function jt8:
     64 ; CHECK-NEXT: Jump Tables:
     65 ; CHECK-NEXT: %jump-table.0:
     66 ; CHECK-NOT: %jump-table.1:
     67 
     68 bb1: tail call void @ext(i32 0) br label %return
     69 bb2: tail call void @ext(i32 2) br label %return
     70 bb3: tail call void @ext(i32 4) br label %return
     71 bb4: tail call void @ext(i32 6) br label %return
     72 bb5: tail call void @ext(i32 8) br label %return
     73 bb6: tail call void @ext(i32 10) br label %return
     74 bb7: tail call void @ext(i32 12) br label %return
     75 bb8: tail call void @ext(i32 14) br label %return
     76 
     77 return: ret i32 %b
     78 }
     79 
     80