1 ; RUN: llc -mtriple=arm64-linux-gnu -mattr=+call-saved-x8 -o - %s \
2 ; RUN: | FileCheck %s --check-prefix=CHECK-SAVED-X8
4 ; RUN: llc -mtriple=arm64-linux-gnu -mattr=+call-saved-x9 -o - %s \
5 ; RUN: | FileCheck %s --check-prefix=CHECK-SAVED-X9
7 ; RUN: llc -mtriple=arm64-linux-gnu -mattr=+call-saved-x10 -o - %s \
8 ; RUN: | FileCheck %s --check-prefix=CHECK-SAVED-X10
10 ; RUN: llc -mtriple=arm64-linux-gnu -mattr=+call-saved-x11 -o - %s \
11 ; RUN: | FileCheck %s --check-prefix=CHECK-SAVED-X11
13 ; RUN: llc -mtriple=arm64-linux-gnu -mattr=+call-saved-x12 -o - %s \
14 ; RUN: | FileCheck %s --check-prefix=CHECK-SAVED-X12
16 ; RUN: llc -mtriple=arm64-linux-gnu -mattr=+call-saved-x13 -o - %s \
17 ; RUN: | FileCheck %s --check-prefix=CHECK-SAVED-X13
19 ; RUN: llc -mtriple=arm64-linux-gnu -mattr=+call-saved-x14 -o - %s \
20 ; RUN: | FileCheck %s --check-prefix=CHECK-SAVED-X14
22 ; RUN: llc -mtriple=arm64-linux-gnu -mattr=+call-saved-x15 -o - %s \
23 ; RUN: | FileCheck %s --check-prefix=CHECK-SAVED-X15
25 ; RUN: llc -mtriple=arm64-linux-gnu -mattr=+call-saved-x18 -o - %s \
26 ; RUN: | FileCheck %s --check-prefix=CHECK-SAVED-X18
28 ; Test all call-saved-x# options together.
29 ; RUN: llc -mtriple=arm64-linux-gnu \
30 ; RUN: -mattr=+call-saved-x8 \
31 ; RUN: -mattr=+call-saved-x9 \
32 ; RUN: -mattr=+call-saved-x10 \
33 ; RUN: -mattr=+call-saved-x11 \
34 ; RUN: -mattr=+call-saved-x12 \
35 ; RUN: -mattr=+call-saved-x13 \
36 ; RUN: -mattr=+call-saved-x14 \
37 ; RUN: -mattr=+call-saved-x15 \
38 ; RUN: -mattr=+call-saved-x18 \
39 ; RUN: -o - %s | FileCheck %s \
40 ; RUN: --check-prefix=CHECK-SAVED-ALL
43 ; RUN: llc -mtriple=arm64-linux-gnu \
44 ; RUN: -mattr=+call-saved-x8 \
45 ; RUN: -mattr=+call-saved-x9 \
46 ; RUN: -mattr=+call-saved-x10 \
47 ; RUN: -mattr=+call-saved-x11 \
48 ; RUN: -mattr=+call-saved-x12 \
49 ; RUN: -mattr=+call-saved-x13 \
50 ; RUN: -mattr=+call-saved-x14 \
51 ; RUN: -mattr=+call-saved-x15 \
52 ; RUN: -mattr=+call-saved-x18 \
54 ; RUN: -o - %s | FileCheck %s \
55 ; RUN: --check-prefix=CHECK-SAVED-ALL-GISEL
57 ; Used to exhaust the supply of GPRs.
58 @var = dso_local global [30 x i64] zeroinitializer
60 ; Check that callee preserves additional CSRs.
61 define dso_local void @callee() {
64 ; CHECK-SAVED-X8: str x8, [sp
65 ; CHECK-SAVED-X9: str x9, [sp
66 ; CHECK-SAVED-X10: str x10, [sp
67 ; CHECK-SAVED-X11: str x11, [sp
68 ; CHECK-SAVED-X12: str x12, [sp
69 ; CHECK-SAVED-X13: str x13, [sp
70 ; CHECK-SAVED-X14: str x14, [sp
71 ; CHECK-SAVED-X15: str x15, [sp
72 ; CHECK-SAVED-X18: str x18, [sp
74 ; CHECK-SAVED-ALL: str x18, [sp
75 ; CHECK-SAVED-ALL-NEXT: stp x15, x14, [sp
76 ; CHECK-SAVED-ALL-NEXT: stp x13, x12, [sp
77 ; CHECK-SAVED-ALL-NEXT: stp x11, x10, [sp
78 ; CHECK-SAVED-ALL-NEXT: stp x9, x8, [sp
80 %val = load volatile [30 x i64], ptr @var
81 store volatile [30 x i64] %val, ptr @var
83 ; CHECK-SAVED-ALL: ldp x9, x8, [sp
84 ; CHECK-SAVED-ALL-NEXT: ldp x11, x10, [sp
85 ; CHECK-SAVED-ALL-NEXT: ldp x13, x12, [sp
86 ; CHECK-SAVED-ALL-NEXT: ldp x15, x14, [sp
87 ; CHECK-SAVED-ALL-NEXT: ldr x18, [sp
89 ; CHECK-SAVED-X8: ldr x8, [sp
90 ; CHECK-SAVED-X9: ldr x9, [sp
91 ; CHECK-SAVED-X10: ldr x10, [sp
92 ; CHECK-SAVED-X11: ldr x11, [sp
93 ; CHECK-SAVED-X12: ldr x12, [sp
94 ; CHECK-SAVED-X13: ldr x13, [sp
95 ; CHECK-SAVED-X14: ldr x14, [sp
96 ; CHECK-SAVED-X15: ldr x15, [sp
97 ; CHECK-SAVED-X18: ldr x18, [sp
102 ; Check that caller doesn't shy away from allocating additional CSRs.
103 define dso_local void @caller() {
104 ; CHECK-LABEL: caller
106 %val = load volatile [30 x i64], ptr @var
107 ; CHECK-SAVED-X8: adrp x8, var
108 ; CHECK-SAVED-X9: adrp x9, var
109 ; CHECK-SAVED-X10: adrp x10, var
110 ; CHECK-SAVED-X11: adrp x11, var
111 ; CHECK-SAVED-X12: adrp x12, var
112 ; CHECK-SAVED-X13: adrp x13, var
113 ; CHECK-SAVED-X14: adrp x14, var
114 ; CHECK-SAVED-X15: adrp x15, var
115 ; CHECK-SAVED-X18: adrp x18, var
117 ; CHECK-SAVED-ALL: adrp x8, var
118 ; CHECK-SAVED-ALL-DAG: ldr x9
119 ; CHECK-SAVED-ALL-DAG: ldr x10
120 ; CHECK-SAVED-ALL-DAG: ldr x11
121 ; CHECK-SAVED-ALL-DAG: ldr x12
122 ; CHECK-SAVED-ALL-DAG: ldr x13
123 ; CHECK-SAVED-ALL-DAG: ldr x14
124 ; CHECK-SAVED-ALL-DAG: ldr x15
125 ; CHECK-SAVED-ALL-DAG: ldr x18
127 ; CHECK-SAVED-ALL-GISEL: adrp x16, var
128 ; CHECK-SAVED-ALL-GISEL-DAG: ldr x8
129 ; CHECK-SAVED-ALL-GISEL-DAG: ldr x9
130 ; CHECK-SAVED-ALL-GISEL-DAG: ldr x10
131 ; CHECK-SAVED-ALL-GISEL-DAG: ldr x11
132 ; CHECK-SAVED-ALL-GISEL-DAG: ldr x12
133 ; CHECK-SAVED-ALL-GISEL-DAG: ldr x13
134 ; CHECK-SAVED-ALL-GISEL-DAG: ldr x14
135 ; CHECK-SAVED-ALL-GISEL-DAG: ldr x15
136 ; CHECK-SAVED-ALL-GISEL-DAG: ldr x18
141 store volatile [30 x i64] %val, ptr @var
142 ; CHECK-SAVED-ALL-DAG: str x9
143 ; CHECK-SAVED-ALL-DAG: str x10
144 ; CHECK-SAVED-ALL-DAG: str x11
145 ; CHECK-SAVED-ALL-DAG: str x12
146 ; CHECK-SAVED-ALL-DAG: str x13
147 ; CHECK-SAVED-ALL-DAG: str x14
148 ; CHECK-SAVED-ALL-DAG: str x15
149 ; CHECK-SAVED-ALL-DAG: str x18