1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple arm64e-apple-darwin -global-isel=0 -verify-machineinstrs \
3 ; RUN: -aarch64-ptrauth-auth-checks=none | FileCheck %s -DL="L" --check-prefixes=UNCHECKED,UNCHECKED-DARWIN
4 ; RUN: llc < %s -mtriple arm64e-apple-darwin -global-isel -global-isel-abort=1 -verify-machineinstrs \
5 ; RUN: -aarch64-ptrauth-auth-checks=none | FileCheck %s -DL="L" --check-prefixes=UNCHECKED,UNCHECKED-DARWIN
7 ; RUN: llc < %s -mtriple arm64e-apple-darwin -global-isel=0 -verify-machineinstrs \
8 ; RUN: | FileCheck %s -DL="L" --check-prefixes=CHECKED,CHECKED-DARWIN
9 ; RUN: llc < %s -mtriple arm64e-apple-darwin -global-isel -global-isel-abort=1 -verify-machineinstrs \
10 ; RUN: | FileCheck %s -DL="L" --check-prefixes=CHECKED,CHECKED-DARWIN
12 ; RUN: llc < %s -mtriple arm64e-apple-darwin -global-isel=0 -verify-machineinstrs \
13 ; RUN: -aarch64-ptrauth-auth-checks=trap | FileCheck %s -DL="L" --check-prefixes=TRAP,TRAP-DARWIN
14 ; RUN: llc < %s -mtriple arm64e-apple-darwin -global-isel -global-isel-abort=1 -verify-machineinstrs \
15 ; RUN: -aarch64-ptrauth-auth-checks=trap | FileCheck %s -DL="L" --check-prefixes=TRAP,TRAP-DARWIN
17 ; RUN: llc < %s -mtriple aarch64-linux-gnu -mattr=+pauth -global-isel=0 -verify-machineinstrs \
18 ; RUN: -aarch64-ptrauth-auth-checks=none | FileCheck %s -DL=".L" --check-prefixes=UNCHECKED,UNCHECKED-ELF
19 ; RUN: llc < %s -mtriple aarch64-linux-gnu -mattr=+pauth -global-isel -global-isel-abort=1 -verify-machineinstrs \
20 ; RUN: -aarch64-ptrauth-auth-checks=none | FileCheck %s -DL=".L" --check-prefixes=UNCHECKED,UNCHECKED-ELF
22 ; RUN: llc < %s -mtriple aarch64-linux-gnu -mattr=+pauth -global-isel=0 -verify-machineinstrs \
23 ; RUN: | FileCheck %s -DL=".L" --check-prefixes=CHECKED,CHECKED-ELF
24 ; RUN: llc < %s -mtriple aarch64-linux-gnu -mattr=+pauth -global-isel -global-isel-abort=1 -verify-machineinstrs \
25 ; RUN: | FileCheck %s -DL=".L" --check-prefixes=CHECKED,CHECKED-ELF
27 ; RUN: llc < %s -mtriple aarch64-linux-gnu -mattr=+pauth -global-isel=0 -verify-machineinstrs \
28 ; RUN: -aarch64-ptrauth-auth-checks=trap | FileCheck %s -DL=".L" --check-prefixes=TRAP,TRAP-ELF
29 ; RUN: llc < %s -mtriple aarch64-linux-gnu -mattr=+pauth -global-isel -global-isel-abort=1 -verify-machineinstrs \
30 ; RUN: -aarch64-ptrauth-auth-checks=trap | FileCheck %s -DL=".L" --check-prefixes=TRAP,TRAP-ELF
32 target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
34 define i64 @test_auth_blend(i64 %arg, i64 %arg1) {
35 ; UNCHECKED-LABEL: test_auth_blend:
37 ; UNCHECKED-NEXT: mov x16, x0
38 ; UNCHECKED-NEXT: mov x17, x1
39 ; UNCHECKED-NEXT: movk x17, #65535, lsl #48
40 ; UNCHECKED-NEXT: autda x16, x17
41 ; UNCHECKED-NEXT: mov x0, x16
44 ; CHECKED-LABEL: test_auth_blend:
46 ; CHECKED-NEXT: mov x16, x0
47 ; CHECKED-NEXT: mov x17, x1
48 ; CHECKED-NEXT: movk x17, #65535, lsl #48
49 ; CHECKED-NEXT: autda x16, x17
50 ; CHECKED-NEXT: mov x0, x16
53 ; TRAP-LABEL: test_auth_blend:
55 ; TRAP-NEXT: mov x16, x0
56 ; TRAP-NEXT: mov x17, x1
57 ; TRAP-NEXT: movk x17, #65535, lsl #48
58 ; TRAP-NEXT: autda x16, x17
59 ; TRAP-NEXT: mov x17, x16
60 ; TRAP-NEXT: xpacd x17
61 ; TRAP-NEXT: cmp x16, x17
62 ; TRAP-NEXT: b.eq [[L]]auth_success_0
63 ; TRAP-NEXT: brk #0xc472
64 ; TRAP-NEXT: Lauth_success_0:
65 ; TRAP-NEXT: mov x0, x16
67 %tmp0 = call i64 @llvm.ptrauth.blend(i64 %arg1, i64 65535)
68 %tmp1 = call i64 @llvm.ptrauth.auth(i64 %arg, i32 2, i64 %tmp0)
72 define i64 @test_resign_blend(i64 %arg, i64 %arg1, i64 %arg2) {
73 ; UNCHECKED-LABEL: test_resign_blend:
75 ; UNCHECKED-NEXT: mov x16, x0
76 ; UNCHECKED-NEXT: mov x17, x1
77 ; UNCHECKED-NEXT: movk x17, #12345, lsl #48
78 ; UNCHECKED-NEXT: autda x16, x17
79 ; UNCHECKED-NEXT: mov x17, x2
80 ; UNCHECKED-NEXT: movk x17, #56789, lsl #48
81 ; UNCHECKED-NEXT: pacdb x16, x17
82 ; UNCHECKED-NEXT: mov x0, x16
85 ; CHECKED-LABEL: test_resign_blend:
87 ; CHECKED-NEXT: mov x16, x0
88 ; CHECKED-NEXT: mov x17, x1
89 ; CHECKED-NEXT: movk x17, #12345, lsl #48
90 ; CHECKED-NEXT: autda x16, x17
91 ; CHECKED-NEXT: mov x17, x16
92 ; CHECKED-NEXT: xpacd x17
93 ; CHECKED-NEXT: cmp x16, x17
94 ; CHECKED-NEXT: b.eq [[L]]auth_success_0
95 ; CHECKED-NEXT: mov x16, x17
96 ; CHECKED-NEXT: b [[L]]resign_end_0
97 ; CHECKED-NEXT: Lauth_success_0:
98 ; CHECKED-NEXT: mov x17, x2
99 ; CHECKED-NEXT: movk x17, #56789, lsl #48
100 ; CHECKED-NEXT: pacdb x16, x17
101 ; CHECKED-NEXT: Lresign_end_0:
102 ; CHECKED-NEXT: mov x0, x16
105 ; TRAP-LABEL: test_resign_blend:
107 ; TRAP-NEXT: mov x16, x0
108 ; TRAP-NEXT: mov x17, x1
109 ; TRAP-NEXT: movk x17, #12345, lsl #48
110 ; TRAP-NEXT: autda x16, x17
111 ; TRAP-NEXT: mov x17, x16
112 ; TRAP-NEXT: xpacd x17
113 ; TRAP-NEXT: cmp x16, x17
114 ; TRAP-NEXT: b.eq [[L]]auth_success_1
115 ; TRAP-NEXT: brk #0xc472
116 ; TRAP-NEXT: Lauth_success_1:
117 ; TRAP-NEXT: mov x17, x2
118 ; TRAP-NEXT: movk x17, #56789, lsl #48
119 ; TRAP-NEXT: pacdb x16, x17
120 ; TRAP-NEXT: mov x0, x16
122 %tmp0 = call i64 @llvm.ptrauth.blend(i64 %arg1, i64 12345)
123 %tmp1 = call i64 @llvm.ptrauth.blend(i64 %arg2, i64 56789)
124 %tmp2 = call i64 @llvm.ptrauth.resign(i64 %arg, i32 2, i64 %tmp0, i32 3, i64 %tmp1)
128 define i64 @test_resign_blend_and_const(i64 %arg, i64 %arg1) {
129 ; UNCHECKED-LABEL: test_resign_blend_and_const:
131 ; UNCHECKED-NEXT: mov x16, x0
132 ; UNCHECKED-NEXT: mov x17, x1
133 ; UNCHECKED-NEXT: movk x17, #12345, lsl #48
134 ; UNCHECKED-NEXT: autda x16, x17
135 ; UNCHECKED-NEXT: mov x17, #56789
136 ; UNCHECKED-NEXT: pacdb x16, x17
137 ; UNCHECKED-NEXT: mov x0, x16
138 ; UNCHECKED-NEXT: ret
140 ; CHECKED-LABEL: test_resign_blend_and_const:
142 ; CHECKED-NEXT: mov x16, x0
143 ; CHECKED-NEXT: mov x17, x1
144 ; CHECKED-NEXT: movk x17, #12345, lsl #48
145 ; CHECKED-NEXT: autda x16, x17
146 ; CHECKED-NEXT: mov x17, x16
147 ; CHECKED-NEXT: xpacd x17
148 ; CHECKED-NEXT: cmp x16, x17
149 ; CHECKED-NEXT: b.eq [[L]]auth_success_1
150 ; CHECKED-NEXT: mov x16, x17
151 ; CHECKED-NEXT: b [[L]]resign_end_1
152 ; CHECKED-NEXT: Lauth_success_1:
153 ; CHECKED-NEXT: mov x17, #56789
154 ; CHECKED-NEXT: pacdb x16, x17
155 ; CHECKED-NEXT: Lresign_end_1:
156 ; CHECKED-NEXT: mov x0, x16
159 ; TRAP-LABEL: test_resign_blend_and_const:
161 ; TRAP-NEXT: mov x16, x0
162 ; TRAP-NEXT: mov x17, x1
163 ; TRAP-NEXT: movk x17, #12345, lsl #48
164 ; TRAP-NEXT: autda x16, x17
165 ; TRAP-NEXT: mov x17, x16
166 ; TRAP-NEXT: xpacd x17
167 ; TRAP-NEXT: cmp x16, x17
168 ; TRAP-NEXT: b.eq [[L]]auth_success_2
169 ; TRAP-NEXT: brk #0xc472
170 ; TRAP-NEXT: Lauth_success_2:
171 ; TRAP-NEXT: mov x17, #56789
172 ; TRAP-NEXT: pacdb x16, x17
173 ; TRAP-NEXT: mov x0, x16
175 %tmp0 = call i64 @llvm.ptrauth.blend(i64 %arg1, i64 12345)
176 %tmp1 = call i64 @llvm.ptrauth.resign(i64 %arg, i32 2, i64 %tmp0, i32 3, i64 56789)
180 define i64 @test_resign_blend_and_addr(i64 %arg, i64 %arg1, i64 %arg2) {
181 ; UNCHECKED-LABEL: test_resign_blend_and_addr:
183 ; UNCHECKED-NEXT: mov x16, x0
184 ; UNCHECKED-NEXT: mov x17, x1
185 ; UNCHECKED-NEXT: movk x17, #12345, lsl #48
186 ; UNCHECKED-NEXT: autda x16, x17
187 ; UNCHECKED-NEXT: pacdb x16, x2
188 ; UNCHECKED-NEXT: mov x0, x16
189 ; UNCHECKED-NEXT: ret
191 ; CHECKED-LABEL: test_resign_blend_and_addr:
193 ; CHECKED-NEXT: mov x16, x0
194 ; CHECKED-NEXT: mov x17, x1
195 ; CHECKED-NEXT: movk x17, #12345, lsl #48
196 ; CHECKED-NEXT: autda x16, x17
197 ; CHECKED-NEXT: mov x17, x16
198 ; CHECKED-NEXT: xpacd x17
199 ; CHECKED-NEXT: cmp x16, x17
200 ; CHECKED-NEXT: b.eq [[L]]auth_success_2
201 ; CHECKED-NEXT: mov x16, x17
202 ; CHECKED-NEXT: b [[L]]resign_end_2
203 ; CHECKED-NEXT: Lauth_success_2:
204 ; CHECKED-NEXT: pacdb x16, x2
205 ; CHECKED-NEXT: Lresign_end_2:
206 ; CHECKED-NEXT: mov x0, x16
209 ; TRAP-LABEL: test_resign_blend_and_addr:
211 ; TRAP-NEXT: mov x16, x0
212 ; TRAP-NEXT: mov x17, x1
213 ; TRAP-NEXT: movk x17, #12345, lsl #48
214 ; TRAP-NEXT: autda x16, x17
215 ; TRAP-NEXT: mov x17, x16
216 ; TRAP-NEXT: xpacd x17
217 ; TRAP-NEXT: cmp x16, x17
218 ; TRAP-NEXT: b.eq [[L]]auth_success_3
219 ; TRAP-NEXT: brk #0xc472
220 ; TRAP-NEXT: Lauth_success_3:
221 ; TRAP-NEXT: pacdb x16, x2
222 ; TRAP-NEXT: mov x0, x16
224 %tmp0 = call i64 @llvm.ptrauth.blend(i64 %arg1, i64 12345)
225 %tmp1 = call i64 @llvm.ptrauth.resign(i64 %arg, i32 2, i64 %tmp0, i32 3, i64 %arg2)
229 define i64 @test_auth_too_large_discriminator(i64 %arg, i64 %arg1) {
230 ; UNCHECKED-LABEL: test_auth_too_large_discriminator:
232 ; UNCHECKED-NEXT: mov w8, #65536
233 ; UNCHECKED-DARWIN-NEXT: bfi x1, x8, #48, #16
234 ; UNCHECKED-DARWIN-NEXT: mov x16, x0
235 ; UNCHECKED-ELF-NEXT: mov x16, x0
236 ; UNCHECKED-ELF-NEXT: bfi x1, x8, #48, #16
237 ; UNCHECKED-NEXT: autda x16, x1
238 ; UNCHECKED-NEXT: mov x0, x16
239 ; UNCHECKED-NEXT: ret
241 ; CHECKED-LABEL: test_auth_too_large_discriminator:
243 ; CHECKED-NEXT: mov w8, #65536
244 ; CHECKED-DARWIN-NEXT: bfi x1, x8, #48, #16
245 ; CHECKED-DARWIN-NEXT: mov x16, x0
246 ; CHECKED-ELF-NEXT: mov x16, x0
247 ; CHECKED-ELF-NEXT: bfi x1, x8, #48, #16
248 ; CHECKED-NEXT: autda x16, x1
249 ; CHECKED-NEXT: mov x0, x16
252 ; TRAP-LABEL: test_auth_too_large_discriminator:
254 ; TRAP-NEXT: mov w8, #65536
255 ; TRAP-DARWIN-NEXT: bfi x1, x8, #48, #16
256 ; TRAP-DARWIN-NEXT: mov x16, x0
257 ; TRAP-ELF-NEXT: mov x16, x0
258 ; TRAP-ELF-NEXT: bfi x1, x8, #48, #16
259 ; TRAP-NEXT: autda x16, x1
260 ; TRAP-NEXT: mov x17, x16
261 ; TRAP-NEXT: xpacd x17
262 ; TRAP-NEXT: cmp x16, x17
263 ; TRAP-NEXT: b.eq [[L]]auth_success_4
264 ; TRAP-NEXT: brk #0xc472
265 ; TRAP-NEXT: Lauth_success_4:
266 ; TRAP-NEXT: mov x0, x16
268 %tmp0 = call i64 @llvm.ptrauth.blend(i64 %arg1, i64 65536)
269 %tmp1 = call i64 @llvm.ptrauth.auth(i64 %arg, i32 2, i64 %tmp0)
273 declare i64 @llvm.ptrauth.auth(i64, i32, i64)
274 declare i64 @llvm.ptrauth.resign(i64, i32, i64, i32, i64)
275 declare i64 @llvm.ptrauth.blend(i64, i64)