1 ; RUN: llc -mtriple aarch64-linux-gnu -mattr=+pauth -asm-verbose=false -disable-post-ra -o - %s | FileCheck %s
3 ; CHECK-LABEL: test_tailcall:
5 ; CHECK-NEXT: str x30, [sp, #-16]!
7 ; CHECK-NEXT: ldr x30, [sp], #16
9 ; CHECK-NEXT: eor x16, x30, x30, lsl #1
10 ; CHECK-NEXT: tbz x16, #62, [[GOOD:.L.*]]
11 ; CHECK-NEXT: brk #0xc471
12 ; CHECK-NEXT: [[GOOD]]:
14 define i32 @test_tailcall() #0 {
16 %c = tail call i32 @bar()
20 ; CHECK-LABEL: test_tailcall_noframe:
22 define i32 @test_tailcall_noframe() #0 {
23 %c = tail call i32 @bar()
27 ; CHECK-LABEL: test_tailcall_indirect:
29 ; CHECK: eor x16, x30, x30, lsl #1
30 ; CHECK: tbz x16, #62, [[GOOD:.L.*]]
34 define void @test_tailcall_indirect(ptr %fptr) #0 {
35 call i32 @test_tailcall()
36 tail call void %fptr()
40 ; CHECK-LABEL: test_tailcall_indirect_in_x9:
42 ; CHECK: eor x16, x30, x30, lsl #1
43 ; CHECK: tbz x16, #62, [[GOOD:.L.*]]
47 define void @test_tailcall_indirect_in_x9(ptr sret(i64) %ret, [8 x i64] %in, ptr %fptr) #0 {
48 %ptr = alloca i8, i32 16
49 call i32 @test_tailcall()
50 tail call void %fptr(ptr sret(i64) %ret, [8 x i64] %in)
54 ; CHECK-LABEL: test_auth_tailcall_indirect:
56 ; CHECK: eor x16, x30, x30, lsl #1
57 ; CHECK: tbz x16, #62, [[GOOD:.L.*]]
62 define void @test_auth_tailcall_indirect(ptr %fptr) #0 {
63 call i32 @test_tailcall()
64 tail call void %fptr() [ "ptrauth"(i32 0, i64 42) ]
68 ; CHECK-LABEL: test_auth_tailcall_indirect_in_x9:
70 ; CHECK: eor x16, x30, x30, lsl #1
71 ; CHECK: tbz x16, #62, [[GOOD:.L.*]]
75 define void @test_auth_tailcall_indirect_in_x9(ptr sret(i64) %ret, [8 x i64] %in, ptr %fptr) #0 {
76 %ptr = alloca i8, i32 16
77 call i32 @test_tailcall()
78 tail call void %fptr(ptr sret(i64) %ret, [8 x i64] %in) [ "ptrauth"(i32 1, i64 0) ]
82 ; CHECK-LABEL: test_auth_tailcall_indirect_bti:
84 ; CHECK: eor x17, x30, x30, lsl #1
85 ; CHECK: tbz x17, #62, [[GOOD:.L.*]]
89 define void @test_auth_tailcall_indirect_bti(ptr sret(i64) %ret, [8 x i64] %in, ptr %fptr) #0 "branch-target-enforcement"="true" {
90 %ptr = alloca i8, i32 16
91 call i32 @test_tailcall()
92 tail call void %fptr(ptr sret(i64) %ret, [8 x i64] %in) [ "ptrauth"(i32 1, i64 0) ]
98 attributes #0 = { nounwind "ptrauth-returns" "ptrauth-auth-traps" }