1; RUN: llc -o - %s -mtriple=aarch64-none-linux-gnu -mattr=+force-32bit-jump-tables -aarch64-enable-atomic-cfg-tidy=0 | FileCheck %s 2; RUN: llc -o - %s -mtriple=aarch64-none-linux-gnu -mcpu=exynos-m3 -aarch64-enable-atomic-cfg-tidy=0 | FileCheck %s 3 4; Exynos doesn't want jump tables to be compressed for now. 5 6define i32 @test_jumptable(i32 %in) { 7 switch i32 %in, label %def [ 8 i32 0, label %lbl1 9 i32 1, label %lbl2 10 i32 2, label %lbl3 11 i32 4, label %lbl4 12 ] 13; CHECK-LABEL: test_jumptable: 14; CHECK: adrp [[JTPAGE:x[0-9]+]], .LJTI0_0 15; CHECK: add x[[JT:[0-9]+]], [[JTPAGE]], {{#?}}:lo12:.LJTI0_0 16; CHECK: [[PCREL_LBL:.Ltmp.*]]: 17; CHECK-NEXT: adr [[PCBASE:x[0-9]+]], [[PCREL_LBL]] 18; CHECK: ldrsw x[[OFFSET:[0-9]+]], [x[[JT]], {{x[0-9]+}}, lsl #2] 19; CHECK: add [[DEST:x[0-9]+]], [[PCBASE]], x[[OFFSET]] 20; CHECK: br [[DEST]] 21 22 23; CHECK: .LJTI0_0: 24; CHECK-NEXT: .word .LBB{{.*}}-[[PCREL_LBL]] 25 26def: 27 ret i32 0 28 29lbl1: 30 ret i32 1 31 32lbl2: 33 ret i32 2 34 35lbl3: 36 ret i32 4 37 38lbl4: 39 ret i32 8 40 41} 42 43define i32 @test_jumptable_minsize(i32 %in) minsize { 44 switch i32 %in, label %def [ 45 i32 0, label %lbl1 46 i32 1, label %lbl2 47 i32 2, label %lbl3 48 i32 4, label %lbl4 49 ] 50; CHECK-LABEL: test_jumptable_minsize: 51; CHECK: adrp [[JTPAGE:x[0-9]+]], .LJTI1_0 52; CHECK: add x[[JT:[0-9]+]], [[JTPAGE]], {{#?}}:lo12:.LJTI1_0 53; CHECK: adr [[PCBASE:x[0-9]+]], [[JTBASE:.LBB[0-9]+_[0-9]+]] 54; CHECK: ldrb w[[OFFSET:[0-9]+]], [x[[JT]], {{x[0-9]+}}] 55; CHECK: add [[DEST:x[0-9]+]], [[PCBASE]], x[[OFFSET]], lsl #2 56; CHECK: br [[DEST]] 57 58 59 60def: 61 ret i32 0 62 63lbl1: 64 ret i32 1 65 66lbl2: 67 ret i32 2 68 69lbl3: 70 ret i32 4 71 72lbl4: 73 ret i32 8 74 75} 76