1; Test spills of zero extensions when high GR32s are available.
2;
3; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z196 | FileCheck %s
4
5; Test a case where we spill the source of at least one LLCRMux.  We want
6; to use LLC(H) if possible.
7define void @f1(i32 *%ptr) {
8; CHECK-LABEL: f1:
9; CHECK: llc{{h?}} {{%r[0-9]+}}, 1{{[67]}}{{[379]}}(%r15)
10; CHECK: br %r14
11  %val0 = load volatile i32, i32 *%ptr
12  %val1 = load volatile i32, i32 *%ptr
13  %val2 = load volatile i32, i32 *%ptr
14  %val3 = load volatile i32, i32 *%ptr
15  %val4 = load volatile i32, i32 *%ptr
16  %val5 = load volatile i32, i32 *%ptr
17  %val6 = load volatile i32, i32 *%ptr
18  %val7 = load volatile i32, i32 *%ptr
19  %val8 = load volatile i32, i32 *%ptr
20  %val9 = load volatile i32, i32 *%ptr
21  %val10 = load volatile i32, i32 *%ptr
22  %val11 = load volatile i32, i32 *%ptr
23  %val12 = load volatile i32, i32 *%ptr
24  %val13 = load volatile i32, i32 *%ptr
25  %val14 = load volatile i32, i32 *%ptr
26  %val15 = load volatile i32, i32 *%ptr
27  %val16 = load volatile i32, i32 *%ptr
28  %val17 = load volatile i32, i32 *%ptr
29  %val18 = load volatile i32, i32 *%ptr
30  %val19 = load volatile i32, i32 *%ptr
31  %val20 = load volatile i32, i32 *%ptr
32  %val21 = load volatile i32, i32 *%ptr
33  %val22 = load volatile i32, i32 *%ptr
34  %val23 = load volatile i32, i32 *%ptr
35  %val24 = load volatile i32, i32 *%ptr
36  %val25 = load volatile i32, i32 *%ptr
37  %val26 = load volatile i32, i32 *%ptr
38  %val27 = load volatile i32, i32 *%ptr
39  %val28 = load volatile i32, i32 *%ptr
40  %val29 = load volatile i32, i32 *%ptr
41  %val30 = load volatile i32, i32 *%ptr
42  %val31 = load volatile i32, i32 *%ptr
43
44  %trunc0 = trunc i32 %val0 to i8
45  %trunc1 = trunc i32 %val1 to i8
46  %trunc2 = trunc i32 %val2 to i8
47  %trunc3 = trunc i32 %val3 to i8
48  %trunc4 = trunc i32 %val4 to i8
49  %trunc5 = trunc i32 %val5 to i8
50  %trunc6 = trunc i32 %val6 to i8
51  %trunc7 = trunc i32 %val7 to i8
52  %trunc8 = trunc i32 %val8 to i8
53  %trunc9 = trunc i32 %val9 to i8
54  %trunc10 = trunc i32 %val10 to i8
55  %trunc11 = trunc i32 %val11 to i8
56  %trunc12 = trunc i32 %val12 to i8
57  %trunc13 = trunc i32 %val13 to i8
58  %trunc14 = trunc i32 %val14 to i8
59  %trunc15 = trunc i32 %val15 to i8
60  %trunc16 = trunc i32 %val16 to i8
61  %trunc17 = trunc i32 %val17 to i8
62  %trunc18 = trunc i32 %val18 to i8
63  %trunc19 = trunc i32 %val19 to i8
64  %trunc20 = trunc i32 %val20 to i8
65  %trunc21 = trunc i32 %val21 to i8
66  %trunc22 = trunc i32 %val22 to i8
67  %trunc23 = trunc i32 %val23 to i8
68  %trunc24 = trunc i32 %val24 to i8
69  %trunc25 = trunc i32 %val25 to i8
70  %trunc26 = trunc i32 %val26 to i8
71  %trunc27 = trunc i32 %val27 to i8
72  %trunc28 = trunc i32 %val28 to i8
73  %trunc29 = trunc i32 %val29 to i8
74  %trunc30 = trunc i32 %val30 to i8
75  %trunc31 = trunc i32 %val31 to i8
76
77  %ext0 = zext i8 %trunc0 to i32
78  %ext1 = zext i8 %trunc1 to i32
79  %ext2 = zext i8 %trunc2 to i32
80  %ext3 = zext i8 %trunc3 to i32
81  %ext4 = zext i8 %trunc4 to i32
82  %ext5 = zext i8 %trunc5 to i32
83  %ext6 = zext i8 %trunc6 to i32
84  %ext7 = zext i8 %trunc7 to i32
85  %ext8 = zext i8 %trunc8 to i32
86  %ext9 = zext i8 %trunc9 to i32
87  %ext10 = zext i8 %trunc10 to i32
88  %ext11 = zext i8 %trunc11 to i32
89  %ext12 = zext i8 %trunc12 to i32
90  %ext13 = zext i8 %trunc13 to i32
91  %ext14 = zext i8 %trunc14 to i32
92  %ext15 = zext i8 %trunc15 to i32
93  %ext16 = zext i8 %trunc16 to i32
94  %ext17 = zext i8 %trunc17 to i32
95  %ext18 = zext i8 %trunc18 to i32
96  %ext19 = zext i8 %trunc19 to i32
97  %ext20 = zext i8 %trunc20 to i32
98  %ext21 = zext i8 %trunc21 to i32
99  %ext22 = zext i8 %trunc22 to i32
100  %ext23 = zext i8 %trunc23 to i32
101  %ext24 = zext i8 %trunc24 to i32
102  %ext25 = zext i8 %trunc25 to i32
103  %ext26 = zext i8 %trunc26 to i32
104  %ext27 = zext i8 %trunc27 to i32
105  %ext28 = zext i8 %trunc28 to i32
106  %ext29 = zext i8 %trunc29 to i32
107  %ext30 = zext i8 %trunc30 to i32
108  %ext31 = zext i8 %trunc31 to i32
109
110  store volatile i32 %val0, i32 *%ptr
111  store volatile i32 %val1, i32 *%ptr
112  store volatile i32 %val2, i32 *%ptr
113  store volatile i32 %val3, i32 *%ptr
114  store volatile i32 %val4, i32 *%ptr
115  store volatile i32 %val5, i32 *%ptr
116  store volatile i32 %val6, i32 *%ptr
117  store volatile i32 %val7, i32 *%ptr
118  store volatile i32 %val8, i32 *%ptr
119  store volatile i32 %val9, i32 *%ptr
120  store volatile i32 %val10, i32 *%ptr
121  store volatile i32 %val11, i32 *%ptr
122  store volatile i32 %val12, i32 *%ptr
123  store volatile i32 %val13, i32 *%ptr
124  store volatile i32 %val14, i32 *%ptr
125  store volatile i32 %val15, i32 *%ptr
126  store volatile i32 %val16, i32 *%ptr
127  store volatile i32 %val17, i32 *%ptr
128  store volatile i32 %val18, i32 *%ptr
129  store volatile i32 %val19, i32 *%ptr
130  store volatile i32 %val20, i32 *%ptr
131  store volatile i32 %val21, i32 *%ptr
132  store volatile i32 %val22, i32 *%ptr
133  store volatile i32 %val23, i32 *%ptr
134  store volatile i32 %val24, i32 *%ptr
135  store volatile i32 %val25, i32 *%ptr
136  store volatile i32 %val26, i32 *%ptr
137  store volatile i32 %val27, i32 *%ptr
138  store volatile i32 %val28, i32 *%ptr
139  store volatile i32 %val29, i32 *%ptr
140  store volatile i32 %val30, i32 *%ptr
141  store volatile i32 %val31, i32 *%ptr
142
143  store volatile i32 %ext0, i32 *%ptr
144  store volatile i32 %ext1, i32 *%ptr
145  store volatile i32 %ext2, i32 *%ptr
146  store volatile i32 %ext3, i32 *%ptr
147  store volatile i32 %ext4, i32 *%ptr
148  store volatile i32 %ext5, i32 *%ptr
149  store volatile i32 %ext6, i32 *%ptr
150  store volatile i32 %ext7, i32 *%ptr
151  store volatile i32 %ext8, i32 *%ptr
152  store volatile i32 %ext9, i32 *%ptr
153  store volatile i32 %ext10, i32 *%ptr
154  store volatile i32 %ext11, i32 *%ptr
155  store volatile i32 %ext12, i32 *%ptr
156  store volatile i32 %ext13, i32 *%ptr
157  store volatile i32 %ext14, i32 *%ptr
158  store volatile i32 %ext15, i32 *%ptr
159  store volatile i32 %ext16, i32 *%ptr
160  store volatile i32 %ext17, i32 *%ptr
161  store volatile i32 %ext18, i32 *%ptr
162  store volatile i32 %ext19, i32 *%ptr
163  store volatile i32 %ext20, i32 *%ptr
164  store volatile i32 %ext21, i32 *%ptr
165  store volatile i32 %ext22, i32 *%ptr
166  store volatile i32 %ext23, i32 *%ptr
167  store volatile i32 %ext24, i32 *%ptr
168  store volatile i32 %ext25, i32 *%ptr
169  store volatile i32 %ext26, i32 *%ptr
170  store volatile i32 %ext27, i32 *%ptr
171  store volatile i32 %ext28, i32 *%ptr
172  store volatile i32 %ext29, i32 *%ptr
173  store volatile i32 %ext30, i32 *%ptr
174  store volatile i32 %ext31, i32 *%ptr
175
176  ret void
177}
178
179; Same again with i16, which should use LLH(H).
180define void @f2(i32 *%ptr) {
181; CHECK-LABEL: f2:
182; CHECK: llh{{h?}} {{%r[0-9]+}}, 1{{[67]}}{{[268]}}(%r15)
183; CHECK: br %r14
184  %val0 = load volatile i32, i32 *%ptr
185  %val1 = load volatile i32, i32 *%ptr
186  %val2 = load volatile i32, i32 *%ptr
187  %val3 = load volatile i32, i32 *%ptr
188  %val4 = load volatile i32, i32 *%ptr
189  %val5 = load volatile i32, i32 *%ptr
190  %val6 = load volatile i32, i32 *%ptr
191  %val7 = load volatile i32, i32 *%ptr
192  %val8 = load volatile i32, i32 *%ptr
193  %val9 = load volatile i32, i32 *%ptr
194  %val10 = load volatile i32, i32 *%ptr
195  %val11 = load volatile i32, i32 *%ptr
196  %val12 = load volatile i32, i32 *%ptr
197  %val13 = load volatile i32, i32 *%ptr
198  %val14 = load volatile i32, i32 *%ptr
199  %val15 = load volatile i32, i32 *%ptr
200  %val16 = load volatile i32, i32 *%ptr
201  %val17 = load volatile i32, i32 *%ptr
202  %val18 = load volatile i32, i32 *%ptr
203  %val19 = load volatile i32, i32 *%ptr
204  %val20 = load volatile i32, i32 *%ptr
205  %val21 = load volatile i32, i32 *%ptr
206  %val22 = load volatile i32, i32 *%ptr
207  %val23 = load volatile i32, i32 *%ptr
208  %val24 = load volatile i32, i32 *%ptr
209  %val25 = load volatile i32, i32 *%ptr
210  %val26 = load volatile i32, i32 *%ptr
211  %val27 = load volatile i32, i32 *%ptr
212  %val28 = load volatile i32, i32 *%ptr
213  %val29 = load volatile i32, i32 *%ptr
214  %val30 = load volatile i32, i32 *%ptr
215  %val31 = load volatile i32, i32 *%ptr
216
217  %trunc0 = trunc i32 %val0 to i16
218  %trunc1 = trunc i32 %val1 to i16
219  %trunc2 = trunc i32 %val2 to i16
220  %trunc3 = trunc i32 %val3 to i16
221  %trunc4 = trunc i32 %val4 to i16
222  %trunc5 = trunc i32 %val5 to i16
223  %trunc6 = trunc i32 %val6 to i16
224  %trunc7 = trunc i32 %val7 to i16
225  %trunc8 = trunc i32 %val8 to i16
226  %trunc9 = trunc i32 %val9 to i16
227  %trunc10 = trunc i32 %val10 to i16
228  %trunc11 = trunc i32 %val11 to i16
229  %trunc12 = trunc i32 %val12 to i16
230  %trunc13 = trunc i32 %val13 to i16
231  %trunc14 = trunc i32 %val14 to i16
232  %trunc15 = trunc i32 %val15 to i16
233  %trunc16 = trunc i32 %val16 to i16
234  %trunc17 = trunc i32 %val17 to i16
235  %trunc18 = trunc i32 %val18 to i16
236  %trunc19 = trunc i32 %val19 to i16
237  %trunc20 = trunc i32 %val20 to i16
238  %trunc21 = trunc i32 %val21 to i16
239  %trunc22 = trunc i32 %val22 to i16
240  %trunc23 = trunc i32 %val23 to i16
241  %trunc24 = trunc i32 %val24 to i16
242  %trunc25 = trunc i32 %val25 to i16
243  %trunc26 = trunc i32 %val26 to i16
244  %trunc27 = trunc i32 %val27 to i16
245  %trunc28 = trunc i32 %val28 to i16
246  %trunc29 = trunc i32 %val29 to i16
247  %trunc30 = trunc i32 %val30 to i16
248  %trunc31 = trunc i32 %val31 to i16
249
250  %ext0 = zext i16 %trunc0 to i32
251  %ext1 = zext i16 %trunc1 to i32
252  %ext2 = zext i16 %trunc2 to i32
253  %ext3 = zext i16 %trunc3 to i32
254  %ext4 = zext i16 %trunc4 to i32
255  %ext5 = zext i16 %trunc5 to i32
256  %ext6 = zext i16 %trunc6 to i32
257  %ext7 = zext i16 %trunc7 to i32
258  %ext8 = zext i16 %trunc8 to i32
259  %ext9 = zext i16 %trunc9 to i32
260  %ext10 = zext i16 %trunc10 to i32
261  %ext11 = zext i16 %trunc11 to i32
262  %ext12 = zext i16 %trunc12 to i32
263  %ext13 = zext i16 %trunc13 to i32
264  %ext14 = zext i16 %trunc14 to i32
265  %ext15 = zext i16 %trunc15 to i32
266  %ext16 = zext i16 %trunc16 to i32
267  %ext17 = zext i16 %trunc17 to i32
268  %ext18 = zext i16 %trunc18 to i32
269  %ext19 = zext i16 %trunc19 to i32
270  %ext20 = zext i16 %trunc20 to i32
271  %ext21 = zext i16 %trunc21 to i32
272  %ext22 = zext i16 %trunc22 to i32
273  %ext23 = zext i16 %trunc23 to i32
274  %ext24 = zext i16 %trunc24 to i32
275  %ext25 = zext i16 %trunc25 to i32
276  %ext26 = zext i16 %trunc26 to i32
277  %ext27 = zext i16 %trunc27 to i32
278  %ext28 = zext i16 %trunc28 to i32
279  %ext29 = zext i16 %trunc29 to i32
280  %ext30 = zext i16 %trunc30 to i32
281  %ext31 = zext i16 %trunc31 to i32
282
283  store volatile i32 %val0, i32 *%ptr
284  store volatile i32 %val1, i32 *%ptr
285  store volatile i32 %val2, i32 *%ptr
286  store volatile i32 %val3, i32 *%ptr
287  store volatile i32 %val4, i32 *%ptr
288  store volatile i32 %val5, i32 *%ptr
289  store volatile i32 %val6, i32 *%ptr
290  store volatile i32 %val7, i32 *%ptr
291  store volatile i32 %val8, i32 *%ptr
292  store volatile i32 %val9, i32 *%ptr
293  store volatile i32 %val10, i32 *%ptr
294  store volatile i32 %val11, i32 *%ptr
295  store volatile i32 %val12, i32 *%ptr
296  store volatile i32 %val13, i32 *%ptr
297  store volatile i32 %val14, i32 *%ptr
298  store volatile i32 %val15, i32 *%ptr
299  store volatile i32 %val16, i32 *%ptr
300  store volatile i32 %val17, i32 *%ptr
301  store volatile i32 %val18, i32 *%ptr
302  store volatile i32 %val19, i32 *%ptr
303  store volatile i32 %val20, i32 *%ptr
304  store volatile i32 %val21, i32 *%ptr
305  store volatile i32 %val22, i32 *%ptr
306  store volatile i32 %val23, i32 *%ptr
307  store volatile i32 %val24, i32 *%ptr
308  store volatile i32 %val25, i32 *%ptr
309  store volatile i32 %val26, i32 *%ptr
310  store volatile i32 %val27, i32 *%ptr
311  store volatile i32 %val28, i32 *%ptr
312  store volatile i32 %val29, i32 *%ptr
313  store volatile i32 %val30, i32 *%ptr
314  store volatile i32 %val31, i32 *%ptr
315
316  store volatile i32 %ext0, i32 *%ptr
317  store volatile i32 %ext1, i32 *%ptr
318  store volatile i32 %ext2, i32 *%ptr
319  store volatile i32 %ext3, i32 *%ptr
320  store volatile i32 %ext4, i32 *%ptr
321  store volatile i32 %ext5, i32 *%ptr
322  store volatile i32 %ext6, i32 *%ptr
323  store volatile i32 %ext7, i32 *%ptr
324  store volatile i32 %ext8, i32 *%ptr
325  store volatile i32 %ext9, i32 *%ptr
326  store volatile i32 %ext10, i32 *%ptr
327  store volatile i32 %ext11, i32 *%ptr
328  store volatile i32 %ext12, i32 *%ptr
329  store volatile i32 %ext13, i32 *%ptr
330  store volatile i32 %ext14, i32 *%ptr
331  store volatile i32 %ext15, i32 *%ptr
332  store volatile i32 %ext16, i32 *%ptr
333  store volatile i32 %ext17, i32 *%ptr
334  store volatile i32 %ext18, i32 *%ptr
335  store volatile i32 %ext19, i32 *%ptr
336  store volatile i32 %ext20, i32 *%ptr
337  store volatile i32 %ext21, i32 *%ptr
338  store volatile i32 %ext22, i32 *%ptr
339  store volatile i32 %ext23, i32 *%ptr
340  store volatile i32 %ext24, i32 *%ptr
341  store volatile i32 %ext25, i32 *%ptr
342  store volatile i32 %ext26, i32 *%ptr
343  store volatile i32 %ext27, i32 *%ptr
344  store volatile i32 %ext28, i32 *%ptr
345  store volatile i32 %ext29, i32 *%ptr
346  store volatile i32 %ext30, i32 *%ptr
347  store volatile i32 %ext31, i32 *%ptr
348
349  ret void
350}
351