• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# RUN: llc -march=amdgcn -mcpu=gfx900 -run-pass si-shrink-instructions -verify-machineinstrs %s -o - | FileCheck -check-prefix=GCN %s
2
3# GCN-LABEL: name: swap_phys_condensed
4# GCN: bb.0:
5# GCN-NEXT: $vgpr0, $vgpr1 = V_SWAP_B32 $vgpr1, $vgpr0, implicit $exec
6# GCN-NEXT: S_SETPC_B64_return
7---
8name:            swap_phys_condensed
9body:             |
10  bb.0:
11    liveins: $vgpr0, $vgpr1, $sgpr30_sgpr31
12    $vgpr2 = V_MOV_B32_e32 killed $vgpr0, implicit $exec
13    $vgpr0 = V_MOV_B32_e32 killed $vgpr1, implicit $exec
14    $vgpr1 = V_MOV_B32_e32 killed $vgpr2, implicit $exec
15    S_SETPC_B64_return $sgpr30_sgpr31, implicit $vgpr0, implicit $vgpr1
16...
17
18# GCN-LABEL: name: swap_phys_sparse
19# GCN: bb.0:
20# GCN-NEXT: $vgpr3 = V_MOV_B32_e32 killed $vgpr4, implicit $exec
21# GCN-NEXT: $vgpr0, $vgpr1 = V_SWAP_B32 $vgpr1, $vgpr0, implicit $exec
22# GCN-NEXT: $vgpr5 = V_MOV_B32_e32 killed $vgpr6, implicit $exec
23# GCN-NEXT: S_SETPC_B64_return
24---
25name:            swap_phys_sparse
26body:             |
27  bb.0:
28    liveins: $vgpr0, $vgpr1, $sgpr30_sgpr31
29    $vgpr2 = V_MOV_B32_e32 killed $vgpr0, implicit $exec
30    $vgpr3 = V_MOV_B32_e32 killed $vgpr4, implicit $exec
31    $vgpr0 = V_MOV_B32_e32 killed $vgpr1, implicit $exec
32    $vgpr5 = V_MOV_B32_e32 killed $vgpr6, implicit $exec
33    $vgpr1 = V_MOV_B32_e32 killed $vgpr2, implicit $exec
34    S_SETPC_B64_return $sgpr30_sgpr31, implicit $vgpr0, implicit $vgpr1
35...
36
37# GCN-LABEL: name: swap_phys_liveout
38# GCN: bb.0:
39# GCN-NEXT: $vgpr2 = V_MOV_B32_e32 $vgpr0, implicit $exec
40# GCN-NEXT: $vgpr0, $vgpr1 = V_SWAP_B32 $vgpr1, $vgpr0, implicit $exec
41# GCN-NEXT: S_SETPC_B64_return
42---
43name:            swap_phys_liveout
44body:             |
45  bb.0:
46    liveins: $vgpr0, $vgpr1, $sgpr30_sgpr31
47    $vgpr2 = V_MOV_B32_e32 killed $vgpr0, implicit $exec
48    $vgpr0 = V_MOV_B32_e32 killed $vgpr1, implicit $exec
49    $vgpr1 = V_MOV_B32_e32 killed $vgpr2, implicit $exec
50    S_SETPC_B64_return $sgpr30_sgpr31, implicit $vgpr0, implicit $vgpr2, implicit $vgpr1
51...
52
53# GCN-LABEL: name: swap_phys_b64
54# GCN: bb.0:
55# GCN-NEXT: $vgpr0, $vgpr2 = V_SWAP_B32 $vgpr2, $vgpr0, implicit $exec
56# GCN-NEXT: $vgpr1, $vgpr3 = V_SWAP_B32 $vgpr3, $vgpr1, implicit $exec
57---
58name:            swap_phys_b64
59body:             |
60  bb.0:
61    $vgpr4_vgpr5 = COPY killed $vgpr0_vgpr1
62    $vgpr0_vgpr1 = COPY killed $vgpr2_vgpr3
63    $vgpr2_vgpr3 = COPY killed $vgpr4_vgpr5
64...
65
66# GCN-LABEL: name: swap_phys_overlap_x
67# GCN: bb.0:
68# GCN-NEXT: $vgpr2 = V_MOV_B32_e32 $vgpr0, implicit $exec
69# GCN-NEXT: $vgpr3_vgpr4 = V_ADD_F64 0, $vgpr0_vgpr1, 0, $vgpr3_vgpr4, 0, 0, implicit $mode, implicit $exec
70# GCN-NEXT: $vgpr0 = V_MOV_B32_e32 killed $vgpr1, implicit $exec
71# GCN-NEXT: $vgpr1 = V_MOV_B32_e32 killed $vgpr2, implicit $exec
72---
73name:            swap_phys_overlap_x
74body:             |
75  bb.0:
76    $vgpr2 = V_MOV_B32_e32 $vgpr0, implicit $exec
77    $vgpr3_vgpr4 = V_ADD_F64 0, $vgpr0_vgpr1, 0, $vgpr3_vgpr4, 0, 0, implicit $mode, implicit $exec
78    $vgpr0 = V_MOV_B32_e32 killed $vgpr1, implicit $exec
79    $vgpr1 = V_MOV_B32_e32 killed $vgpr2, implicit $exec
80...
81
82# GCN-LABEL: name: swap_phys_clobber_y
83# GCN: bb.0:
84# GCN-NEXT: $vgpr2 = V_MOV_B32_e32 $vgpr0, implicit $exec
85# GCN-NEXT: $vgpr0 = V_MOV_B32_e32 killed $vgpr1, implicit $exec
86# GCN-NEXT: $vgpr1 = V_MOV_B32_e32 0, implicit $exec
87# GCN-NEXT: $vgpr1 = V_MOV_B32_e32 killed $vgpr2, implicit $exec
88---
89name:            swap_phys_clobber_y
90body:             |
91  bb.0:
92    $vgpr2 = V_MOV_B32_e32 $vgpr0, implicit $exec
93    $vgpr0 = V_MOV_B32_e32 killed $vgpr1, implicit $exec
94    $vgpr1 = V_MOV_B32_e32 0, implicit $exec
95    $vgpr1 = V_MOV_B32_e32 killed $vgpr2, implicit $exec
96    S_ENDPGM 0
97...
98
99# GCN-LABEL: name: swap_virt_copy_condense
100# GCN: %0:vgpr_32, %1:vgpr_32 = V_SWAP_B32 %1, %0, implicit $exec
101---
102name:            swap_virt_copy_condense
103registers:
104  - { id: 0, class: vgpr_32 }
105  - { id: 1, class: vgpr_32 }
106  - { id: 2, class: vgpr_32 }
107body:             |
108  bb.0:
109    %0 = IMPLICIT_DEF
110    %1 = IMPLICIT_DEF
111    %2 = COPY %0
112    %0 = COPY %1
113    %1 = COPY %2
114...
115
116# GCN-LABEL: name: swap_virt_copy_sparse
117# GCN: %0:vgpr_32, %1:vgpr_32 = V_SWAP_B32 %1, %0, implicit $exec
118---
119name:            swap_virt_copy_sparse
120registers:
121  - { id: 0, class: vgpr_32 }
122  - { id: 1, class: vgpr_32 }
123  - { id: 2, class: vgpr_32 }
124body:             |
125  bb.0:
126    %0 = IMPLICIT_DEF
127    %1 = IMPLICIT_DEF
128    %2 = COPY %0
129    S_NOP 0
130    %0 = COPY %1
131    S_NOP 0
132    %1 = COPY %2
133...
134
135# GCN-LABEL: name: swap_virt_copy_subreg
136# GCN: %0.sub0:vreg_64, %1.sub0:vreg_64 = V_SWAP_B32 %1.sub0, %0.sub0, implicit $exec
137---
138name:            swap_virt_copy_subreg
139registers:
140  - { id: 0, class: vreg_64 }
141  - { id: 1, class: vreg_64 }
142  - { id: 2, class: vreg_64 }
143body:             |
144  bb.0:
145    %0 = IMPLICIT_DEF
146    %1 = IMPLICIT_DEF
147    %2.sub0 = COPY %0.sub0
148    %2.sub1 = COPY %0.sub1
149    %0.sub0 = COPY %1.sub0
150    %0.sub1 = COPY %1.sub1
151    %1.sub0 = COPY %2.sub0
152...
153
154# GCN-LABEL: name: swap_virt_mov
155# GCN: %0:vgpr_32, %1:vgpr_32 = V_SWAP_B32 %1, %0, implicit $exec
156---
157name:            swap_virt_mov
158registers:
159  - { id: 0, class: vgpr_32 }
160  - { id: 1, class: vgpr_32 }
161  - { id: 2, class: vgpr_32 }
162body:             |
163  bb.0:
164    %0 = IMPLICIT_DEF
165    %1 = IMPLICIT_DEF
166    %2 = V_MOV_B32_e32 %0, implicit $exec
167    %0 = V_MOV_B32_e32 %1, implicit $exec
168    %1 = V_MOV_B32_e32 %2, implicit $exec
169...
170
171# GCN-LABEL: name: swap_virt_read_x
172# GCN: bb.0:
173# GCN-NEXT: %0:vgpr_32 = IMPLICIT_DEF
174# GCN-NEXT: %1:vgpr_32 = IMPLICIT_DEF
175# GCN-NEXT: %2:vgpr_32 = COPY %0
176# GCN-NEXT: %3:vgpr_32 = COPY %0
177# GCN-NEXT: %0:vgpr_32 = COPY %1
178# GCN-NEXT: %1:vgpr_32 = COPY %2
179# GCN-NEXT: S_ENDPGM 0
180
181---
182name:            swap_virt_read_x
183registers:
184  - { id: 0, class: vgpr_32 }
185  - { id: 1, class: vgpr_32 }
186  - { id: 2, class: vgpr_32 }
187  - { id: 3, class: vgpr_32 }
188body:             |
189  bb.0:
190    %0 = IMPLICIT_DEF
191    %1 = IMPLICIT_DEF
192    %2 = COPY %0
193    %3 = COPY %0
194    %0 = COPY %1
195    %1 = COPY %2
196    S_ENDPGM 0
197...
198
199# GCN-LABEL: name: swap_virt_read_t_twice
200# GCN: bb.0:
201# GCN-NEXT: %0:vgpr_32 = IMPLICIT_DEF
202# GCN-NEXT: %1:vgpr_32 = IMPLICIT_DEF
203# GCN-NEXT: %2:vgpr_32 = COPY %0
204# GCN-NEXT: %3:vgpr_32 = COPY %2
205# GCN-NEXT: %0:vgpr_32, %1:vgpr_32 = V_SWAP_B32 %1, %0, implicit $exec
206# GCN-NEXT: S_ENDPGM 0
207
208---
209name:            swap_virt_read_t_twice
210registers:
211  - { id: 0, class: vgpr_32 }
212  - { id: 1, class: vgpr_32 }
213  - { id: 2, class: vgpr_32 }
214  - { id: 3, class: vgpr_32 }
215body:             |
216  bb.0:
217    %0 = IMPLICIT_DEF
218    %1 = IMPLICIT_DEF
219    %2 = COPY %0
220    %3 = COPY %2
221    %0 = COPY %1
222    %1 = COPY %2
223    S_ENDPGM 0
224...
225
226# GCN-LABEL: name: swap_virt_clobber_y
227# GCN: bb.0:
228# GCN-NEXT: %0:vgpr_32 = IMPLICIT_DEF
229# GCN-NEXT: %1:vgpr_32 = IMPLICIT_DEF
230# GCN-NEXT: %2:vgpr_32 = COPY %0
231# GCN-NEXT: %0:vgpr_32 = COPY %1
232# GCN-NEXT: %1:vgpr_32 = IMPLICIT_DEF
233# GCN-NEXT: %1:vgpr_32 = COPY %2
234# GCN-NEXT: S_ENDPGM 0
235
236---
237name:            swap_virt_clobber_y
238registers:
239  - { id: 0, class: vgpr_32 }
240  - { id: 1, class: vgpr_32 }
241  - { id: 2, class: vgpr_32 }
242body:             |
243  bb.0:
244    %0 = IMPLICIT_DEF
245    %1 = IMPLICIT_DEF
246    %2 = COPY %0
247    %0 = COPY %1
248    %1 = IMPLICIT_DEF
249    %1 = COPY %2
250    S_ENDPGM 0
251...
252
253# GCN-LABEL: name: swap_virt_clobber_x1
254# GCN: bb.0:
255# GCN-NEXT: %0:vgpr_32 = IMPLICIT_DEF
256# GCN-NEXT: %1:vgpr_32 = IMPLICIT_DEF
257# GCN-NEXT: %2:vgpr_32 = COPY %0
258# GCN-NEXT: %0:vgpr_32 = COPY %1
259# GCN-NEXT: %0:vgpr_32 = IMPLICIT_DEF
260# GCN-NEXT: %1:vgpr_32 = COPY %2
261# GCN-NEXT: S_ENDPGM 0
262
263---
264name:            swap_virt_clobber_x1
265registers:
266  - { id: 0, class: vgpr_32 }
267  - { id: 1, class: vgpr_32 }
268  - { id: 2, class: vgpr_32 }
269body:             |
270  bb.0:
271    %0 = IMPLICIT_DEF
272    %1 = IMPLICIT_DEF
273    %2 = COPY %0
274    %0 = COPY %1
275    %0 = IMPLICIT_DEF
276    %1 = COPY %2
277    S_ENDPGM 0
278...
279
280# GCN-LABEL: name: swap_virt_clobber_x2
281# GCN: bb.0:
282# GCN-NEXT: %0:vgpr_32 = IMPLICIT_DEF
283# GCN-NEXT: %1:vgpr_32 = IMPLICIT_DEF
284# GCN-NEXT: %2:vgpr_32 = COPY %0
285# GCN-NEXT: %0:vgpr_32 = IMPLICIT_DEF
286# GCN-NEXT: %0:vgpr_32 = COPY %1
287# GCN-NEXT: %1:vgpr_32 = COPY %2
288# GCN-NEXT: S_ENDPGM 0
289
290---
291name:            swap_virt_clobber_x2
292registers:
293  - { id: 0, class: vgpr_32 }
294  - { id: 1, class: vgpr_32 }
295  - { id: 2, class: vgpr_32 }
296body:             |
297  bb.0:
298    %0 = IMPLICIT_DEF
299    %1 = IMPLICIT_DEF
300    %2 = COPY %0
301    %0 = IMPLICIT_DEF
302    %0 = COPY %1
303    %1 = COPY %2
304    S_ENDPGM 0
305...
306
307# GCN-LABEL: name: swap_virt_clobber_t
308# GCN: bb.0:
309# GCN-NEXT: %0:vgpr_32 = IMPLICIT_DEF
310# GCN-NEXT: %1:vgpr_32 = IMPLICIT_DEF
311# GCN-NEXT: %2:vgpr_32 = COPY %0
312# GCN-NEXT: %0:vgpr_32 = COPY %1
313# GCN-NEXT: %2:vgpr_32 = IMPLICIT_DEF
314# GCN-NEXT: %1:vgpr_32 = COPY %2
315# GCN-NEXT: S_ENDPGM 0
316
317---
318name:            swap_virt_clobber_t
319registers:
320  - { id: 0, class: vgpr_32 }
321  - { id: 1, class: vgpr_32 }
322  - { id: 2, class: vgpr_32 }
323body:             |
324  bb.0:
325    %0 = IMPLICIT_DEF
326    %1 = IMPLICIT_DEF
327    %2 = COPY %0
328    %0 = COPY %1
329    %2 = IMPLICIT_DEF
330    %1 = COPY %2
331    S_ENDPGM 0
332...
333
334# GCN-LABEL: name: swap_virt_copy_subreg_overlap_x_full
335# GCN: bb.0:
336# GCN-NEXT: %0:vreg_64 = IMPLICIT_DEF
337# GCN-NEXT: %1:vreg_64 = IMPLICIT_DEF
338# GCN-NEXT: %2.sub0:vreg_64 = COPY %0.sub0
339# GCN-NEXT: %3:vreg_64 = COPY %0
340# GCN-NEXT: %0.sub0:vreg_64 = COPY %1.sub0
341# GCN-NEXT: %1.sub0:vreg_64 = COPY %2.sub0
342---
343name:            swap_virt_copy_subreg_overlap_x_full
344registers:
345  - { id: 0, class: vreg_64 }
346  - { id: 1, class: vreg_64 }
347  - { id: 2, class: vreg_64 }
348  - { id: 3, class: vreg_64 }
349body:             |
350  bb.0:
351    %0 = IMPLICIT_DEF
352    %1 = IMPLICIT_DEF
353    %2.sub0 = COPY %0.sub0
354    %3 = COPY %0
355    %0.sub0 = COPY %1.sub0
356    %1.sub0 = COPY %2.sub0
357...
358
359# GCN-LABEL: name: swap_virt_copy_subreg_overlap_x_part
360# GCN: bb.0:
361# GCN-NEXT: %0:vreg_128 = IMPLICIT_DEF
362# GCN-NEXT: %1:vreg_64 = IMPLICIT_DEF
363# GCN-NEXT: %2.sub0:vreg_64 = COPY %0.sub0
364# GCN-NEXT: %3:vreg_64 = COPY %0.sub0_sub1
365# GCN-NEXT: %0.sub0:vreg_128 = COPY %1.sub0
366# GCN-NEXT: %1.sub0:vreg_64 = COPY %2.sub0
367---
368name:            swap_virt_copy_subreg_overlap_x_part
369registers:
370  - { id: 0, class: vreg_128 }
371  - { id: 1, class: vreg_64 }
372  - { id: 2, class: vreg_64 }
373  - { id: 3, class: vreg_64 }
374body:             |
375  bb.0:
376    %0 = IMPLICIT_DEF
377    %1 = IMPLICIT_DEF
378    %2.sub0 = COPY %0.sub0
379    %3 = COPY %0.sub0_sub1
380    %0.sub0 = COPY %1.sub0
381    %1.sub0 = COPY %2.sub0
382...
383
384# GCN-LABEL: name: swap_virt_copy_subreg_wide_y
385# GCN: bb.0:
386# GCN-NEXT: %0:vreg_64 = IMPLICIT_DEF
387# GCN-NEXT: %1:vreg_64 = IMPLICIT_DEF
388# GCN-NEXT: %2.sub0:vreg_64 = COPY %0.sub0
389# GCN-NEXT: %0.sub0:vreg_64 = COPY %1.sub0
390# GCN-NEXT: %1:vreg_64 = COPY %2
391---
392name:            swap_virt_copy_subreg_wide_y
393registers:
394  - { id: 0, class: vreg_64 }
395  - { id: 1, class: vreg_64 }
396  - { id: 2, class: vreg_64 }
397body:             |
398  bb.0:
399    %0 = IMPLICIT_DEF
400    %1 = IMPLICIT_DEF
401    %2.sub0 = COPY %0.sub0
402    %0.sub0 = COPY %1.sub0
403    %1 = COPY %2
404...
405
406# GCN-LABEL: name: swap_virt_b64
407# GCN: bb.0:
408# GCN-NEXT: %0:vreg_64 = IMPLICIT_DEF
409# GCN-NEXT: %1:vreg_64 = IMPLICIT_DEF
410# GCN-NEXT: %0.sub0:vreg_64, %1.sub0:vreg_64 = V_SWAP_B32 %1.sub0, %0.sub0, implicit $exec
411# GCN-NEXT: %0.sub1:vreg_64, %1.sub1:vreg_64 = V_SWAP_B32 %1.sub1, %0.sub1, implicit $exec
412---
413name:            swap_virt_b64
414registers:
415  - { id: 0, class: vreg_64 }
416  - { id: 1, class: vreg_64 }
417  - { id: 2, class: vreg_64 }
418body:             |
419  bb.0:
420    %0 = IMPLICIT_DEF
421    %1 = IMPLICIT_DEF
422    %2 = COPY %0
423    %0 = COPY %1
424    %1 = COPY %2
425...
426
427# GCN-LABEL: name: swap_virt_b128
428# GCN: bb.0:
429# GCN-NEXT: %0:vreg_128 = IMPLICIT_DEF
430# GCN-NEXT: %1:vreg_128 = IMPLICIT_DEF
431# GCN-NEXT: %0.sub0:vreg_128, %1.sub0:vreg_128 = V_SWAP_B32 %1.sub0, %0.sub0, implicit $exec
432# GCN-NEXT: %0.sub1:vreg_128, %1.sub1:vreg_128 = V_SWAP_B32 %1.sub1, %0.sub1, implicit $exec
433# GCN-NEXT: %0.sub2:vreg_128, %1.sub2:vreg_128 = V_SWAP_B32 %1.sub2, %0.sub2, implicit $exec
434# GCN-NEXT: %0.sub3:vreg_128, %1.sub3:vreg_128 = V_SWAP_B32 %1.sub3, %0.sub3, implicit $exec
435---
436name:            swap_virt_b128
437registers:
438  - { id: 0, class: vreg_128 }
439  - { id: 1, class: vreg_128 }
440  - { id: 2, class: vreg_128 }
441body:             |
442  bb.0:
443    %0 = IMPLICIT_DEF
444    %1 = IMPLICIT_DEF
445    %2 = COPY %0
446    %0 = COPY %1
447    %1 = COPY %2
448...
449
450# GCN-LABEL: name: swap_virt_b128_sub0_1
451# GCN: bb.0:
452# GCN-NEXT: %0:vreg_128 = IMPLICIT_DEF
453# GCN-NEXT: %1:vreg_128 = IMPLICIT_DEF
454# GCN-NEXT: %0.sub0:vreg_128, %1.sub0:vreg_128 = V_SWAP_B32 %1.sub0, %0.sub0, implicit $exec
455# GCN-NEXT: %0.sub1:vreg_128, %1.sub1:vreg_128 = V_SWAP_B32 %1.sub1, %0.sub1, implicit $exec
456# GCN-NEXT: S_ENDPGM 0
457---
458name:            swap_virt_b128_sub0_1
459registers:
460  - { id: 0, class: vreg_128 }
461  - { id: 1, class: vreg_128 }
462  - { id: 2, class: vreg_128 }
463body:             |
464  bb.0:
465    %0 = IMPLICIT_DEF
466    %1 = IMPLICIT_DEF
467    %2.sub0_sub1 = COPY %0.sub0_sub1
468    %0.sub0_sub1 = COPY %1.sub0_sub1
469    %1.sub0_sub1 = COPY %2.sub0_sub1
470    S_ENDPGM 0
471...
472
473# GCN-LABEL: name: swap_virt_b128_sub2_3
474# GCN: bb.0:
475# GCN-NEXT: %0:vreg_128 = IMPLICIT_DEF
476# GCN-NEXT: %1:vreg_128 = IMPLICIT_DEF
477# GCN-NEXT: %0.sub2:vreg_128, %1.sub2:vreg_128 = V_SWAP_B32 %1.sub2, %0.sub2, implicit $exec
478# GCN-NEXT: %0.sub3:vreg_128, %1.sub3:vreg_128 = V_SWAP_B32 %1.sub3, %0.sub3, implicit $exec
479# GCN-NEXT: S_ENDPGM 0
480---
481name:            swap_virt_b128_sub2_3
482registers:
483  - { id: 0, class: vreg_128 }
484  - { id: 1, class: vreg_128 }
485  - { id: 2, class: vreg_128 }
486body:             |
487  bb.0:
488    %0 = IMPLICIT_DEF
489    %1 = IMPLICIT_DEF
490    %2.sub2_sub3 = COPY %0.sub2_sub3
491    %0.sub2_sub3 = COPY %1.sub2_sub3
492    %1.sub2_sub3 = COPY %2.sub2_sub3
493    S_ENDPGM 0
494...
495
496
497# GCN-LABEL: name: swap_virt_s_to_s
498# GCN: bb.0:
499# GCN-NEXT: %0:sgpr_32 = IMPLICIT_DEF
500# GCN-NEXT: %1:sgpr_32 = IMPLICIT_DEF
501# GCN-NEXT: %2:sgpr_32 = COPY %0
502# GCN-NEXT: %0:sgpr_32 = COPY %1
503# GCN-NEXT: %1:sgpr_32 = COPY %2
504---
505name:            swap_virt_s_to_s
506registers:
507  - { id: 0, class: sgpr_32 }
508  - { id: 1, class: sgpr_32 }
509  - { id: 2, class: sgpr_32 }
510body:             |
511  bb.0:
512    %0 = IMPLICIT_DEF
513    %1 = IMPLICIT_DEF
514    %2 = COPY %0
515    %0 = COPY %1
516    %1 = COPY %2
517...
518
519# GCN-LABEL: name: swap_virt_copy_subreg_impdef_super
520# GCN:      %2:vreg_64 = IMPLICIT_DEF
521# GCN-NEXT: %2.sub1:vreg_64 = COPY %0.sub1
522# GCN-NEXT: %0.sub0:vreg_64, %1.sub0:vreg_64 = V_SWAP_B32 %1.sub0, %0.sub0, implicit $exec
523---
524name:            swap_virt_copy_subreg_impdef_super
525registers:
526  - { id: 0, class: vreg_64 }
527  - { id: 1, class: vreg_64 }
528  - { id: 2, class: vreg_64 }
529body:             |
530  bb.0:
531    %0 = IMPLICIT_DEF
532    %1 = IMPLICIT_DEF
533    %2.sub0 = COPY %0.sub0, implicit-def %2, implicit $exec
534    %2.sub1 = COPY %0.sub1
535    %0.sub0 = COPY %1.sub0
536    %0.sub1 = COPY %1.sub1
537    %1.sub0 = COPY %2.sub0
538...
539
540# GCN-LABEL: name: swap_virt_copy_subreg_impuse_x
541# GCN: bb.0:
542# GCN-NEXT: %0:vreg_64 = IMPLICIT_DEF
543# GCN-NEXT: %1:vreg_64 = IMPLICIT_DEF
544# GCN-NEXT: %2.sub0:vreg_64 = COPY %0.sub0
545# GCN-NEXT: %2.sub1:vreg_64 = COPY %0.sub1
546# GCN-NEXT: %0.sub0:vreg_64 = COPY %1.sub0, implicit %0
547# GCN-NEXT: %0.sub1:vreg_64 = COPY %1.sub1
548# GCN-NEXT: %1.sub0:vreg_64 = COPY %2.sub0
549# GCN-NEXT: S_ENDPGM 0
550---
551name:            swap_virt_copy_subreg_impuse_x
552registers:
553  - { id: 0, class: vreg_64 }
554  - { id: 1, class: vreg_64 }
555  - { id: 2, class: vreg_64 }
556body:             |
557  bb.0:
558    %0 = IMPLICIT_DEF
559    %1 = IMPLICIT_DEF
560    %2.sub0 = COPY %0.sub0
561    %2.sub1 = COPY %0.sub1
562    %0.sub0 = COPY %1.sub0, implicit %0
563    %0.sub1 = COPY %1.sub1
564    %1.sub0 = COPY %2.sub0
565    S_ENDPGM 0
566...
567
568# GCN-LABEL: name: swap_exact_max_insns_apart
569# GCN: bb.0:
570# GCN-NEXT: %0:vgpr_32 = IMPLICIT_DEF
571# GCN-NEXT: %1:vgpr_32 = IMPLICIT_DEF
572# GCN-NEXT: %3:vgpr_32 = IMPLICIT_DEF
573# GCN-NEXT: %4:vgpr_32 = COPY %3
574# GCN-NEXT: %3:vgpr_32 = COPY %4
575# GCN-NEXT: %4:vgpr_32 = COPY %3
576# GCN-NEXT: %3:vgpr_32 = COPY %4
577# GCN-NEXT: %4:vgpr_32 = COPY %3
578# GCN-NEXT: %3:vgpr_32 = COPY %4
579# GCN-NEXT: %4:vgpr_32 = COPY %3
580# GCN-NEXT: %3:vgpr_32 = COPY %4
581# GCN-NEXT: %4:vgpr_32 = COPY %3
582# GCN-NEXT: %3:vgpr_32 = COPY %4
583# GCN-NEXT: %4:vgpr_32 = COPY %3
584# GCN-NEXT: %3:vgpr_32 = COPY %4
585# GCN-NEXT: %4:vgpr_32 = COPY %3
586# GCN-NEXT: %0:vgpr_32, %1:vgpr_32 = V_SWAP_B32 %1, %0, implicit $exec
587# GCN-NEXT: S_ENDPGM 0
588
589---
590name:            swap_exact_max_insns_apart
591registers:
592  - { id: 0, class: vgpr_32 }
593  - { id: 1, class: vgpr_32 }
594  - { id: 2, class: vgpr_32 }
595  - { id: 3, class: vgpr_32 }
596  - { id: 4, class: vgpr_32 }
597body:             |
598  bb.0:
599    %0 = IMPLICIT_DEF
600    %1 = IMPLICIT_DEF
601    %2 = COPY %0
602    %3 = IMPLICIT_DEF
603    %4 = COPY %3
604    %3 = COPY %4
605    %4 = COPY %3
606    %3 = COPY %4
607    %4 = COPY %3
608    %3 = COPY %4
609    %4 = COPY %3
610    %3 = COPY %4
611    %4 = COPY %3
612    %3 = COPY %4
613    %4 = COPY %3
614    %3 = COPY %4
615    %4 = COPY %3
616    %0 = COPY %1
617    %1 = COPY %2
618    S_ENDPGM 0
619...
620
621# GCN-LABEL: name: swap_too_far
622# GCN: bb.0:
623# GCN-NEXT: %0:vgpr_32 = IMPLICIT_DEF
624# GCN-NEXT: %1:vgpr_32 = IMPLICIT_DEF
625# GCN-NEXT: %2:vgpr_32 = COPY %0
626# GCN-NEXT: %3:vgpr_32 = IMPLICIT_DEF
627# GCN-NEXT: %4:vgpr_32 = COPY %3
628# GCN-NEXT: %3:vgpr_32 = COPY %4
629# GCN-NEXT: %4:vgpr_32 = COPY %3
630# GCN-NEXT: %3:vgpr_32 = COPY %4
631# GCN-NEXT: %4:vgpr_32 = COPY %3
632# GCN-NEXT: %3:vgpr_32 = COPY %4
633# GCN-NEXT: %4:vgpr_32 = COPY %3
634# GCN-NEXT: %3:vgpr_32 = COPY %4
635# GCN-NEXT: %4:vgpr_32 = COPY %3
636# GCN-NEXT: %3:vgpr_32 = COPY %4
637# GCN-NEXT: %4:vgpr_32 = COPY %3
638# GCN-NEXT: %3:vgpr_32 = COPY %4
639# GCN-NEXT: %4:vgpr_32 = COPY %3
640# GCN-NEXT: %3:vgpr_32 = COPY %4
641# GCN-NEXT: %0:vgpr_32 = COPY %1
642# GCN-NEXT: %1:vgpr_32 = COPY %2
643# GCN-NEXT: S_ENDPGM 0
644
645---
646name:            swap_too_far
647registers:
648  - { id: 0, class: vgpr_32 }
649  - { id: 1, class: vgpr_32 }
650  - { id: 2, class: vgpr_32 }
651  - { id: 3, class: vgpr_32 }
652  - { id: 4, class: vgpr_32 }
653body:             |
654  bb.0:
655    %0 = IMPLICIT_DEF
656    %1 = IMPLICIT_DEF
657    %2 = COPY %0
658    %3 = IMPLICIT_DEF
659    %4 = COPY %3
660    %3 = COPY %4
661    %4 = COPY %3
662    %3 = COPY %4
663    %4 = COPY %3
664    %3 = COPY %4
665    %4 = COPY %3
666    %3 = COPY %4
667    %4 = COPY %3
668    %3 = COPY %4
669    %4 = COPY %3
670    %3 = COPY %4
671    %4 = COPY %3
672    %3 = COPY %4
673    %0 = COPY %1
674    %1 = COPY %2
675    S_ENDPGM 0
676...
677
678# GCN-LABEL: name: swap_liveness_error_mov
679# GCN:      $vgpr6 = V_MOV_B32_e32 $vgpr1, implicit $exec
680# GCN-NEXT: $vgpr1, $vgpr5 = V_SWAP_B32 $vgpr5, $vgpr1, implicit $exec
681# GCN-NEXT: $vgpr5_vgpr6 = IMPLICIT_DEF
682# GCN-NEXT: $vgpr6 = V_MOV_B32_e32 $vgpr7, implicit $exec, implicit $vgpr6_vgpr7
683# GCN-NEXT: $vgpr5 = V_MOV_B32_e32 $vgpr6, implicit $exec
684
685---
686name: swap_liveness_error_mov
687tracksRegLiveness: true
688body:             |
689  bb.0:
690    liveins: $vgpr5, $vgpr1_vgpr2
691
692    $vgpr6 = V_MOV_B32_e32 $vgpr1, implicit $exec, implicit killed $vgpr1_vgpr2
693    $vgpr1 = V_MOV_B32_e32 killed $vgpr5, implicit $exec
694    $vgpr5 = V_MOV_B32_e32 $vgpr6, implicit $exec, implicit-def $vgpr5_vgpr6, implicit $vgpr6_vgpr7
695    $vgpr6 = V_MOV_B32_e32 $vgpr7, implicit $exec, implicit $vgpr6_vgpr7
696    $vgpr5 = V_MOV_B32_e32 $vgpr6, implicit $exec
697    S_ENDPGM 0
698...
699
700# GCN-LABEL: name: swap_liveness_error_copy
701# GCN:      $vgpr6 = COPY $vgpr1
702# GCN-NEXT: $vgpr1, $vgpr5 = V_SWAP_B32 $vgpr5, $vgpr1, implicit $exec
703# GCN-NEXT: $vgpr5_vgpr6 = IMPLICIT_DEF
704# GCN-NEXT: $vgpr6 = COPY $vgpr7, implicit $vgpr6_vgpr7
705# GCN-NEXT: $vgpr5 = COPY $vgpr6
706
707---
708name: swap_liveness_error_copy
709tracksRegLiveness: true
710body:             |
711  bb.0:
712    liveins: $vgpr5, $vgpr1_vgpr2
713
714    $vgpr6 = COPY $vgpr1, implicit killed $vgpr1_vgpr2
715    $vgpr1 = COPY killed $vgpr5
716    $vgpr5 = COPY $vgpr6, implicit-def $vgpr5_vgpr6, implicit $vgpr6_vgpr7
717    $vgpr6 = COPY $vgpr7, implicit $vgpr6_vgpr7
718    $vgpr5 = COPY $vgpr6
719    S_ENDPGM 0
720...
721
722# GCN-LABEL: name: swap_killed_t_early
723# GCN:      $vgpr2 = V_MOV_B32_e32 killed $vgpr0, implicit $exec
724# GCN-NEXT: $vgpr3 = V_MOV_B32_e32 killed $vgpr4, implicit $exec, implicit killed $vgpr2
725# GCN-NEXT: $vgpr0 = V_MOV_B32_e32 killed $vgpr1, implicit $exec
726# GCN-NEXT: $vgpr5 = V_MOV_B32_e32 killed $vgpr6, implicit $exec
727# GCN-NEXT: $vgpr1 = V_MOV_B32_e32 undef $vgpr2, implicit $exec
728
729---
730name:            swap_killed_t_early
731body:             |
732  bb.0:
733    liveins: $vgpr0, $vgpr1, $sgpr30_sgpr31
734    $vgpr2 = V_MOV_B32_e32 killed $vgpr0, implicit $exec
735    $vgpr3 = V_MOV_B32_e32 killed $vgpr4, implicit $exec, implicit killed $vgpr2
736    $vgpr0 = V_MOV_B32_e32 killed $vgpr1, implicit $exec
737    $vgpr5 = V_MOV_B32_e32 killed $vgpr6, implicit $exec
738    $vgpr1 = V_MOV_B32_e32 undef $vgpr2, implicit $exec
739    S_SETPC_B64_return $sgpr30_sgpr31, implicit $vgpr0, implicit $vgpr1
740...
741
742# GCN-LABEL: name: swap_killed_t_late
743# GCN:      $vgpr2 = V_MOV_B32_e32 killed $vgpr0, implicit $exec
744# GCN-NEXT: $vgpr3 = V_MOV_B32_e32 killed $vgpr4, implicit $exec
745# GCN-NEXT: $vgpr0 = V_MOV_B32_e32 killed $vgpr1, implicit $exec
746# GCN-NEXT: $vgpr5 = V_MOV_B32_e32 killed $vgpr6, implicit $exec, implicit killed $vgpr2
747# GCN-NEXT: $vgpr1 = V_MOV_B32_e32 undef $vgpr2, implicit $exec
748
749---
750name:            swap_killed_t_late
751body:             |
752  bb.0:
753    liveins: $vgpr0, $vgpr1, $sgpr30_sgpr31
754    $vgpr2 = V_MOV_B32_e32 killed $vgpr0, implicit $exec
755    $vgpr3 = V_MOV_B32_e32 killed $vgpr4, implicit $exec
756    $vgpr0 = V_MOV_B32_e32 killed $vgpr1, implicit $exec
757    $vgpr5 = V_MOV_B32_e32 killed $vgpr6, implicit $exec, implicit killed $vgpr2
758    $vgpr1 = V_MOV_B32_e32 undef $vgpr2, implicit $exec
759    S_SETPC_B64_return $sgpr30_sgpr31, implicit $vgpr0, implicit $vgpr1
760...
761
762# GCN-LABEL: name: swap_killed_x
763# GCN:      $vgpr2 = V_MOV_B32_e32 killed $vgpr0, implicit $exec
764# GCN-NEXT: $vgpr3 = V_MOV_B32_e32 killed $vgpr4, implicit $exec
765# GCN-NEXT: $vgpr0 = V_MOV_B32_e32 killed $vgpr1, implicit $exec
766# GCN-NEXT: $vgpr5 = V_MOV_B32_e32 killed $vgpr6, implicit $exec, implicit killed $vgpr0
767# GCN-NEXT: $vgpr1 = V_MOV_B32_e32 killed $vgpr2, implicit $exec
768
769---
770name:            swap_killed_x
771body:             |
772  bb.0:
773    liveins: $vgpr0, $vgpr1, $sgpr30_sgpr31
774    $vgpr2 = V_MOV_B32_e32 killed $vgpr0, implicit $exec
775    $vgpr3 = V_MOV_B32_e32 killed $vgpr4, implicit $exec
776    $vgpr0 = V_MOV_B32_e32 killed $vgpr1, implicit $exec
777    $vgpr5 = V_MOV_B32_e32 killed $vgpr6, implicit $exec, implicit killed $vgpr0
778    $vgpr1 = V_MOV_B32_e32 killed $vgpr2, implicit $exec
779    S_SETPC_B64_return $sgpr30_sgpr31, implicit $vgpr0, implicit $vgpr1
780...
781
782# GCN-LABEL: name: indirect_mov_t
783# GCN:      $vgpr2 = V_MOV_B32_e32 killed $vgpr0, implicit $exec, implicit $m0
784# GCN-NEXT: $vgpr0 = V_MOV_B32_e32 killed $vgpr1, implicit $exec
785# GCN-NEXT: $vgpr1 = V_MOV_B32_e32 killed $vgpr2, implicit $exec
786# GCN-NEXT: S_SETPC_B64_return $sgpr30_sgpr31, implicit $vgpr0, implicit $vgpr1
787
788---
789name:            indirect_mov_t
790body:             |
791  bb.0:
792    liveins: $vgpr0, $vgpr1, $sgpr30_sgpr31
793    $vgpr2 = V_MOV_B32_e32 killed $vgpr0, implicit $exec, implicit $m0
794    $vgpr0 = V_MOV_B32_e32 killed $vgpr1, implicit $exec
795    $vgpr1 = V_MOV_B32_e32 killed $vgpr2, implicit $exec
796    S_SETPC_B64_return $sgpr30_sgpr31, implicit $vgpr0, implicit $vgpr1
797...
798
799# GCN-LABEL: name: indirect_mov_x
800# GCN:      $vgpr2 = V_MOV_B32_e32 killed $vgpr0, implicit $exec
801# GCN-NEXT: $vgpr0 = V_MOV_B32_e32 killed $vgpr1, implicit $exec, implicit $m0
802# GCN-NEXT: $vgpr1 = V_MOV_B32_e32 killed $vgpr2, implicit $exec
803# GCN-NEXT: S_SETPC_B64_return $sgpr30_sgpr31, implicit $vgpr0, implicit $vgpr1
804
805---
806name:            indirect_mov_x
807body:             |
808  bb.0:
809    liveins: $vgpr0, $vgpr1, $sgpr30_sgpr31
810    $vgpr2 = V_MOV_B32_e32 killed $vgpr0, implicit $exec
811    $vgpr0 = V_MOV_B32_e32 killed $vgpr1, implicit $exec, implicit $m0
812    $vgpr1 = V_MOV_B32_e32 killed $vgpr2, implicit $exec
813    S_SETPC_B64_return $sgpr30_sgpr31, implicit $vgpr0, implicit $vgpr1
814...
815
816# GCN-LABEL: name: indirect_mov_y
817# GCN:      $vgpr2 = V_MOV_B32_e32 killed $vgpr0, implicit $exec
818# GCN-NEXT: $vgpr0 = V_MOV_B32_e32 killed $vgpr1, implicit $exec
819# GCN-NEXT: $vgpr1 = V_MOV_B32_e32 killed $vgpr2, implicit $exec, implicit $m0
820# GCN-NEXT: S_SETPC_B64_return $sgpr30_sgpr31, implicit $vgpr0, implicit $vgpr1
821
822---
823name:            indirect_mov_y
824body:             |
825  bb.0:
826    liveins: $vgpr0, $vgpr1, $sgpr30_sgpr31
827    $vgpr2 = V_MOV_B32_e32 killed $vgpr0, implicit $exec
828    $vgpr0 = V_MOV_B32_e32 killed $vgpr1, implicit $exec
829    $vgpr1 = V_MOV_B32_e32 killed $vgpr2, implicit $exec, implicit $m0
830    S_SETPC_B64_return $sgpr30_sgpr31, implicit $vgpr0, implicit $vgpr1
831...
832
833# GCN-LABEL: name: implicit_ops_mov_x_swap_b32
834# GCN: $vgpr0, $vgpr1 = V_SWAP_B32 $vgpr1, $vgpr0, implicit $exec, implicit $vgpr2, implicit killed $vgpr1_vgpr2
835
836---
837name:            implicit_ops_mov_x_swap_b32
838body:             |
839  bb.0:
840    liveins: $vgpr0, $vgpr1, $sgpr30_sgpr31
841    $vgpr3 = V_MOV_B32_e32 killed $vgpr0, implicit $exec
842    $vgpr0 = V_MOV_B32_e32 $vgpr1, implicit $exec, implicit $vgpr2, implicit killed $vgpr1_vgpr2
843    $vgpr1 = V_MOV_B32_e32 killed $vgpr3, implicit $exec
844    S_SETPC_B64_return $sgpr30_sgpr31, implicit $vgpr0, implicit $vgpr1
845...
846
847# GCN-LABEL: name: implict_ops_mov_x_swap_b64
848# GCN:      %2:vreg_64 = COPY %0
849# GCN-NEXT: %0:vreg_64 = COPY %1, implicit $vgpr0
850# GCN-NEXT: %1:vreg_64 = COPY %2
851
852---
853name:            implict_ops_mov_x_swap_b64
854registers:
855  - { id: 0, class: vreg_64 }
856  - { id: 1, class: vreg_64 }
857  - { id: 2, class: vreg_64 }
858body:             |
859  bb.0:
860    %0 = IMPLICIT_DEF
861    %1 = IMPLICIT_DEF
862    %2 = COPY %0
863    %0 = COPY %1, implicit $vgpr0
864    %1 = COPY %2
865...
866
867# GCN-LABEL: implicit_ops_mov_t_swap_b32
868# GCN:      $vgpr1 = IMPLICIT_DEF
869# GCN-NEXT: $vgpr0, $vgpr1 = V_SWAP_B32 $vgpr1, $vgpr0, implicit $exec
870
871---
872name:            implicit_ops_mov_t_swap_b32
873body:             |
874  bb.0:
875    liveins: $vgpr0, $vgpr1, $sgpr30_sgpr31
876    $vgpr3 = V_MOV_B32_e32 killed $vgpr0, implicit $exec, implicit $vgpr2, implicit killed $vgpr1_vgpr2, implicit-def $vgpr1
877    $vgpr0 = V_MOV_B32_e32 $vgpr1, implicit $exec
878    $vgpr1 = V_MOV_B32_e32 killed $vgpr3, implicit $exec
879    S_SETPC_B64_return $sgpr30_sgpr31, implicit $vgpr0, implicit $vgpr1
880...
881
882# GCN-LABEL: implicit_ops_mov_y_swap_b32
883# GCN:      $vgpr0, $vgpr1 = V_SWAP_B32 $vgpr1, $vgpr0, implicit $exec
884# GCN-NEXT: $vgpr0_vgpr1 = IMPLICIT_DEF
885
886---
887name:            implicit_ops_mov_y_swap_b32
888body:             |
889  bb.0:
890    liveins: $vgpr0, $vgpr1, $sgpr30_sgpr31
891    $vgpr3 = V_MOV_B32_e32 killed $vgpr0, implicit $exec
892    $vgpr0 = V_MOV_B32_e32 $vgpr1, implicit $exec
893    $vgpr1 = V_MOV_B32_e32 killed $vgpr3, implicit $exec, implicit $vgpr2, implicit-def $vgpr0_vgpr1, implicit killed $vgpr3
894    S_SETPC_B64_return $sgpr30_sgpr31, implicit $vgpr0, implicit $vgpr1
895...
896