1 ; RUN: llc -mtriple=arm64 -global-isel=0 -fast-isel=0 -relocation-model=pic -o - %s \
2 ; RUN: -mcpu=cyclone -mattr=+pauth -mattr=+fpac | FileCheck --check-prefixes=CHECK,NOTRAP %s
3 ; RUN: llc -mtriple=arm64 -global-isel=0 -fast-isel=0 -relocation-model=pic -o - %s \
4 ; RUN: -mcpu=cyclone -mattr=+pauth | FileCheck --check-prefixes=CHECK,TRAP %s
6 ; RUN: llc -mtriple=arm64 -global-isel=0 -fast-isel=1 -relocation-model=pic -o - %s \
7 ; RUN: -mcpu=cyclone -mattr=+pauth -mattr=+fpac | FileCheck --check-prefixes=CHECK,NOTRAP %s
8 ; RUN: llc -mtriple=arm64 -global-isel=0 -fast-isel=1 -relocation-model=pic -o - %s \
9 ; RUN: -mcpu=cyclone -mattr=+pauth | FileCheck --check-prefixes=CHECK,TRAP %s
11 ; RUN: llc -mtriple=arm64 -global-isel=1 -global-isel-abort=1 -relocation-model=pic -o - %s \
12 ; RUN: -mcpu=cyclone -mattr=+pauth -mattr=+fpac | FileCheck --check-prefixes=CHECK,NOTRAP %s
13 ; RUN: llc -mtriple=arm64 -global-isel=1 -global-isel-abort=1 -relocation-model=pic -o - %s \
14 ; RUN: -mcpu=cyclone -mattr=+pauth | FileCheck --check-prefixes=CHECK,TRAP %s
16 ;; Note: for FastISel, we fall back to SelectionDAG
18 @var8 = external global i8, align 1
20 define i8 @test_i8(i8 %new) {
21 %val = load i8, ptr @var8, align 1
22 store i8 %new, ptr @var8
25 ; CHECK-LABEL: test_i8:
26 ; CHECK: adrp x17, :got_auth:var8
27 ; CHECK-NEXT: add x17, x17, :got_auth_lo12:var8
28 ; NOTRAP-NEXT: ldr x9, [x17]
29 ; NOTRAP-NEXT: autda x9, x17
30 ; TRAP-NEXT: ldr x16, [x17]
31 ; TRAP-NEXT: autda x16, x17
32 ; TRAP-NEXT: mov x17, x16
33 ; TRAP-NEXT: xpacd x17
34 ; TRAP-NEXT: cmp x16, x17
35 ; TRAP-NEXT: b.eq .Lauth_success_0
36 ; TRAP-NEXT: brk #0xc472
37 ; TRAP-NEXT: .Lauth_success_0:
38 ; TRAP-NEXT: mov x9, x16
39 ; CHECK-NEXT: ldrb w8, [x9]
40 ; CHECK-NEXT: strb w0, [x9]
41 ; CHECK-NEXT: mov x0, x8
45 !llvm.module.flags = !{!0}
46 !0 = !{i32 8, !"ptrauth-elf-got", i32 1}