1; Test spilling of vector registers.
2;
3; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s
4
5; We need to allocate a 16-byte spill slot and save the 8 call-saved FPRs.
6; The frame size should be exactly 160 + 16 + 8 * 8 = 240.
7define void @f1(<16 x i8> *%ptr) {
8; CHECK-LABEL: f1:
9; CHECK: aghi %r15, -240
10; CHECK-DAG: std %f8,
11; CHECK-DAG: std %f9,
12; CHECK-DAG: std %f10,
13; CHECK-DAG: std %f11,
14; CHECK-DAG: std %f12,
15; CHECK-DAG: std %f13,
16; CHECK-DAG: std %f14,
17; CHECK-DAG: std %f15,
18; CHECK: vst {{%v[0-9]+}}, 160(%r15), 3
19; CHECK: vl {{%v[0-9]+}}, 160(%r15), 3
20; CHECK-DAG: ld %f8,
21; CHECK-DAG: ld %f9,
22; CHECK-DAG: ld %f10,
23; CHECK-DAG: ld %f11,
24; CHECK-DAG: ld %f12,
25; CHECK-DAG: ld %f13,
26; CHECK-DAG: ld %f14,
27; CHECK-DAG: ld %f15,
28; CHECK: aghi %r15, 240
29; CHECK: br %r14
30  %v0 = load volatile <16 x i8>, <16 x i8> *%ptr
31  %v1 = load volatile <16 x i8>, <16 x i8> *%ptr
32  %v2 = load volatile <16 x i8>, <16 x i8> *%ptr
33  %v3 = load volatile <16 x i8>, <16 x i8> *%ptr
34  %v4 = load volatile <16 x i8>, <16 x i8> *%ptr
35  %v5 = load volatile <16 x i8>, <16 x i8> *%ptr
36  %v6 = load volatile <16 x i8>, <16 x i8> *%ptr
37  %v7 = load volatile <16 x i8>, <16 x i8> *%ptr
38  %v8 = load volatile <16 x i8>, <16 x i8> *%ptr
39  %v9 = load volatile <16 x i8>, <16 x i8> *%ptr
40  %v10 = load volatile <16 x i8>, <16 x i8> *%ptr
41  %v11 = load volatile <16 x i8>, <16 x i8> *%ptr
42  %v12 = load volatile <16 x i8>, <16 x i8> *%ptr
43  %v13 = load volatile <16 x i8>, <16 x i8> *%ptr
44  %v14 = load volatile <16 x i8>, <16 x i8> *%ptr
45  %v15 = load volatile <16 x i8>, <16 x i8> *%ptr
46  %v16 = load volatile <16 x i8>, <16 x i8> *%ptr
47  %v17 = load volatile <16 x i8>, <16 x i8> *%ptr
48  %v18 = load volatile <16 x i8>, <16 x i8> *%ptr
49  %v19 = load volatile <16 x i8>, <16 x i8> *%ptr
50  %v20 = load volatile <16 x i8>, <16 x i8> *%ptr
51  %v21 = load volatile <16 x i8>, <16 x i8> *%ptr
52  %v22 = load volatile <16 x i8>, <16 x i8> *%ptr
53  %v23 = load volatile <16 x i8>, <16 x i8> *%ptr
54  %v24 = load volatile <16 x i8>, <16 x i8> *%ptr
55  %v25 = load volatile <16 x i8>, <16 x i8> *%ptr
56  %v26 = load volatile <16 x i8>, <16 x i8> *%ptr
57  %v27 = load volatile <16 x i8>, <16 x i8> *%ptr
58  %v28 = load volatile <16 x i8>, <16 x i8> *%ptr
59  %v29 = load volatile <16 x i8>, <16 x i8> *%ptr
60  %v30 = load volatile <16 x i8>, <16 x i8> *%ptr
61  %v31 = load volatile <16 x i8>, <16 x i8> *%ptr
62  %vx = load volatile <16 x i8>, <16 x i8> *%ptr
63  store volatile <16 x i8> %vx, <16 x i8> *%ptr
64  store volatile <16 x i8> %v31, <16 x i8> *%ptr
65  store volatile <16 x i8> %v30, <16 x i8> *%ptr
66  store volatile <16 x i8> %v29, <16 x i8> *%ptr
67  store volatile <16 x i8> %v28, <16 x i8> *%ptr
68  store volatile <16 x i8> %v27, <16 x i8> *%ptr
69  store volatile <16 x i8> %v26, <16 x i8> *%ptr
70  store volatile <16 x i8> %v25, <16 x i8> *%ptr
71  store volatile <16 x i8> %v24, <16 x i8> *%ptr
72  store volatile <16 x i8> %v23, <16 x i8> *%ptr
73  store volatile <16 x i8> %v22, <16 x i8> *%ptr
74  store volatile <16 x i8> %v21, <16 x i8> *%ptr
75  store volatile <16 x i8> %v20, <16 x i8> *%ptr
76  store volatile <16 x i8> %v19, <16 x i8> *%ptr
77  store volatile <16 x i8> %v18, <16 x i8> *%ptr
78  store volatile <16 x i8> %v17, <16 x i8> *%ptr
79  store volatile <16 x i8> %v16, <16 x i8> *%ptr
80  store volatile <16 x i8> %v15, <16 x i8> *%ptr
81  store volatile <16 x i8> %v14, <16 x i8> *%ptr
82  store volatile <16 x i8> %v13, <16 x i8> *%ptr
83  store volatile <16 x i8> %v12, <16 x i8> *%ptr
84  store volatile <16 x i8> %v11, <16 x i8> *%ptr
85  store volatile <16 x i8> %v10, <16 x i8> *%ptr
86  store volatile <16 x i8> %v9, <16 x i8> *%ptr
87  store volatile <16 x i8> %v8, <16 x i8> *%ptr
88  store volatile <16 x i8> %v7, <16 x i8> *%ptr
89  store volatile <16 x i8> %v6, <16 x i8> *%ptr
90  store volatile <16 x i8> %v5, <16 x i8> *%ptr
91  store volatile <16 x i8> %v4, <16 x i8> *%ptr
92  store volatile <16 x i8> %v3, <16 x i8> *%ptr
93  store volatile <16 x i8> %v2, <16 x i8> *%ptr
94  store volatile <16 x i8> %v1, <16 x i8> *%ptr
95  store volatile <16 x i8> %v0, <16 x i8> *%ptr
96  ret void
97}
98
99; Like f1, but no 16-byte slot should be needed, and no outgoing reg save
100; area of 160 bytes.
101define void @f2(<16 x i8> *%ptr) {
102; CHECK-LABEL: f2:
103; CHECK: aghi %r15, -64
104; CHECK-DAG: std %f8,
105; CHECK-DAG: std %f9,
106; CHECK-DAG: std %f10,
107; CHECK-DAG: std %f11,
108; CHECK-DAG: std %f12,
109; CHECK-DAG: std %f13,
110; CHECK-DAG: std %f14,
111; CHECK-DAG: std %f15,
112; CHECK-NOT: vst {{.*}}(%r15)
113; CHECK-NOT: vl {{.*}}(%r15)
114; CHECK-DAG: ld %f8,
115; CHECK-DAG: ld %f9,
116; CHECK-DAG: ld %f10,
117; CHECK-DAG: ld %f11,
118; CHECK-DAG: ld %f12,
119; CHECK-DAG: ld %f13,
120; CHECK-DAG: ld %f14,
121; CHECK-DAG: ld %f15,
122; CHECK: aghi %r15, 64
123; CHECK: br %r14
124  %v0 = load volatile <16 x i8>, <16 x i8> *%ptr
125  %v1 = load volatile <16 x i8>, <16 x i8> *%ptr
126  %v2 = load volatile <16 x i8>, <16 x i8> *%ptr
127  %v3 = load volatile <16 x i8>, <16 x i8> *%ptr
128  %v4 = load volatile <16 x i8>, <16 x i8> *%ptr
129  %v5 = load volatile <16 x i8>, <16 x i8> *%ptr
130  %v6 = load volatile <16 x i8>, <16 x i8> *%ptr
131  %v7 = load volatile <16 x i8>, <16 x i8> *%ptr
132  %v8 = load volatile <16 x i8>, <16 x i8> *%ptr
133  %v9 = load volatile <16 x i8>, <16 x i8> *%ptr
134  %v10 = load volatile <16 x i8>, <16 x i8> *%ptr
135  %v11 = load volatile <16 x i8>, <16 x i8> *%ptr
136  %v12 = load volatile <16 x i8>, <16 x i8> *%ptr
137  %v13 = load volatile <16 x i8>, <16 x i8> *%ptr
138  %v14 = load volatile <16 x i8>, <16 x i8> *%ptr
139  %v15 = load volatile <16 x i8>, <16 x i8> *%ptr
140  %v16 = load volatile <16 x i8>, <16 x i8> *%ptr
141  %v17 = load volatile <16 x i8>, <16 x i8> *%ptr
142  %v18 = load volatile <16 x i8>, <16 x i8> *%ptr
143  %v19 = load volatile <16 x i8>, <16 x i8> *%ptr
144  %v20 = load volatile <16 x i8>, <16 x i8> *%ptr
145  %v21 = load volatile <16 x i8>, <16 x i8> *%ptr
146  %v22 = load volatile <16 x i8>, <16 x i8> *%ptr
147  %v23 = load volatile <16 x i8>, <16 x i8> *%ptr
148  %v24 = load volatile <16 x i8>, <16 x i8> *%ptr
149  %v25 = load volatile <16 x i8>, <16 x i8> *%ptr
150  %v26 = load volatile <16 x i8>, <16 x i8> *%ptr
151  %v27 = load volatile <16 x i8>, <16 x i8> *%ptr
152  %v28 = load volatile <16 x i8>, <16 x i8> *%ptr
153  %v29 = load volatile <16 x i8>, <16 x i8> *%ptr
154  %v30 = load volatile <16 x i8>, <16 x i8> *%ptr
155  %v31 = load volatile <16 x i8>, <16 x i8> *%ptr
156  store volatile <16 x i8> %v31, <16 x i8> *%ptr
157  store volatile <16 x i8> %v30, <16 x i8> *%ptr
158  store volatile <16 x i8> %v29, <16 x i8> *%ptr
159  store volatile <16 x i8> %v28, <16 x i8> *%ptr
160  store volatile <16 x i8> %v27, <16 x i8> *%ptr
161  store volatile <16 x i8> %v26, <16 x i8> *%ptr
162  store volatile <16 x i8> %v25, <16 x i8> *%ptr
163  store volatile <16 x i8> %v24, <16 x i8> *%ptr
164  store volatile <16 x i8> %v23, <16 x i8> *%ptr
165  store volatile <16 x i8> %v22, <16 x i8> *%ptr
166  store volatile <16 x i8> %v21, <16 x i8> *%ptr
167  store volatile <16 x i8> %v20, <16 x i8> *%ptr
168  store volatile <16 x i8> %v19, <16 x i8> *%ptr
169  store volatile <16 x i8> %v18, <16 x i8> *%ptr
170  store volatile <16 x i8> %v17, <16 x i8> *%ptr
171  store volatile <16 x i8> %v16, <16 x i8> *%ptr
172  store volatile <16 x i8> %v15, <16 x i8> *%ptr
173  store volatile <16 x i8> %v14, <16 x i8> *%ptr
174  store volatile <16 x i8> %v13, <16 x i8> *%ptr
175  store volatile <16 x i8> %v12, <16 x i8> *%ptr
176  store volatile <16 x i8> %v11, <16 x i8> *%ptr
177  store volatile <16 x i8> %v10, <16 x i8> *%ptr
178  store volatile <16 x i8> %v9, <16 x i8> *%ptr
179  store volatile <16 x i8> %v8, <16 x i8> *%ptr
180  store volatile <16 x i8> %v7, <16 x i8> *%ptr
181  store volatile <16 x i8> %v6, <16 x i8> *%ptr
182  store volatile <16 x i8> %v5, <16 x i8> *%ptr
183  store volatile <16 x i8> %v4, <16 x i8> *%ptr
184  store volatile <16 x i8> %v3, <16 x i8> *%ptr
185  store volatile <16 x i8> %v2, <16 x i8> *%ptr
186  store volatile <16 x i8> %v1, <16 x i8> *%ptr
187  store volatile <16 x i8> %v0, <16 x i8> *%ptr
188  ret void
189}
190
191; Like f2, but only %f8 should be saved.
192define void @f3(<16 x i8> *%ptr) {
193; CHECK-LABEL: f3:
194; CHECK: aghi %r15, -8
195; CHECK-DAG: std %f8,
196; CHECK-NOT: vst {{.*}}(%r15)
197; CHECK-NOT: vl {{.*}}(%r15)
198; CHECK-NOT: %v9
199; CHECK-NOT: %v10
200; CHECK-NOT: %v11
201; CHECK-NOT: %v12
202; CHECK-NOT: %v13
203; CHECK-NOT: %v14
204; CHECK-NOT: %v15
205; CHECK-DAG: ld %f8,
206; CHECK: aghi %r15, 8
207; CHECK: br %r14
208  %v0 = load volatile <16 x i8>, <16 x i8> *%ptr
209  %v1 = load volatile <16 x i8>, <16 x i8> *%ptr
210  %v2 = load volatile <16 x i8>, <16 x i8> *%ptr
211  %v3 = load volatile <16 x i8>, <16 x i8> *%ptr
212  %v4 = load volatile <16 x i8>, <16 x i8> *%ptr
213  %v5 = load volatile <16 x i8>, <16 x i8> *%ptr
214  %v6 = load volatile <16 x i8>, <16 x i8> *%ptr
215  %v7 = load volatile <16 x i8>, <16 x i8> *%ptr
216  %v8 = load volatile <16 x i8>, <16 x i8> *%ptr
217  %v16 = load volatile <16 x i8>, <16 x i8> *%ptr
218  %v17 = load volatile <16 x i8>, <16 x i8> *%ptr
219  %v18 = load volatile <16 x i8>, <16 x i8> *%ptr
220  %v19 = load volatile <16 x i8>, <16 x i8> *%ptr
221  %v20 = load volatile <16 x i8>, <16 x i8> *%ptr
222  %v21 = load volatile <16 x i8>, <16 x i8> *%ptr
223  %v22 = load volatile <16 x i8>, <16 x i8> *%ptr
224  %v23 = load volatile <16 x i8>, <16 x i8> *%ptr
225  %v24 = load volatile <16 x i8>, <16 x i8> *%ptr
226  %v25 = load volatile <16 x i8>, <16 x i8> *%ptr
227  %v26 = load volatile <16 x i8>, <16 x i8> *%ptr
228  %v27 = load volatile <16 x i8>, <16 x i8> *%ptr
229  %v28 = load volatile <16 x i8>, <16 x i8> *%ptr
230  %v29 = load volatile <16 x i8>, <16 x i8> *%ptr
231  %v30 = load volatile <16 x i8>, <16 x i8> *%ptr
232  %v31 = load volatile <16 x i8>, <16 x i8> *%ptr
233  store volatile <16 x i8> %v31, <16 x i8> *%ptr
234  store volatile <16 x i8> %v30, <16 x i8> *%ptr
235  store volatile <16 x i8> %v29, <16 x i8> *%ptr
236  store volatile <16 x i8> %v28, <16 x i8> *%ptr
237  store volatile <16 x i8> %v27, <16 x i8> *%ptr
238  store volatile <16 x i8> %v26, <16 x i8> *%ptr
239  store volatile <16 x i8> %v25, <16 x i8> *%ptr
240  store volatile <16 x i8> %v24, <16 x i8> *%ptr
241  store volatile <16 x i8> %v23, <16 x i8> *%ptr
242  store volatile <16 x i8> %v22, <16 x i8> *%ptr
243  store volatile <16 x i8> %v21, <16 x i8> *%ptr
244  store volatile <16 x i8> %v20, <16 x i8> *%ptr
245  store volatile <16 x i8> %v19, <16 x i8> *%ptr
246  store volatile <16 x i8> %v18, <16 x i8> *%ptr
247  store volatile <16 x i8> %v17, <16 x i8> *%ptr
248  store volatile <16 x i8> %v16, <16 x i8> *%ptr
249  store volatile <16 x i8> %v8, <16 x i8> *%ptr
250  store volatile <16 x i8> %v7, <16 x i8> *%ptr
251  store volatile <16 x i8> %v6, <16 x i8> *%ptr
252  store volatile <16 x i8> %v5, <16 x i8> *%ptr
253  store volatile <16 x i8> %v4, <16 x i8> *%ptr
254  store volatile <16 x i8> %v3, <16 x i8> *%ptr
255  store volatile <16 x i8> %v2, <16 x i8> *%ptr
256  store volatile <16 x i8> %v1, <16 x i8> *%ptr
257  store volatile <16 x i8> %v0, <16 x i8> *%ptr
258  ret void
259}
260
261; Like f2, but no registers should be saved.
262define void @f4(<16 x i8> *%ptr) {
263; CHECK-LABEL: f4:
264; CHECK-NOT: %r15
265; CHECK: br %r14
266  %v0 = load volatile <16 x i8>, <16 x i8> *%ptr
267  %v1 = load volatile <16 x i8>, <16 x i8> *%ptr
268  %v2 = load volatile <16 x i8>, <16 x i8> *%ptr
269  %v3 = load volatile <16 x i8>, <16 x i8> *%ptr
270  %v4 = load volatile <16 x i8>, <16 x i8> *%ptr
271  %v5 = load volatile <16 x i8>, <16 x i8> *%ptr
272  %v6 = load volatile <16 x i8>, <16 x i8> *%ptr
273  %v7 = load volatile <16 x i8>, <16 x i8> *%ptr
274  %v16 = load volatile <16 x i8>, <16 x i8> *%ptr
275  %v17 = load volatile <16 x i8>, <16 x i8> *%ptr
276  %v18 = load volatile <16 x i8>, <16 x i8> *%ptr
277  %v19 = load volatile <16 x i8>, <16 x i8> *%ptr
278  %v20 = load volatile <16 x i8>, <16 x i8> *%ptr
279  %v21 = load volatile <16 x i8>, <16 x i8> *%ptr
280  %v22 = load volatile <16 x i8>, <16 x i8> *%ptr
281  %v23 = load volatile <16 x i8>, <16 x i8> *%ptr
282  %v24 = load volatile <16 x i8>, <16 x i8> *%ptr
283  %v25 = load volatile <16 x i8>, <16 x i8> *%ptr
284  %v26 = load volatile <16 x i8>, <16 x i8> *%ptr
285  %v27 = load volatile <16 x i8>, <16 x i8> *%ptr
286  %v28 = load volatile <16 x i8>, <16 x i8> *%ptr
287  %v29 = load volatile <16 x i8>, <16 x i8> *%ptr
288  %v30 = load volatile <16 x i8>, <16 x i8> *%ptr
289  %v31 = load volatile <16 x i8>, <16 x i8> *%ptr
290  store volatile <16 x i8> %v31, <16 x i8> *%ptr
291  store volatile <16 x i8> %v30, <16 x i8> *%ptr
292  store volatile <16 x i8> %v29, <16 x i8> *%ptr
293  store volatile <16 x i8> %v28, <16 x i8> *%ptr
294  store volatile <16 x i8> %v27, <16 x i8> *%ptr
295  store volatile <16 x i8> %v26, <16 x i8> *%ptr
296  store volatile <16 x i8> %v25, <16 x i8> *%ptr
297  store volatile <16 x i8> %v24, <16 x i8> *%ptr
298  store volatile <16 x i8> %v23, <16 x i8> *%ptr
299  store volatile <16 x i8> %v22, <16 x i8> *%ptr
300  store volatile <16 x i8> %v21, <16 x i8> *%ptr
301  store volatile <16 x i8> %v20, <16 x i8> *%ptr
302  store volatile <16 x i8> %v19, <16 x i8> *%ptr
303  store volatile <16 x i8> %v18, <16 x i8> *%ptr
304  store volatile <16 x i8> %v17, <16 x i8> *%ptr
305  store volatile <16 x i8> %v16, <16 x i8> *%ptr
306  store volatile <16 x i8> %v7, <16 x i8> *%ptr
307  store volatile <16 x i8> %v6, <16 x i8> *%ptr
308  store volatile <16 x i8> %v5, <16 x i8> *%ptr
309  store volatile <16 x i8> %v4, <16 x i8> *%ptr
310  store volatile <16 x i8> %v3, <16 x i8> *%ptr
311  store volatile <16 x i8> %v2, <16 x i8> *%ptr
312  store volatile <16 x i8> %v1, <16 x i8> *%ptr
313  store volatile <16 x i8> %v0, <16 x i8> *%ptr
314  ret void
315}
316