134 lines · plain
1; RUN: rm -rf %t && split-file %s %t2 3;--- err1.ll4 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=ERR19 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=ERR115 16; ERR1: LLVM ERROR: Unsupported code-model for hardened jump-table17define i32 @test_jumptable(i32 %in) "aarch64-jump-table-hardening" {18 19 switch i32 %in, label %def [20 i32 0, label %lbl121 i32 1, label %lbl222 ]23 24def:25 ret i32 026 27lbl1:28 ret i32 129 30lbl2:31 ret i32 232}33 34;--- test.ll35 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=MACHO39 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=MACHO44 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=MACHO49 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=MACHO55 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=ELF59 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=ELF64 65; MACHO-LABEL: test_jumptable:66; MACHO: mov w16, w067; MACHO: cmp x16, #568; MACHO: csel x16, x16, xzr, ls69; MACHO-NEXT: adrp x17, LJTI0_0@PAGE70; MACHO-NEXT: add x17, x17, LJTI0_0@PAGEOFF71; MACHO-NEXT: ldrsw x16, [x17, x16, lsl #2]72; MACHO-NEXT: Ltmp0:73; MACHO-NEXT: adr x17, Ltmp074; MACHO-NEXT: add x16, x17, x1675; MACHO-NEXT: br x1676 77; ELF-LABEL: test_jumptable:78; ELF: mov w16, w079; ELF: cmp x16, #580; ELF: csel x16, x16, xzr, ls81; ELF-NEXT: adrp x17, .LJTI0_082; ELF-NEXT: add x17, x17, :lo12:.LJTI0_083; ELF-NEXT: ldrsw x16, [x17, x16, lsl #2]84; ELF-NEXT: .Ltmp0:85; ELF-NEXT: adr x17, .Ltmp086; ELF-NEXT: add x16, x17, x1687; ELF-NEXT: br x1688 89define i32 @test_jumptable(i32 %in) "aarch64-jump-table-hardening" {90 91 switch i32 %in, label %def [92 i32 0, label %lbl193 i32 1, label %lbl294 i32 2, label %lbl395 i32 4, label %lbl496 i32 5, label %lbl597 ]98 99def:100 ret i32 0101 102lbl1:103 ret i32 1104 105lbl2:106 ret i32 2107 108lbl3:109 ret i32 4110 111lbl4:112 ret i32 8113 114lbl5:115 ret i32 10116 117}118 119; MACHO-LABEL: LJTI0_0:120; MACHO-NEXT: .long LBB{{[0-9_]+}}-Ltmp0121; MACHO-NEXT: .long LBB{{[0-9_]+}}-Ltmp0122; MACHO-NEXT: .long LBB{{[0-9_]+}}-Ltmp0123; MACHO-NEXT: .long LBB{{[0-9_]+}}-Ltmp0124; MACHO-NEXT: .long LBB{{[0-9_]+}}-Ltmp0125; MACHO-NEXT: .long LBB{{[0-9_]+}}-Ltmp0126 127; ELF-LABEL: .LJTI0_0:128; ELF-NEXT: .word .LBB{{[0-9_]+}}-.Ltmp0129; ELF-NEXT: .word .LBB{{[0-9_]+}}-.Ltmp0130; ELF-NEXT: .word .LBB{{[0-9_]+}}-.Ltmp0131; ELF-NEXT: .word .LBB{{[0-9_]+}}-.Ltmp0132; ELF-NEXT: .word .LBB{{[0-9_]+}}-.Ltmp0133; ELF-NEXT: .word .LBB{{[0-9_]+}}-.Ltmp0134