1 ; RUN: llc < %s -mtriple aarch64-linux-gnu -mattr=+pauth -verify-machineinstrs -disable-post-ra \
2 ; RUN: -global-isel=0 -o - %s | FileCheck %s
3 ; RUN: llc < %s -mtriple aarch64-linux-gnu -mattr=+pauth -verify-machineinstrs -disable-post-ra \
4 ; RUN: -global-isel=1 -global-isel-abort=1 -o - %s | FileCheck %s
6 define i32 @test() #0 {
9 ; CHECK-NEXT: str x19, [sp, #-16]!
10 ; CHECK-NEXT: mov w0, wzr
12 ; CHECK-NEXT: //NO_APP
13 ; CHECK-NEXT: ldr x19, [sp], #16
15 call void asm sideeffect "", "~{x19}"()
19 define i32 @test_alloca() #0 {
20 ; CHECK-LABEL: test_alloca:
22 ; CHECK-NEXT: sub sp, sp, #32
23 ; CHECK-NEXT: mov x8, sp
24 ; CHECK-NEXT: mov w0, wzr
26 ; CHECK-NEXT: //NO_APP
27 ; CHECK-NEXT: add sp, sp, #32
29 %p = alloca i8, i32 32
30 call void asm sideeffect "", "r"(ptr %p)
34 define i32 @test_realign_alloca() #0 {
35 ; CHECK-LABEL: test_realign_alloca:
38 ; CHECK-NEXT: stp x29, x30, [sp, #-16]!
39 ; CHECK-NEXT: mov x29, sp
40 ; CHECK-NEXT: sub x9, sp, #112
41 ; CHECK-NEXT: and sp, x9, #0xffffffffffffff80
42 ; CHECK-NEXT: mov x8, sp
43 ; CHECK-NEXT: mov w0, wzr
45 ; CHECK-NEXT: //NO_APP
46 ; CHECK-NEXT: mov sp, x29
47 ; CHECK-NEXT: ldp x29, x30, [sp], #16
49 %p = alloca i8, i32 32, align 128
50 call void asm sideeffect "", "r"(ptr %p)
54 define i32 @test_big_alloca() #0 {
55 ; CHECK-LABEL: test_big_alloca:
57 ; CHECK-NEXT: str x29, [sp, #-16]!
58 ; CHECK-NEXT: sub sp, sp, #1024
59 ; CHECK-NEXT: mov x8, sp
60 ; CHECK-NEXT: mov w0, wzr
62 ; CHECK-NEXT: //NO_APP
63 ; CHECK-NEXT: add sp, sp, #1024
64 ; CHECK-NEXT: ldr x29, [sp], #16
66 %p = alloca i8, i32 1024
67 call void asm sideeffect "", "r"(ptr %p)
71 define i32 @test_var_alloca(i32 %s) #0 {
72 %p = alloca i8, i32 %s
73 call void asm sideeffect "", "r"(ptr %p)
77 define i32 @test_noframe_saved(ptr %p) #0 {
78 ; CHECK-LABEL: test_noframe_saved:
82 ; CHECK-NEXT: str x29, [sp, #-96]!
83 ; CHECK-NEXT: stp x28, x27, [sp, #16]
84 ; CHECK-NEXT: stp x26, x25, [sp, #32]
85 ; CHECK-NEXT: stp x24, x23, [sp, #48]
86 ; CHECK-NEXT: stp x22, x21, [sp, #64]
87 ; CHECK-NEXT: stp x20, x19, [sp, #80]
88 ; CHECK-NEXT: ldr w29, [x0]
90 ; CHECK-NEXT: //NO_APP
91 ; CHECK-NEXT: mov w0, w29
92 ; CHECK-NEXT: ldp x20, x19, [sp, #80]
93 ; CHECK-NEXT: ldp x22, x21, [sp, #64]
94 ; CHECK-NEXT: ldp x24, x23, [sp, #48]
95 ; CHECK-NEXT: ldp x26, x25, [sp, #32]
96 ; CHECK-NEXT: ldp x28, x27, [sp, #16]
97 ; CHECK-NEXT: ldr x29, [sp], #96
100 call void asm sideeffect "", "~{x0},~{x1},~{x2},~{x3},~{x4},~{x5},~{x6},~{x7},~{x8},~{x9},~{x10},~{x11},~{x12},~{x13},~{x14},~{x15},~{x16},~{x17},~{x18},~{x19},~{x20},~{x21},~{x22},~{x23},~{x24},~{x25},~{x26},~{x27},~{x28}"()
104 define void @test_noframe() #0 {
105 ; CHECK-LABEL: test_noframe:
111 ; FIXME: Inefficient lowering of @llvm.returnaddress
112 define ptr @test_returnaddress_0() #0 {
113 ; CHECK-LABEL: test_returnaddress_0:
115 ; CHECK-NEXT: pacibsp
116 ; CHECK-NEXT: str x30, [sp, #-16]!
117 ; CHECK-NEXT: xpaci x30
118 ; CHECK-NEXT: mov x0, x30
119 ; CHECK-NEXT: ldr x30, [sp], #16
121 %r = call ptr @llvm.returnaddress(i32 0)
125 define ptr @test_returnaddress_1() #0 {
126 ; CHECK-LABEL: test_returnaddress_1:
128 ; CHECK-NEXT: pacibsp
129 ; CHECK-NEXT: stp x29, x30, [sp, #-16]!
130 ; CHECK-NEXT: mov x29, sp
131 ; CHECK-NEXT: ldr x8, [x29]
132 ; CHECK-NEXT: ldr x0, [x8, #8]
133 ; CHECK-NEXT: xpaci x0
134 ; CHECK-NEXT: ldp x29, x30, [sp], #16
136 %r = call ptr @llvm.returnaddress(i32 1)
140 define void @test_noframe_alloca() #0 {
141 ; CHECK-LABEL: test_noframe_alloca:
143 ; CHECK-NEXT: sub sp, sp, #16
144 ; CHECK-NEXT: add x8, sp, #12
146 ; CHECK-NEXT: //NO_APP
147 ; CHECK-NEXT: add sp, sp, #16
149 %p = alloca i8, i32 1
150 call void asm sideeffect "", "r"(ptr %p)
154 define void @test_call() #0 {
155 ; CHECK-LABEL: test_call:
157 ; CHECK-NEXT: pacibsp
158 ; CHECK-NEXT: str x30, [sp, #-16]!
160 ; CHECK-NEXT: ldr x30, [sp], #16
166 define void @test_call_alloca() #0 {
167 ; CHECK-LABEL: test_call_alloca:
169 ; CHECK-NEXT: pacibsp
170 ; CHECK-NEXT: str x30, [sp, #-16]
172 ; CHECK-NEXT: ldr x30, [sp], #16
179 define void @test_call_shrinkwrapping(i1 %c) #0 {
180 ; CHECK-LABEL: test_call_shrinkwrapping:
182 ; CHECK-NEXT: tbz w0, #0, .LBB12_2
184 ; CHECK-NEXT: pacibsp
185 ; CHECK-NEXT: str x30, [sp, #-16]!
187 ; CHECK-NEXT: ldr x30, [sp], #16
188 ; CHECK-NEXT: autibsp
189 ; CHECK-NEXT: LBB12_2:
191 br i1 %c, label %tbb, label %fbb
199 define i32 @test_tailcall() #0 {
200 ; CHECK-LABEL: test_tailcall:
202 ; CHECK-NEXT: pacibsp
203 ; CHECK-NEXT: str x30, [sp, #-16]!
205 ; CHECK-NEXT: ldr x30, [sp], #16
206 ; CHECK-NEXT: autibsp
209 %c = tail call i32 @bar()
213 define i32 @test_tailcall_noframe() #0 {
214 ; CHECK-LABEL: test_tailcall_noframe:
217 %c = tail call i32 @bar()
223 declare ptr @llvm.returnaddress(i32)
225 attributes #0 = { nounwind "ptrauth-returns" }