1 ; RUN: rm -rf %t && split-file %s %t
5 ; RUN: not --crash llc %t/err1.ll -mtriple=aarch64-elf \
6 ; RUN: -aarch64-min-jump-table-entries=1 -aarch64-enable-atomic-cfg-tidy=0 \
7 ; RUN: -code-model=large \
8 ; RUN: -o - -verify-machineinstrs 2>&1 | FileCheck %s --check-prefix=ERR1
10 ; RUN: not --crash llc %t/err1.ll -mtriple=aarch64-elf \
11 ; RUN: -aarch64-min-jump-table-entries=1 -aarch64-enable-atomic-cfg-tidy=0 \
12 ; RUN: -global-isel -global-isel-abort=1 \
13 ; RUN: -code-model=large \
14 ; RUN: -o - -verify-machineinstrs 2>&1 | FileCheck %s --check-prefix=ERR1
16 ; ERR1: LLVM ERROR: Unsupported code-model for hardened jump-table
17 define i32 @test_jumptable(i32 %in) "aarch64-jump-table-hardening" {
19 switch i32 %in, label %def [
36 ; RUN: llc %t/test.ll -mtriple=arm64-apple-darwin -aarch64-enable-collect-loh=0 \
37 ; RUN: -aarch64-min-jump-table-entries=1 -aarch64-enable-atomic-cfg-tidy=0 \
38 ; RUN: -o - -verify-machineinstrs | FileCheck %s --check-prefix=MACHO
40 ; RUN: llc %t/test.ll -mtriple=arm64-apple-darwin -aarch64-enable-collect-loh=0 \
41 ; RUN: -aarch64-min-jump-table-entries=1 -aarch64-enable-atomic-cfg-tidy=0 \
42 ; RUN: -global-isel -global-isel-abort=1 \
43 ; RUN: -o - -verify-machineinstrs | FileCheck %s --check-prefix=MACHO
45 ; RUN: llc %t/test.ll -mtriple=arm64-apple-darwin -aarch64-enable-collect-loh=0 \
46 ; RUN: -aarch64-min-jump-table-entries=1 -aarch64-enable-atomic-cfg-tidy=0 \
47 ; RUN: -code-model=large \
48 ; RUN: -o - -verify-machineinstrs | FileCheck %s --check-prefix=MACHO
50 ; RUN: llc %t/test.ll -mtriple=arm64-apple-darwin -aarch64-enable-collect-loh=0 \
51 ; RUN: -aarch64-min-jump-table-entries=1 -aarch64-enable-atomic-cfg-tidy=0 \
52 ; RUN: -global-isel -global-isel-abort=1 \
53 ; RUN: -code-model=large \
54 ; RUN: -o - -verify-machineinstrs | FileCheck %s --check-prefix=MACHO
56 ; RUN: llc %t/test.ll -mtriple=aarch64-elf \
57 ; RUN: -aarch64-min-jump-table-entries=1 -aarch64-enable-atomic-cfg-tidy=0 \
58 ; RUN: -o - -verify-machineinstrs | FileCheck %s --check-prefix=ELF
60 ; RUN: llc %t/test.ll -mtriple=aarch64-elf \
61 ; RUN: -aarch64-min-jump-table-entries=1 -aarch64-enable-atomic-cfg-tidy=0 \
62 ; RUN: -global-isel -global-isel-abort=1 \
63 ; RUN: -o - -verify-machineinstrs | FileCheck %s --check-prefix=ELF
65 ; MACHO-LABEL: test_jumptable:
68 ; MACHO: csel x16, x16, xzr, ls
69 ; MACHO-NEXT: adrp x17, LJTI0_0@PAGE
70 ; MACHO-NEXT: add x17, x17, LJTI0_0@PAGEOFF
71 ; MACHO-NEXT: ldrsw x16, [x17, x16, lsl #2]
73 ; MACHO-NEXT: adr x17, Ltmp0
74 ; MACHO-NEXT: add x16, x17, x16
77 ; ELF-LABEL: test_jumptable:
80 ; ELF: csel x16, x16, xzr, ls
81 ; ELF-NEXT: adrp x17, .LJTI0_0
82 ; ELF-NEXT: add x17, x17, :lo12:.LJTI0_0
83 ; ELF-NEXT: ldrsw x16, [x17, x16, lsl #2]
85 ; ELF-NEXT: adr x17, .Ltmp0
86 ; ELF-NEXT: add x16, x17, x16
89 define i32 @test_jumptable(i32 %in) "aarch64-jump-table-hardening" {
91 switch i32 %in, label %def [
119 ; MACHO-LABEL: LJTI0_0:
120 ; MACHO-NEXT: .long LBB{{[0-9_]+}}-Ltmp0
121 ; MACHO-NEXT: .long LBB{{[0-9_]+}}-Ltmp0
122 ; MACHO-NEXT: .long LBB{{[0-9_]+}}-Ltmp0
123 ; MACHO-NEXT: .long LBB{{[0-9_]+}}-Ltmp0
124 ; MACHO-NEXT: .long LBB{{[0-9_]+}}-Ltmp0
125 ; MACHO-NEXT: .long LBB{{[0-9_]+}}-Ltmp0
127 ; ELF-LABEL: .LJTI0_0:
128 ; ELF-NEXT: .word .LBB{{[0-9_]+}}-.Ltmp0
129 ; ELF-NEXT: .word .LBB{{[0-9_]+}}-.Ltmp0
130 ; ELF-NEXT: .word .LBB{{[0-9_]+}}-.Ltmp0
131 ; ELF-NEXT: .word .LBB{{[0-9_]+}}-.Ltmp0
132 ; ELF-NEXT: .word .LBB{{[0-9_]+}}-.Ltmp0
133 ; ELF-NEXT: .word .LBB{{[0-9_]+}}-.Ltmp0