1 # RUN: llc -mtriple=s390x-linux-gnu -mcpu=z14 -run-pass greedy %s -o - \
4 # Test that a reload can be folded into a compare instruction after swapping
5 # operands (when the LHS register is spilled).
9 define i64 @fun1(i64* %ptr0) { ret i64 0 }
10 define i64 @fun2(i64* %ptr0) { ret i64 0 }
13 define i32 @fun3(i32* %ptr0) { ret i32 0 }
14 define i32 @fun4(i32* %ptr0) { ret i32 0 }
20 # CHECK: CG %10, %stack.0, 0, $noreg, implicit-def $cc :: (load (s64) from %stack.0)
21 # CHECK-NEXT: %12:gr64bit = LOCGHI %12, 8, 14, 12, implicit $cc
25 tracksRegLiveness: true
27 - { id: 0, class: addr64bit }
28 - { id: 1, class: gr64bit }
29 - { id: 2, class: gr64bit }
30 - { id: 3, class: gr64bit }
31 - { id: 4, class: gr64bit }
32 - { id: 5, class: gr64bit }
33 - { id: 6, class: gr64bit }
34 - { id: 7, class: gr64bit }
35 - { id: 8, class: gr64bit }
36 - { id: 9, class: gr64bit }
37 - { id: 10, class: gr64bit }
38 - { id: 11, class: gr64bit }
39 - { id: 12, class: gr64bit }
40 - { id: 13, class: gr64bit }
41 - { id: 14, class: gr64bit }
42 - { id: 15, class: gr64bit }
43 - { id: 16, class: gr64bit }
44 - { id: 17, class: gr64bit }
45 - { id: 18, class: gr64bit }
46 - { id: 19, class: gr64bit }
48 - { reg: '$r2d', virtual-reg: '%0' }
52 machineFunctionInfo: {}
57 %0:addr64bit = COPY $r2d
58 %1:gr64bit = LG %0, 0, $noreg
59 %2:gr64bit = LG %0, 16, $noreg
60 %3:gr64bit = LG %0, 32, $noreg
61 %4:gr64bit = LG %0, 48, $noreg
62 %5:gr64bit = LG %0, 64, $noreg
63 %6:gr64bit = LG %0, 80, $noreg
64 %7:gr64bit = LG %0, 96, $noreg
65 %8:gr64bit = LG %0, 112, $noreg
66 %9:gr64bit = LG %0, 128, $noreg
68 CallBRASL @foo, csr_systemz_elf, implicit-def dead $r14d, implicit-def dead $cc, implicit $fpc, implicit-def $r2d
69 %10:gr64bit = COPY $r2d
71 CGR %10, %1, implicit-def $cc
72 %12:gr64bit = COPY %10
73 %12:gr64bit = LOCGHI %12, 0, 14, 10, implicit killed $cc
74 CGR %10, %2, implicit-def $cc
75 %12:gr64bit = LOCGHI %12, 1, 14, 10, implicit killed $cc
76 CGR %10, %3, implicit-def $cc
77 %12:gr64bit = LOCGHI %12, 2, 14, 10, implicit killed $cc
78 CGR %10, %4, implicit-def $cc
79 %12:gr64bit = LOCGHI %12, 3, 14, 10, implicit killed $cc
80 CGR %10, %5, implicit-def $cc
81 %12:gr64bit = LOCGHI %12, 4, 14, 10, implicit killed $cc
82 CGR %10, %6, implicit-def $cc
83 %12:gr64bit = LOCGHI %12, 5, 14, 10, implicit killed $cc
84 CGR %10, %7, implicit-def $cc
85 %12:gr64bit = LOCGHI %12, 6, 14, 10, implicit killed $cc
86 CGR %10, %8, implicit-def $cc
87 %12:gr64bit = LOCGHI %12, 7, 14, 10, implicit killed $cc
88 CGR %9, %10, implicit-def $cc
89 %12:gr64bit = LOCGHI %12, 8, 14, 10, implicit killed $cc
97 # CHECK: CLG %10, %stack.0, 0, $noreg, implicit-def $cc :: (load (s64) from %stack.0)
98 # CHECK-NEXT: %12:gr64bit = LOCGHI %12, 8, 14, 12, implicit $cc
102 tracksRegLiveness: true
104 - { id: 0, class: addr64bit }
105 - { id: 1, class: gr64bit }
106 - { id: 2, class: gr64bit }
107 - { id: 3, class: gr64bit }
108 - { id: 4, class: gr64bit }
109 - { id: 5, class: gr64bit }
110 - { id: 6, class: gr64bit }
111 - { id: 7, class: gr64bit }
112 - { id: 8, class: gr64bit }
113 - { id: 9, class: gr64bit }
114 - { id: 10, class: gr64bit }
115 - { id: 11, class: gr64bit }
116 - { id: 12, class: gr64bit }
117 - { id: 13, class: gr64bit }
118 - { id: 14, class: gr64bit }
119 - { id: 15, class: gr64bit }
120 - { id: 16, class: gr64bit }
121 - { id: 17, class: gr64bit }
122 - { id: 18, class: gr64bit }
123 - { id: 19, class: gr64bit }
125 - { reg: '$r2d', virtual-reg: '%0' }
129 machineFunctionInfo: {}
134 %0:addr64bit = COPY $r2d
135 %1:gr64bit = LG %0, 0, $noreg
136 %2:gr64bit = LG %0, 16, $noreg
137 %3:gr64bit = LG %0, 32, $noreg
138 %4:gr64bit = LG %0, 48, $noreg
139 %5:gr64bit = LG %0, 64, $noreg
140 %6:gr64bit = LG %0, 80, $noreg
141 %7:gr64bit = LG %0, 96, $noreg
142 %8:gr64bit = LG %0, 112, $noreg
143 %9:gr64bit = LG %0, 128, $noreg
144 ADJCALLSTACKDOWN 0, 0
145 CallBRASL @foo, csr_systemz_elf, implicit-def dead $r14d, implicit-def dead $cc, implicit $fpc, implicit-def $r2d
146 %10:gr64bit = COPY $r2d
148 CGR %10, %1, implicit-def $cc
149 %12:gr64bit = COPY %10
150 %12:gr64bit = LOCGHI %12, 0, 14, 10, implicit killed $cc
151 CGR %10, %2, implicit-def $cc
152 %12:gr64bit = LOCGHI %12, 1, 14, 10, implicit killed $cc
153 CGR %10, %3, implicit-def $cc
154 %12:gr64bit = LOCGHI %12, 2, 14, 10, implicit killed $cc
155 CGR %10, %4, implicit-def $cc
156 %12:gr64bit = LOCGHI %12, 3, 14, 10, implicit killed $cc
157 CGR %10, %5, implicit-def $cc
158 %12:gr64bit = LOCGHI %12, 4, 14, 10, implicit killed $cc
159 CGR %10, %6, implicit-def $cc
160 %12:gr64bit = LOCGHI %12, 5, 14, 10, implicit killed $cc
161 CGR %10, %7, implicit-def $cc
162 %12:gr64bit = LOCGHI %12, 6, 14, 10, implicit killed $cc
163 CGR %10, %8, implicit-def $cc
164 %12:gr64bit = LOCGHI %12, 7, 14, 10, implicit killed $cc
165 CLGR %9, %10, implicit-def $cc
166 %12:gr64bit = LOCGHI %12, 8, 14, 10, implicit killed $cc
174 # CHECK: C %10, %stack.0, 0, $noreg, implicit-def $cc :: (load (s32) from %stack.0)
175 # CHECK: %12:gr32bit = LOCHIMux %12, 8, 14, 12, implicit $cc
179 tracksRegLiveness: true
181 - { id: 0, class: addr64bit }
182 - { id: 1, class: gr32bit }
183 - { id: 2, class: gr32bit }
184 - { id: 3, class: gr32bit }
185 - { id: 4, class: gr32bit }
186 - { id: 5, class: gr32bit }
187 - { id: 6, class: gr32bit }
188 - { id: 7, class: gr32bit }
189 - { id: 8, class: gr32bit }
190 - { id: 9, class: gr32bit }
191 - { id: 10, class: gr32bit }
192 - { id: 11, class: gr32bit }
193 - { id: 12, class: gr32bit }
194 - { id: 13, class: gr32bit }
195 - { id: 14, class: gr32bit }
196 - { id: 15, class: gr32bit }
197 - { id: 16, class: gr32bit }
198 - { id: 17, class: gr32bit }
199 - { id: 18, class: gr32bit }
200 - { id: 19, class: gr32bit }
202 - { reg: '$r2d', virtual-reg: '%0' }
206 machineFunctionInfo: {}
211 %0:addr64bit = COPY $r2d
212 %1:gr32bit = LMux %0, 0, $noreg
213 %2:gr32bit = LMux %0, 8, $noreg
214 %3:gr32bit = LMux %0, 16, $noreg
215 %4:gr32bit = LMux %0, 24, $noreg
216 %5:gr32bit = LMux %0, 32, $noreg
217 %6:gr32bit = LMux %0, 40, $noreg
218 %7:gr32bit = LMux %0, 48, $noreg
219 %8:gr32bit = LMux %0, 56, $noreg
220 %9:gr32bit = LMux %0, 64, $noreg
221 ADJCALLSTACKDOWN 0, 0
222 CallBRASL @foo, csr_systemz_elf, implicit-def dead $r14d, implicit-def dead $cc, implicit $fpc, implicit-def $r2l
223 %10:gr32bit = COPY $r2l
225 CR %10, %1, implicit-def $cc
226 %12:gr32bit = COPY %10
227 %12:gr32bit = LOCHIMux %12, 0, 14, 10, implicit killed $cc
228 CR %10, %2, implicit-def $cc
229 %12:gr32bit = LOCHIMux %12, 1, 14, 10, implicit killed $cc
230 CR %10, %3, implicit-def $cc
231 %12:gr32bit = LOCHIMux %12, 2, 14, 10, implicit killed $cc
232 CR %10, %4, implicit-def $cc
233 %12:gr32bit = LOCHIMux %12, 3, 14, 10, implicit killed $cc
234 CR %10, %5, implicit-def $cc
235 %12:gr32bit = LOCHIMux %12, 4, 14, 10, implicit killed $cc
236 CR %10, %6, implicit-def $cc
237 %12:gr32bit = LOCHIMux %12, 5, 14, 10, implicit killed $cc
238 CR %10, %7, implicit-def $cc
239 %12:gr32bit = LOCHIMux %12, 6, 14, 10, implicit killed $cc
240 CR %10, %8, implicit-def $cc
241 %12:gr32bit = LOCHIMux %12, 7, 14, 10, implicit killed $cc
242 CR %9, %10, implicit-def $cc
243 %12:gr32bit = LOCHIMux %12, 8, 14, 10, implicit killed $cc
251 # CHECK: CL %10, %stack.0, 0, $noreg, implicit-def $cc :: (load (s32) from %stack.0)
252 # CHECK: %12:gr32bit = LOCHIMux %12, 8, 14, 12, implicit $cc
256 tracksRegLiveness: true
258 - { id: 0, class: addr64bit }
259 - { id: 1, class: gr32bit }
260 - { id: 2, class: gr32bit }
261 - { id: 3, class: gr32bit }
262 - { id: 4, class: gr32bit }
263 - { id: 5, class: gr32bit }
264 - { id: 6, class: gr32bit }
265 - { id: 7, class: gr32bit }
266 - { id: 8, class: gr32bit }
267 - { id: 9, class: gr32bit }
268 - { id: 10, class: gr32bit }
269 - { id: 11, class: gr32bit }
270 - { id: 12, class: gr32bit }
271 - { id: 13, class: gr32bit }
272 - { id: 14, class: gr32bit }
273 - { id: 15, class: gr32bit }
274 - { id: 16, class: gr32bit }
275 - { id: 17, class: gr32bit }
276 - { id: 18, class: gr32bit }
277 - { id: 19, class: gr32bit }
279 - { reg: '$r2d', virtual-reg: '%0' }
283 machineFunctionInfo: {}
288 %0:addr64bit = COPY $r2d
289 %1:gr32bit = LMux %0, 0, $noreg
290 %2:gr32bit = LMux %0, 8, $noreg
291 %3:gr32bit = LMux %0, 16, $noreg
292 %4:gr32bit = LMux %0, 24, $noreg
293 %5:gr32bit = LMux %0, 32, $noreg
294 %6:gr32bit = LMux %0, 40, $noreg
295 %7:gr32bit = LMux %0, 48, $noreg
296 %8:gr32bit = LMux %0, 56, $noreg
297 %9:gr32bit = LMux %0, 64, $noreg
298 ADJCALLSTACKDOWN 0, 0
299 CallBRASL @foo, csr_systemz_elf, implicit-def dead $r14d, implicit-def dead $cc, implicit $fpc, implicit-def $r2l
300 %10:gr32bit = COPY $r2l
302 CR %10, %1, implicit-def $cc
303 %12:gr32bit = COPY %10
304 %12:gr32bit = LOCHIMux %12, 0, 14, 10, implicit killed $cc
305 CR %10, %2, implicit-def $cc
306 %12:gr32bit = LOCHIMux %12, 1, 14, 10, implicit killed $cc
307 CR %10, %3, implicit-def $cc
308 %12:gr32bit = LOCHIMux %12, 2, 14, 10, implicit killed $cc
309 CR %10, %4, implicit-def $cc
310 %12:gr32bit = LOCHIMux %12, 3, 14, 10, implicit killed $cc
311 CR %10, %5, implicit-def $cc
312 %12:gr32bit = LOCHIMux %12, 4, 14, 10, implicit killed $cc
313 CR %10, %6, implicit-def $cc
314 %12:gr32bit = LOCHIMux %12, 5, 14, 10, implicit killed $cc
315 CR %10, %7, implicit-def $cc
316 %12:gr32bit = LOCHIMux %12, 6, 14, 10, implicit killed $cc
317 CR %10, %8, implicit-def $cc
318 %12:gr32bit = LOCHIMux %12, 7, 14, 10, implicit killed $cc
319 CLR %9, %10, implicit-def $cc
320 %12:gr32bit = LOCHIMux %12, 8, 14, 10, implicit killed $cc