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 3 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. 9 10define ptr @ra0() nounwind readnone { 11entry: 12; CHECK-LABEL: ra0: 13; CHECK-NEXT: str x30, [sp, #-16]! 14; CHECK-NEXT: hint #7 15; CHECK-NEXT: mov x0, x30 16; CHECK-NEXT: ldr x30, [sp], #16 17; CHECK-NEXT: ret 18; CHECKV83: str x30, [sp, #-16]! 19; CHECKV83-NEXT: xpaci x30 20; CHECKV83-NEXT: mov x0, x30 21; CHECKV83-NEXT: ldr x30, [sp], #16 22; CHECKV83-NEXT: ret 23 %0 = tail call ptr @llvm.returnaddress(i32 0) 24 ret ptr %0 25} 26 27define ptr @ra1() nounwind readnone #0 { 28entry: 29; CHECK-LABEL: ra1: 30; CHECK: hint #25 31; CHECK-NEXT: str x30, [sp, #-16]! 32; CHECK-NEXT: hint #7 33; CHECK-NEXT: mov x0, x30 34; CHECK-NEXT: ldr x30, [sp], #16 35; CHECK-NEXT: hint #29 36; CHECK-NEXT: ret 37; CHECKV83: paciasp 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) 44 ret ptr %0 45} 46 47attributes #0 = { "sign-return-address"="all" } 48 49declare ptr @llvm.returnaddress(i32) nounwind readnone 50