[MIParser] Set RegClassOrRegBank during instruction parsing
[llvm-complete.git] / test / CodeGen / AArch64 / sign-return-address.ll
blobdfd52f87fdeb18f20aa16201ecd7939cfac6dc27
1 ; RUN: llc -mtriple=aarch64-none-eabi < %s | FileCheck %s
3 ; CHECK-LABEL: @leaf
4 ; CHECK-NOT: paci{{[a,b]}}sp
5 ; CHECK-NOT: auti{{[a,b]}}sp
6 define i32 @leaf(i32 %x) {
7   ret i32 %x
10 ; CHECK-LABEL: @leaf_sign_none
11 ; CHECK-NOT: paci{{[a,b]}}sp
12 ; CHECK-NOT: auti{{[a,b]}}sp
13 define i32 @leaf_sign_none(i32 %x) "sign-return-address"="none"  {
14   ret i32 %x
17 ; CHECK-LABEL: @leaf_sign_non_leaf
18 ; CHECK-NOT: paci{{[a,b]}}sp
19 ; CHECK-NOT: auti{{[a,b]}}sp
20 define i32 @leaf_sign_non_leaf(i32 %x) "sign-return-address"="non-leaf"  {
21   ret i32 %x
24 ; CHECK-LABEL: @leaf_sign_all
25 ; CHECK: paciasp
26 ; CHECK: autiasp
27 ; CHECK: ret
28 define i32 @leaf_sign_all(i32 %x) "sign-return-address"="all" {
29   ret i32 %x
32 ; CHECK: @leaf_clobbers_lr
33 ; CHECK: paciasp
34 ; CHECK: str x30, [sp, #-16]!
35 ; CHECK: ldr  x30, [sp], #16
36 ; CHECK-NEXT: autiasp
37 ; CHECK: ret
38 define i64 @leaf_clobbers_lr(i64 %x) "sign-return-address"="non-leaf"  {
39   call void asm sideeffect "mov x30, $0", "r,~{lr}"(i64 %x) #1
40   ret i64 %x
43 declare i32 @foo(i32)
45 ; CHECK: @non_leaf_sign_all
46 ; CHECK: paciasp
47 ; CHECK: autiasp
48 ; CHECK: ret
49 define i32 @non_leaf_sign_all(i32 %x) "sign-return-address"="all" {
50   %call = call i32 @foo(i32 %x)
51   ret i32 %call
54 ; CHECK: @non_leaf_sign_non_leaf
55 ; CHECK: paciasp
56 ; CHECK: str x30, [sp, #-16]!
57 ; CHECK: ldr  x30, [sp], #16
58 ; CHECK: autiasp
59 ; CHECK: ret
60 define i32 @non_leaf_sign_non_leaf(i32 %x) "sign-return-address"="non-leaf"  {
61   %call = call i32 @foo(i32 %x)
62   ret i32 %call
65 ; CHECK-LABEL: @leaf_sign_all_v83
66 ; CHECK: paciasp
67 ; CHECK-NOT: ret
68 ; CHECK: retaa
69 ; CHECK-NOT: ret
70 define i32 @leaf_sign_all_v83(i32 %x) "sign-return-address"="all" "target-features"="+v8.3a" {
71   ret i32 %x
74 declare fastcc i64 @bar(i64)
76 ; CHECK-LABEL: @spill_lr_and_tail_call
77 ; CHECK: paciasp
78 ; CHECK: str x30, [sp, #-16]!
79 ; CHECK: ldr  x30, [sp], #16
80 ; CHECK: autiasp
81 ; CHECK: b  bar
82 define fastcc void @spill_lr_and_tail_call(i64 %x) "sign-return-address"="all" {
83   call void asm sideeffect "mov x30, $0", "r,~{lr}"(i64 %x) #1
84   tail call fastcc i64 @bar(i64 %x)
85   ret void
88 ; CHECK-LABEL: @leaf_sign_all_a_key
89 ; CHECK: paciasp
90 ; CHECK: autiasp
91 define i32 @leaf_sign_all_a_key(i32 %x) "sign-return-address"="all" "sign-return-address-key"="a_key" {
92   ret i32 %x
95 ; CHECK-LABEL: @leaf_sign_all_b_key
96 ; CHECK: pacibsp
97 ; CHECK: autibsp
98 define i32 @leaf_sign_all_b_key(i32 %x) "sign-return-address"="all" "sign-return-address-key"="b_key" {
99   ret i32 %x
102 ; CHECK-LABEL: @leaf_sign_all_v83_b_key
103 ; CHECK: pacibsp
104 ; CHECK-NOT: ret
105 ; CHECK: retab
106 ; CHECK-NOT: ret
107 define i32 @leaf_sign_all_v83_b_key(i32 %x) "sign-return-address"="all" "target-features"="+v8.3a" "sign-return-address-key"="b_key" {
108   ret i32 %x