1 ; RUN: llc < %s -mtriple=arm64-eabi -asm-verbose=false -mattr=v8.2a | FileCheck %s
2 ; RUN: llc < %s -mtriple=arm64-eabi -asm-verbose=false -mattr=v8.3a | FileCheck %s --check-prefix=CHECKV83
4 ; Armv8.3-A Pointer Authetication requires a special intsruction to strip the
5 ; pointer authentication code from the pointer.
6 ; The XPACLRI instruction assembles to a hint-space instruction before Armv8.3-A
7 ; therefore this instruction can be safely used for any pre Armv8.3-A architectures.
8 ; On Armv8.3-A and onwards XPACI is available so use that instead.
10 define ptr @ra0() nounwind readnone {
13 ; CHECK-NEXT: str x30, [sp, #-16]!
15 ; CHECK-NEXT: mov x0, x30
16 ; CHECK-NEXT: ldr x30, [sp], #16
18 ; CHECKV83: str x30, [sp, #-16]!
19 ; CHECKV83-NEXT: xpaci x30
20 ; CHECKV83-NEXT: mov x0, x30
21 ; CHECKV83-NEXT: ldr x30, [sp], #16
23 %0 = tail call ptr @llvm.returnaddress(i32 0)
27 define ptr @ra1() nounwind readnone #0 {
31 ; CHECK-NEXT: str x30, [sp, #-16]!
33 ; CHECK-NEXT: mov x0, x30
34 ; CHECK-NEXT: ldr x30, [sp], #16
35 ; CHECK-NEXT: hint #29
38 ; CHECKV83-NEXT: str x30, [sp, #-16]!
39 ; CHECKV83-NEXT: xpaci x30
40 ; CHECKV83-NEXT: mov x0, x30
41 ; CHECKV83-NEXT: ldr x30, [sp], #16
42 ; CHECKV83-NEXT: retaa
43 %0 = tail call ptr @llvm.returnaddress(i32 0)
47 attributes #0 = { "sign-return-address"="all" }
49 declare ptr @llvm.returnaddress(i32) nounwind readnone