1; RUN: llc -verify-machineinstrs -enable-machine-outliner -mtriple \
2; RUN: aarch64-arm-none-eabi %s -o - | FileCheck %s --check-prefixes CHECK,V8A
3; RUN-V83A: llc -verify-machineinstrs -enable-machine-outliner -mtriple \
4; RUN-V83A: aarch64-arm-none-eabi -mattr=+v8.3a %s -o - > %t
5; RUN-V83A: FileCheck --check-prefixes CHECK,V83A < %t %s
6
7define i64 @a(i64 %x) "sign-return-address"="non-leaf" "sign-return-address-key"="b_key" {
8; CHECK-LABEL:      a:                                     // @a
9; CHECK:                .cfi_b_key_frame
10; V8A-NEXT:             hint #27
11; V83A-NEXT:            pacibsp
12; CHECK-NEXT:           .cfi_negate_ra_state
13  %1 = alloca i32, align 4
14  %2 = alloca i32, align 4
15  %3 = alloca i32, align 4
16  %4 = alloca i32, align 4
17  %5 = alloca i32, align 4
18  %6 = alloca i32, align 4
19  store i32 1, i32* %1, align 4
20  store i32 2, i32* %2, align 4
21  store i32 3, i32* %3, align 4
22  store i32 4, i32* %4, align 4
23  store i32 5, i32* %5, align 4
24  store i32 6, i32* %6, align 4
25  call void asm sideeffect "mov x30, $0", "r,~{lr}"(i64 %x) #1
26  ret i64 %x
27}
28
29define i64 @b(i64 %x) "sign-return-address"="non-leaf" "sign-return-address-key"="b_key" {
30; CHECK-LABEL:      b:                                     // @b
31; CHECK:                .cfi_b_key_frame
32; V8A-NEXT:             hint #27
33; V83A-NEXT:            pacibsp
34; CHECK-NEXT:           .cfi_negate_ra_state
35  %1 = alloca i32, align 4
36  %2 = alloca i32, align 4
37  %3 = alloca i32, align 4
38  %4 = alloca i32, align 4
39  %5 = alloca i32, align 4
40  %6 = alloca i32, align 4
41  store i32 1, i32* %1, align 4
42  store i32 2, i32* %2, align 4
43  store i32 3, i32* %3, align 4
44  store i32 4, i32* %4, align 4
45  store i32 5, i32* %5, align 4
46  store i32 6, i32* %6, align 4
47  call void asm sideeffect "mov x30, $0", "r,~{lr}"(i64 %x) #1
48  ret i64 %x
49}
50
51define i64 @c(i64 %x) "sign-return-address"="non-leaf" "sign-return-address-key"="b_key" {
52; CHECK-LABEL:      c:                                     // @c
53; CHECK:                .cfi_b_key_frame
54; V8A-NEXT:             hint #27
55; V83A-NEXT:            pacibsp
56; CHECK-NEXT:           .cfi_negate_ra_state
57  %1 = alloca i32, align 4
58  %2 = alloca i32, align 4
59  %3 = alloca i32, align 4
60  %4 = alloca i32, align 4
61  %5 = alloca i32, align 4
62  %6 = alloca i32, align 4
63  store i32 1, i32* %1, align 4
64  store i32 2, i32* %2, align 4
65  store i32 3, i32* %3, align 4
66  store i32 4, i32* %4, align 4
67  store i32 5, i32* %5, align 4
68  store i32 6, i32* %6, align 4
69  call void asm sideeffect "mov x30, $0", "r,~{lr}"(i64 %x) #1
70  ret i64 %x
71}
72
73; Outlined function is leaf-function => don't sign it
74; CHECK-LABEL:      OUTLINED_FUNCTION_0:
75; CHECK-NOT:            .cfi_b_key_frame
76; CHECK-NOT:            paci{{[a,b]}}sp
77; CHECK-NOT:            hint #2{{[5,7]}}
78; CHECK-NOT:            .cfi_negate_ra_state
79; CHECK-NOT:            auti{{[a,b]}}sp
80