1 ;; RUN: llc -mtriple aarch64 -global-isel -O0 %s -o - | FileCheck -enable-var-scope %s --check-prefixes=CHECK,CHECK-NOP
2 ;; RUN: llc -mtriple aarch64 -mattr=+v8.3a -global-isel -O0 %s -o - | FileCheck -enable-var-scope %s --check-prefixes=CHECK,CHECK-V83
4 declare void @g1(ptr) #1
5 declare void @g2(i32, ptr) #1
7 declare ptr @llvm.returnaddress(i32 immarg) #2
11 %0 = call ptr @llvm.returnaddress(i32 0)
13 %1 = call ptr @llvm.returnaddress(i32 1)
14 call void @g2(i32 1, ptr %1)
15 %2 = call ptr @llvm.returnaddress(i32 2)
19 ;; CHECK-NOT: {{(mov|ldr)}} x30
21 ;; CHECK-V83: mov [[COPY_X30:x[0-9]+]], x30
22 ;; CHECK-V83: xpaci [[COPY_X30]]
24 ;; CHECK: ldr x[[T0:[0-9]+]], [x29]
25 ;; CHECK-NOP-NEXT: ldr x30, [x[[T0]], #8]
26 ;; CHECK-NOP-NEXT: hint #7
27 ;; CHECK-V83-NEXT: ldr x[[LD0:[0-9]+]], [x[[T0]], #8]
28 ;; CHECK-V83-NEXT: xpaci x[[LD0]]
30 ;; CHECK: ldr x[[T1:[0-9]+]], [x29]
31 ;; CHECK-NEXT: ldr x[[T1]], [x[[T1]]]
32 ;; CHECK-NOP-NEXT: ldr x30, [x[[T1]], #8]
33 ;; CHECK-NOP-NEXT: hint #7
34 ;; CHECK-NOP-NEXT: mov x0, x30
35 ;; CHECK-V83-NEXT: ldr x0, [x[[T1]], #8]
36 ;; CHECK-V83-NEXT: xpaci x0
40 %0 = call ptr @llvm.returnaddress(i32 1)
42 %1 = call ptr @llvm.returnaddress(i32 2)
43 call void @g2(i32 1, ptr %1)
44 %2 = call ptr @llvm.returnaddress(i32 0)
48 ;; CHECK-DAG: ldr x[[T0:[0-9]+]], [x29]
49 ;; CHECK-NOP-DAG: str x30, [sp, #[[OFF:[0-9]+]]
50 ;; CHECK-NOP: ldr x30, [x[[T0]], #8]
51 ;; CHECK-NOP-NEXT: hint #7
52 ;; CHECK-V83-DAG: str x30, [sp, #[[OFF:[0-9]+]]
53 ;; CHECK-V83: ldr x[[T1:[0-9]+]], [x[[T0]], #8]
54 ;; CHECK-V83-NEXT: xpaci x[[T1]]
57 ;; CHECK: ldr x[[T2:[0-9]+]], [x29]
58 ;; CHECK-NEXT: ldr x[[T2]], [x[[T2]]]
59 ;; CHECK-NOP-NEXT: ldr x30, [x[[T2]], #8]
60 ;; CHECK-NOP-NEXT: hint #7
61 ;; CHECK-V83-NEXT: ldr x[[T3:[0-9]+]], [x[[T2]], #8]
62 ;; CHECK-V83-NEXT: xpaci x[[T3]]
65 ;; CHECK-NOP: ldr x30, [sp, #[[OFF]]]
66 ;; CHECK-NOP-NEXT: hint #7
67 ;; CHECK-NOP-NEXT: mov x0, x30
69 ;; CHECK-V83: ldr x0, [sp, #[[OFF]]]
70 ;; CHECK-V83-NEXT: xpaci x0
77 %0 = call ptr @llvm.returnaddress(i32 0)
82 ;; CHECK-NOP: ldr x30, [sp,
83 ;; CHECK-NOP-NEXT: hint #7
84 ;; CHECK-NOP-NEXT: mov x0, x30
86 ;; CHECK-V83: ldr x0, [sp,
87 ;; CHECK-V83-NEXT: xpaci x0
93 %0 = call ptr @llvm.returnaddress(i32 0)
97 ;; CHECK-NOP: str x30, [sp,
98 ;; CHECK-NOP-NEXT: hint #7
99 ;; CHECK-NOP-NEXT: mov x0, x30
101 ;; CHECK-V83: mov x0, x30
102 ;; CHECK-V83-NEXT: xpaci x0
105 attributes #0 = { nounwind }
106 attributes #1 = { nounwind }
107 attributes #2 = { nounwind readnone }