1 ; RUN: llc -verify-machineinstrs -o - %s | FileCheck %s
2 ; RUN: llc -verify-machineinstrs -global-isel -o - %s | FileCheck %s
4 target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
5 target triple = "arm64e-apple-iphoneos"
10 declare void @llvm.objc.release(i8*)
11 declare i8* @llvm.objc.retainAutoreleasedReturnValue(i8*)
12 declare i8* @llvm.objc.unsafeClaimAutoreleasedReturnValue(i8*)
14 declare void @foo2(i8*)
16 declare void @foo(i64, i64, i64)
18 define void @rv_marker_ptrauth_blraa(i8* ()** %arg0, i64 %arg1) {
19 ; CHECK-LABEL: rv_marker_ptrauth_blraa
20 ; CHECK: ldr [[ADDR:x[0-9]+]], [
21 ; CHECK-NEXT: blraa [[ADDR]], x1
22 ; CHECK-NEXT: mov x29, x29
23 ; CHECK-NEXT: bl objc_retainAutoreleasedReturnValue
26 %tmp0 = load i8* ()*, i8* ()** %arg0
27 %call0 = call i8* %tmp0() [ "ptrauth"(i32 0, i64 %arg1), "clang.arc.attachedcall"(i8* (i8*)* @llvm.objc.retainAutoreleasedReturnValue) ]
28 tail call void @foo2(i8* %call0)
29 tail call void @llvm.objc.release(i8* %call0)
33 define void @rv_marker_ptrauth_blraa_unsafeClaim(i8* ()** %arg0, i64 %arg1) {
34 ; CHECK-LABEL: rv_marker_ptrauth_blraa_unsafeClaim
35 ; CHECK: ldr [[ADDR:x[0-9]+]], [
36 ; CHECK-NEXT: blraa [[ADDR]], x1
37 ; CHECK-NEXT: mov x29, x29
38 ; CHECK-NEXT: bl objc_unsafeClaimAutoreleasedReturnValue
41 %tmp0 = load i8* ()*, i8* ()** %arg0
42 %call0 = call i8* %tmp0() [ "ptrauth"(i32 0, i64 %arg1), "clang.arc.attachedcall"(i8* (i8*)* @llvm.objc.unsafeClaimAutoreleasedReturnValue) ]
43 tail call void @foo2(i8* %call0)
44 tail call void @llvm.objc.release(i8* %call0)
48 define void @rv_marker_ptrauth_blraa_disc_imm16(i8* ()** %arg0) {
49 ; CHECK-LABEL: rv_marker_ptrauth_blraa_disc_imm16
50 ; CHECK: ldr [[ADDR:x[0-9]+]], [
51 ; CHECK-NEXT: mov x17, #45431
52 ; CHECK-NEXT: blrab [[ADDR]], x17
53 ; CHECK-NEXT: mov x29, x29
54 ; CHECK-NEXT: bl objc_retainAutoreleasedReturnValue
56 %tmp0 = load i8* ()*, i8* ()** %arg0
57 %call0 = call i8* %tmp0() [ "ptrauth"(i32 1, i64 45431), "clang.arc.attachedcall"(i8* (i8*)* @llvm.objc.retainAutoreleasedReturnValue) ]
58 tail call void @foo2(i8* %call0)
59 tail call void @llvm.objc.release(i8* %call0)
63 define void @rv_marker_ptrauth_blraa_multiarg(i8* (i64, i64, i64)** %arg0, i64 %arg1, i64 %a, i64 %b, i64 %c) {
64 ; CHECK-LABEL: rv_marker_ptrauth_blraa_multiarg
65 ; CHECK: mov [[TMP:x[0-9]+]], x1
66 ; CHECK-DAG: ldr [[ADDR:x[0-9]+]]
67 ; CHECK-DAG: mov x0, x4
68 ; CHECK-DAG: mov x1, x3
69 ; CHECK-NEXT: blraa [[ADDR]], [[TMP]]
70 ; CHECK-NEXT: mov x29, x29
71 ; CHECK-NEXT: bl objc_retainAutoreleasedReturnValue
74 %tmp0 = load i8* (i64, i64, i64)*, i8* (i64, i64, i64)** %arg0
75 %call0 = call i8* %tmp0(i64 %c, i64 %b, i64 %a) [ "ptrauth"(i32 0, i64 %arg1), "clang.arc.attachedcall"(i8* (i8*)* @llvm.objc.retainAutoreleasedReturnValue) ]
76 tail call void @foo2(i8* %call0)
77 tail call void @llvm.objc.release(i8* %call0)
81 define void @rv_marker_ptrauth_blrab(i8* ()** %arg0, i64 %arg1) {
82 ; CHECK-LABEL: rv_marker_ptrauth_blrab
83 ; CHECK: ldr [[ADDR:x[0-9]+]], [
84 ; CHECK-NEXT: blrab [[ADDR]], x1
85 ; CHECK-NEXT: mov x29, x29
86 ; CHECK-NEXT: bl objc_retainAutoreleasedReturnValue
88 %tmp0 = load i8* ()*, i8* ()** %arg0
89 %call0 = call i8* %tmp0() [ "ptrauth"(i32 1, i64 %arg1), "clang.arc.attachedcall"(i8* (i8*)* @llvm.objc.retainAutoreleasedReturnValue) ]
90 tail call void @foo2(i8* %call0)
91 tail call void @llvm.objc.release(i8* %call0)
95 define void @rv_marker_ptrauth_blrab_disc_imm16(i8* ()** %arg0) {
96 ; CHECK-LABEL: rv_marker_ptrauth_blrab_disc_imm16
97 ; CHECK: ldr [[ADDR:x[0-9]+]], [
98 ; CHECK-NEXT: mov x17, #256
99 ; CHECK-NEXT: blrab [[ADDR]], x17
100 ; CHECK-NEXT: mov x29, x29
101 ; CHECK-NEXT: bl objc_retainAutoreleasedReturnValue
103 %tmp0 = load i8* ()*, i8* ()** %arg0
104 %call0 = call i8* %tmp0() [ "ptrauth"(i32 1, i64 256), "clang.arc.attachedcall"(i8* (i8*)* @llvm.objc.retainAutoreleasedReturnValue) ]
105 tail call void @foo2(i8* %call0)
106 tail call void @llvm.objc.release(i8* %call0)
110 define void @rv_marker_ptrauth_blraaz(i8* ()** %arg0) {
111 ; CHECK-LABEL: rv_marker_ptrauth_blraaz
112 ; CHECK: ldr [[ADDR:x[0-9]+]], [
113 ; CHECK-NEXT: blraaz [[ADDR]]
114 ; CHECK-NEXT: mov x29, x29
115 ; CHECK-NEXT: bl objc_retainAutoreleasedReturnValue
117 %tmp0 = load i8* ()*, i8* ()** %arg0
118 %call0 = call i8* %tmp0() [ "ptrauth"(i32 0, i64 0), "clang.arc.attachedcall"(i8* (i8*)* @llvm.objc.retainAutoreleasedReturnValue) ]
119 tail call void @foo2(i8* %call0)
120 tail call void @llvm.objc.release(i8* %call0)
124 define void @rv_marker_ptrauth_blrabz(i8* ()** %arg0) {
125 ; CHECK-LABEL: rv_marker_ptrauth_blrabz
126 ; CHECK: ldr [[ADDR:x[0-9]+]], [
127 ; CHECK-NEXT: blrabz [[ADDR]]
128 ; CHECK-NEXT: mov x29, x29
129 ; CHECK-NEXT: bl objc_retainAutoreleasedReturnValue
131 %tmp0 = load i8* ()*, i8* ()** %arg0
132 %call0 = call i8* %tmp0() [ "ptrauth"(i32 1, i64 0), "clang.arc.attachedcall"(i8* (i8*)* @llvm.objc.retainAutoreleasedReturnValue) ]
133 tail call void @foo2(i8* %call0)
134 tail call void @llvm.objc.release(i8* %call0)
138 define void @rv_marker_ptrauth_blrabz_multiarg(i8* (i64, i64, i64)** %arg0, i64 %a, i64 %b, i64 %c) {
139 ; CHECK-LABEL: rv_marker_ptrauth_blrabz_multiarg
140 ; CHECK: mov [[TMP:x[0-9]+]], x1
141 ; CHECK-DAG: ldr [[ADDR:x[0-9]+]], [
142 ; CHECK-DAG: mov x0, x3
143 ; CHECK-DAG: mov x1, x2
144 ; CHECK-DAG: mov x2, [[TMP]]
145 ; CHECK-NEXT: blrabz [[ADDR]]
146 ; CHECK-NEXT: mov x29, x29
147 ; CHECK-NEXT: bl objc_retainAutoreleasedReturnValue
149 %tmp0 = load i8* (i64, i64, i64)*, i8* (i64, i64, i64)** %arg0
150 %call0 = call i8* %tmp0(i64 %c, i64 %b, i64 %a) [ "ptrauth"(i32 1, i64 0), "clang.arc.attachedcall"(i8* (i8*)* @llvm.objc.retainAutoreleasedReturnValue) ]
151 tail call void @foo2(i8* %call0)
152 tail call void @llvm.objc.release(i8* %call0)