1 # RUN: llc -simplify-mir -march=amdgcn -mcpu=gfx900 -run-pass=si-shrink-instructions -verify-machineinstrs %s -o - | FileCheck -check-prefix=GCN %s
3 # GCN-LABEL: name: swap_phys_condensed
7 # GCN-NEXT: $vgpr2 = V_MOV_B32_e32 $vgpr0, implicit $exec
8 # GCN-NEXT: $vgpr0, $vgpr1 = V_SWAP_B32 $vgpr1, $vgpr0, implicit $exec
9 # GCN-NEXT: S_SETPC_B64_return
11 name: swap_phys_condensed
12 tracksRegLiveness: true
15 liveins: $vgpr0, $vgpr1, $sgpr30_sgpr31
16 $vgpr2 = V_MOV_B32_e32 killed $vgpr0, implicit $exec
17 $vgpr0 = V_MOV_B32_e32 killed $vgpr1, implicit $exec
18 $vgpr1 = V_MOV_B32_e32 killed $vgpr2, implicit $exec
19 S_SETPC_B64_return $sgpr30_sgpr31, implicit $vgpr0, implicit $vgpr1
22 # GCN-LABEL: name: swap_phys_sparse
25 # GCN-NEXT: {{^[ ]*$}}
26 # GCN-NEXT: $vgpr2 = V_MOV_B32_e32 $vgpr0, implicit $exec
27 # GCN-NEXT: $vgpr3 = V_MOV_B32_e32 killed $vgpr4, implicit $exec
28 # GCN-NEXT: $vgpr0, $vgpr1 = V_SWAP_B32 $vgpr1, $vgpr0, implicit $exec
29 # GCN-NEXT: $vgpr5 = V_MOV_B32_e32 killed $vgpr6, implicit $exec
30 # GCN-NEXT: S_SETPC_B64_return
32 name: swap_phys_sparse
33 tracksRegLiveness: true
36 liveins: $vgpr0, $vgpr1, $vgpr4, $vgpr6, $sgpr30_sgpr31
37 $vgpr2 = V_MOV_B32_e32 killed $vgpr0, implicit $exec
38 $vgpr3 = V_MOV_B32_e32 killed $vgpr4, implicit $exec
39 $vgpr0 = V_MOV_B32_e32 killed $vgpr1, implicit $exec
40 $vgpr5 = V_MOV_B32_e32 killed $vgpr6, implicit $exec
41 $vgpr1 = V_MOV_B32_e32 killed $vgpr2, implicit $exec
42 S_SETPC_B64_return $sgpr30_sgpr31, implicit $vgpr0, implicit $vgpr1
45 # GCN-LABEL: name: swap_phys_liveout
48 # GCN-NEXT: {{^[ ]*$}}
49 # GCN-NEXT: $vgpr2 = V_MOV_B32_e32 $vgpr0, implicit $exec
50 # GCN-NEXT: $vgpr0, $vgpr1 = V_SWAP_B32 $vgpr1, $vgpr0, implicit $exec
51 # GCN-NEXT: S_SETPC_B64_return
53 name: swap_phys_liveout
54 tracksRegLiveness: true
57 liveins: $vgpr0, $vgpr1, $sgpr30_sgpr31
58 $vgpr2 = V_MOV_B32_e32 killed $vgpr0, implicit $exec
59 $vgpr0 = V_MOV_B32_e32 killed $vgpr1, implicit $exec
60 $vgpr1 = V_MOV_B32_e32 killed $vgpr2, implicit $exec
61 S_SETPC_B64_return $sgpr30_sgpr31, implicit $vgpr0, implicit $vgpr1
64 # GCN-LABEL: name: swap_phys_liveout_superreg
67 # GCN-NEXT: {{^[ ]*$}}
68 # GCN-NEXT: $vgpr2 = V_MOV_B32_e32 $vgpr0, implicit $exec
69 # GCN-NEXT: $vgpr0, $vgpr1 = V_SWAP_B32 $vgpr1, $vgpr0, implicit $exec
70 # GCN-NEXT: S_SETPC_B64_return
72 name: swap_phys_liveout_superreg
73 tracksRegLiveness: true
76 liveins: $vgpr0, $vgpr1, $sgpr30_sgpr31
77 $vgpr2 = V_MOV_B32_e32 killed $vgpr0, implicit $exec
78 $vgpr0 = V_MOV_B32_e32 killed $vgpr1, implicit $exec
79 $vgpr1 = V_MOV_B32_e32 killed $vgpr2, implicit $exec
80 S_SETPC_B64_return $sgpr30_sgpr31, implicit $vgpr0, implicit $vgpr1
83 # GCN-LABEL: name: swap_phys_b64
86 # GCN-NEXT: {{^[ ]*$}}
87 # GCN-NEXT: $vgpr4_vgpr5 = COPY $vgpr0_vgpr1
88 # GCN-NEXT: $vgpr0, $vgpr2 = V_SWAP_B32 $vgpr2, $vgpr0, implicit $exec
89 # GCN-NEXT: $vgpr1, $vgpr3 = V_SWAP_B32 $vgpr3, $vgpr1, implicit $exec
92 tracksRegLiveness: true
95 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5
96 $vgpr4_vgpr5 = COPY killed $vgpr0_vgpr1
97 $vgpr0_vgpr1 = COPY killed $vgpr2_vgpr3
98 $vgpr2_vgpr3 = COPY killed $vgpr4_vgpr5
101 # GCN-LABEL: name: swap_phys_overlap_x
104 # GCN-NEXT: {{^[ ]*$}}
105 # GCN-NEXT: $vgpr2 = V_MOV_B32_e32 $vgpr0, implicit $exec
106 # GCN-NEXT: $vgpr3_vgpr4 = V_ADD_F64_e64 0, $vgpr0_vgpr1, 0, $vgpr3_vgpr4, 0, 0, implicit $mode, implicit $exec
107 # GCN-NEXT: $vgpr0 = V_MOV_B32_e32 killed $vgpr1, implicit $exec
108 # GCN-NEXT: $vgpr1 = V_MOV_B32_e32 killed $vgpr2, implicit $exec
110 name: swap_phys_overlap_x
111 tracksRegLiveness: true
114 liveins: $vgpr0_vgpr1, $vgpr3_vgpr4
115 $vgpr2 = V_MOV_B32_e32 $vgpr0, implicit $exec
116 $vgpr3_vgpr4 = V_ADD_F64_e64 0, $vgpr0_vgpr1, 0, $vgpr3_vgpr4, 0, 0, implicit $mode, implicit $exec
117 $vgpr0 = V_MOV_B32_e32 killed $vgpr1, implicit $exec
118 $vgpr1 = V_MOV_B32_e32 killed $vgpr2, implicit $exec
121 # GCN-LABEL: name: swap_phys_clobber_y
124 # GCN-NEXT: {{^[ ]*$}}
125 # GCN-NEXT: $vgpr2 = V_MOV_B32_e32 $vgpr0, implicit $exec
126 # GCN-NEXT: $vgpr0 = V_MOV_B32_e32 killed $vgpr1, implicit $exec
127 # GCN-NEXT: $vgpr1 = V_MOV_B32_e32 0, implicit $exec
128 # GCN-NEXT: $vgpr1 = V_MOV_B32_e32 killed $vgpr2, implicit $exec
130 name: swap_phys_clobber_y
131 tracksRegLiveness: true
134 liveins: $vgpr0, $vgpr1
135 $vgpr2 = V_MOV_B32_e32 $vgpr0, implicit $exec
136 $vgpr0 = V_MOV_B32_e32 killed $vgpr1, implicit $exec
137 $vgpr1 = V_MOV_B32_e32 0, implicit $exec
138 $vgpr1 = V_MOV_B32_e32 killed $vgpr2, implicit $exec
142 # GCN-LABEL: name: swap_virt_copy_condense
143 # GCN: %0:vgpr_32, %1:vgpr_32 = V_SWAP_B32 %1, %0, implicit $exec
145 name: swap_virt_copy_condense
146 tracksRegLiveness: true
148 - { id: 0, class: vgpr_32 }
149 - { id: 1, class: vgpr_32 }
150 - { id: 2, class: vgpr_32 }
160 # GCN-LABEL: name: swap_virt_copy_sparse
161 # GCN: %0:vgpr_32, %1:vgpr_32 = V_SWAP_B32 %1, %0, implicit $exec
163 name: swap_virt_copy_sparse
164 tracksRegLiveness: true
166 - { id: 0, class: vgpr_32 }
167 - { id: 1, class: vgpr_32 }
168 - { id: 2, class: vgpr_32 }
180 # GCN-LABEL: name: swap_virt_copy_subreg
181 # GCN: %0.sub0:vreg_64, %1.sub0:vreg_64 = V_SWAP_B32 %1.sub0, %0.sub0, implicit $exec
183 name: swap_virt_copy_subreg
184 tracksRegLiveness: true
186 - { id: 0, class: vreg_64 }
187 - { id: 1, class: vreg_64 }
188 - { id: 2, class: vreg_64 }
193 %2.sub0 = COPY %0.sub0
194 %2.sub1 = COPY %0.sub1
195 %0.sub0 = COPY %1.sub0
196 %0.sub1 = COPY %1.sub1
197 %1.sub0 = COPY %2.sub0
200 # GCN-LABEL: name: swap_virt_mov
201 # GCN: %0:vgpr_32, %1:vgpr_32 = V_SWAP_B32 %1, %0, implicit $exec
204 tracksRegLiveness: true
206 - { id: 0, class: vgpr_32 }
207 - { id: 1, class: vgpr_32 }
208 - { id: 2, class: vgpr_32 }
213 %2 = V_MOV_B32_e32 %0, implicit $exec
214 %0 = V_MOV_B32_e32 %1, implicit $exec
215 %1 = V_MOV_B32_e32 %2, implicit $exec
218 # GCN-LABEL: name: swap_virt_read_x
220 # GCN-NEXT: %0:vgpr_32 = IMPLICIT_DEF
221 # GCN-NEXT: %1:vgpr_32 = IMPLICIT_DEF
222 # GCN-NEXT: %2:vgpr_32 = COPY %0
223 # GCN-NEXT: %3:vgpr_32 = COPY %0
224 # GCN-NEXT: %0:vgpr_32 = COPY %1
225 # GCN-NEXT: %1:vgpr_32 = COPY %2
226 # GCN-NEXT: S_ENDPGM 0
229 name: swap_virt_read_x
230 tracksRegLiveness: true
232 - { id: 0, class: vgpr_32 }
233 - { id: 1, class: vgpr_32 }
234 - { id: 2, class: vgpr_32 }
235 - { id: 3, class: vgpr_32 }
247 # GCN-LABEL: name: swap_virt_read_t_twice
249 # GCN-NEXT: %0:vgpr_32 = IMPLICIT_DEF
250 # GCN-NEXT: %1:vgpr_32 = IMPLICIT_DEF
251 # GCN-NEXT: %2:vgpr_32 = COPY %0
252 # GCN-NEXT: %3:vgpr_32 = COPY %2
253 # GCN-NEXT: %0:vgpr_32, %1:vgpr_32 = V_SWAP_B32 %1, %0, implicit $exec
254 # GCN-NEXT: S_ENDPGM 0
257 name: swap_virt_read_t_twice
258 tracksRegLiveness: true
260 - { id: 0, class: vgpr_32 }
261 - { id: 1, class: vgpr_32 }
262 - { id: 2, class: vgpr_32 }
263 - { id: 3, class: vgpr_32 }
275 # GCN-LABEL: name: swap_virt_clobber_y
277 # GCN-NEXT: %0:vgpr_32 = IMPLICIT_DEF
278 # GCN-NEXT: %1:vgpr_32 = IMPLICIT_DEF
279 # GCN-NEXT: %2:vgpr_32 = COPY %0
280 # GCN-NEXT: %0:vgpr_32 = COPY %1
281 # GCN-NEXT: %1:vgpr_32 = IMPLICIT_DEF
282 # GCN-NEXT: %1:vgpr_32 = COPY %2
283 # GCN-NEXT: S_ENDPGM 0
286 name: swap_virt_clobber_y
287 tracksRegLiveness: true
289 - { id: 0, class: vgpr_32 }
290 - { id: 1, class: vgpr_32 }
291 - { id: 2, class: vgpr_32 }
303 # GCN-LABEL: name: swap_virt_clobber_x1
305 # GCN-NEXT: %0:vgpr_32 = IMPLICIT_DEF
306 # GCN-NEXT: %1:vgpr_32 = IMPLICIT_DEF
307 # GCN-NEXT: %2:vgpr_32 = COPY %0
308 # GCN-NEXT: %0:vgpr_32 = COPY %1
309 # GCN-NEXT: %0:vgpr_32 = IMPLICIT_DEF
310 # GCN-NEXT: %1:vgpr_32 = COPY %2
311 # GCN-NEXT: S_ENDPGM 0
314 name: swap_virt_clobber_x1
315 tracksRegLiveness: true
317 - { id: 0, class: vgpr_32 }
318 - { id: 1, class: vgpr_32 }
319 - { id: 2, class: vgpr_32 }
331 # GCN-LABEL: name: swap_virt_clobber_x2
333 # GCN-NEXT: %0:vgpr_32 = IMPLICIT_DEF
334 # GCN-NEXT: %1:vgpr_32 = IMPLICIT_DEF
335 # GCN-NEXT: %2:vgpr_32 = COPY %0
336 # GCN-NEXT: %0:vgpr_32 = IMPLICIT_DEF
337 # GCN-NEXT: %0:vgpr_32 = COPY %1
338 # GCN-NEXT: %1:vgpr_32 = COPY %2
339 # GCN-NEXT: S_ENDPGM 0
342 name: swap_virt_clobber_x2
343 tracksRegLiveness: true
345 - { id: 0, class: vgpr_32 }
346 - { id: 1, class: vgpr_32 }
347 - { id: 2, class: vgpr_32 }
359 # GCN-LABEL: name: swap_virt_clobber_t
361 # GCN-NEXT: %0:vgpr_32 = IMPLICIT_DEF
362 # GCN-NEXT: %1:vgpr_32 = IMPLICIT_DEF
363 # GCN-NEXT: %2:vgpr_32 = COPY %0
364 # GCN-NEXT: %0:vgpr_32 = COPY %1
365 # GCN-NEXT: %2:vgpr_32 = IMPLICIT_DEF
366 # GCN-NEXT: %1:vgpr_32 = COPY %2
367 # GCN-NEXT: S_ENDPGM 0
370 name: swap_virt_clobber_t
371 tracksRegLiveness: true
373 - { id: 0, class: vgpr_32 }
374 - { id: 1, class: vgpr_32 }
375 - { id: 2, class: vgpr_32 }
387 # GCN-LABEL: name: swap_virt_copy_subreg_overlap_x_full
389 # GCN-NEXT: %0:vreg_64 = IMPLICIT_DEF
390 # GCN-NEXT: %1:vreg_64 = IMPLICIT_DEF
391 # GCN-NEXT: %2.sub0:vreg_64 = COPY %0.sub0
392 # GCN-NEXT: %3:vreg_64 = COPY %0
393 # GCN-NEXT: %0.sub0:vreg_64 = COPY %1.sub0
394 # GCN-NEXT: %1.sub0:vreg_64 = COPY %2.sub0
396 name: swap_virt_copy_subreg_overlap_x_full
397 tracksRegLiveness: true
399 - { id: 0, class: vreg_64 }
400 - { id: 1, class: vreg_64 }
401 - { id: 2, class: vreg_64 }
402 - { id: 3, class: vreg_64 }
407 %2.sub0 = COPY %0.sub0
409 %0.sub0 = COPY %1.sub0
410 %1.sub0 = COPY %2.sub0
413 # GCN-LABEL: name: swap_virt_copy_subreg_overlap_x_part
415 # GCN-NEXT: %0:vreg_128 = IMPLICIT_DEF
416 # GCN-NEXT: %1:vreg_64 = IMPLICIT_DEF
417 # GCN-NEXT: %2.sub0:vreg_64 = COPY %0.sub0
418 # GCN-NEXT: %3:vreg_64 = COPY %0.sub0_sub1
419 # GCN-NEXT: %0.sub0:vreg_128 = COPY %1.sub0
420 # GCN-NEXT: %1.sub0:vreg_64 = COPY %2.sub0
422 name: swap_virt_copy_subreg_overlap_x_part
423 tracksRegLiveness: true
425 - { id: 0, class: vreg_128 }
426 - { id: 1, class: vreg_64 }
427 - { id: 2, class: vreg_64 }
428 - { id: 3, class: vreg_64 }
433 %2.sub0 = COPY %0.sub0
434 %3 = COPY %0.sub0_sub1
435 %0.sub0 = COPY %1.sub0
436 %1.sub0 = COPY %2.sub0
439 # GCN-LABEL: name: swap_virt_copy_subreg_wide_y
441 # GCN-NEXT: %0:vreg_64 = IMPLICIT_DEF
442 # GCN-NEXT: %1:vreg_64 = IMPLICIT_DEF
443 # GCN-NEXT: %2.sub0:vreg_64 = COPY %0.sub0
444 # GCN-NEXT: %0.sub0:vreg_64 = COPY %1.sub0
445 # GCN-NEXT: %1:vreg_64 = COPY %2
447 name: swap_virt_copy_subreg_wide_y
448 tracksRegLiveness: true
450 - { id: 0, class: vreg_64 }
451 - { id: 1, class: vreg_64 }
452 - { id: 2, class: vreg_64 }
457 %2.sub0 = COPY %0.sub0
458 %0.sub0 = COPY %1.sub0
462 # GCN-LABEL: name: swap_virt_b64
464 # GCN-NEXT: %0:vreg_64 = IMPLICIT_DEF
465 # GCN-NEXT: %1:vreg_64 = IMPLICIT_DEF
466 # GCN-NEXT: %0.sub0:vreg_64, %1.sub0:vreg_64 = V_SWAP_B32 %1.sub0, %0.sub0, implicit $exec
467 # GCN-NEXT: %0.sub1:vreg_64, %1.sub1:vreg_64 = V_SWAP_B32 %1.sub1, %0.sub1, implicit $exec
470 tracksRegLiveness: true
472 - { id: 0, class: vreg_64 }
473 - { id: 1, class: vreg_64 }
474 - { id: 2, class: vreg_64 }
484 # GCN-LABEL: name: swap_virt_b128
486 # GCN-NEXT: %0:vreg_128 = IMPLICIT_DEF
487 # GCN-NEXT: %1:vreg_128 = IMPLICIT_DEF
488 # GCN-NEXT: %0.sub0:vreg_128, %1.sub0:vreg_128 = V_SWAP_B32 %1.sub0, %0.sub0, implicit $exec
489 # GCN-NEXT: %0.sub1:vreg_128, %1.sub1:vreg_128 = V_SWAP_B32 %1.sub1, %0.sub1, implicit $exec
490 # GCN-NEXT: %0.sub2:vreg_128, %1.sub2:vreg_128 = V_SWAP_B32 %1.sub2, %0.sub2, implicit $exec
491 # GCN-NEXT: %0.sub3:vreg_128, %1.sub3:vreg_128 = V_SWAP_B32 %1.sub3, %0.sub3, implicit $exec
494 tracksRegLiveness: true
496 - { id: 0, class: vreg_128 }
497 - { id: 1, class: vreg_128 }
498 - { id: 2, class: vreg_128 }
508 # GCN-LABEL: name: swap_virt_b128_sub0_1
510 # GCN-NEXT: %0:vreg_128 = IMPLICIT_DEF
511 # GCN-NEXT: %1:vreg_128 = IMPLICIT_DEF
512 # GCN-NEXT: %0.sub0:vreg_128, %1.sub0:vreg_128 = V_SWAP_B32 %1.sub0, %0.sub0, implicit $exec
513 # GCN-NEXT: %0.sub1:vreg_128, %1.sub1:vreg_128 = V_SWAP_B32 %1.sub1, %0.sub1, implicit $exec
514 # GCN-NEXT: S_ENDPGM 0
516 name: swap_virt_b128_sub0_1
517 tracksRegLiveness: true
519 - { id: 0, class: vreg_128 }
520 - { id: 1, class: vreg_128 }
521 - { id: 2, class: vreg_128 }
526 %2.sub0_sub1 = COPY %0.sub0_sub1
527 %0.sub0_sub1 = COPY %1.sub0_sub1
528 %1.sub0_sub1 = COPY %2.sub0_sub1
532 # GCN-LABEL: name: swap_virt_b128_sub2_3
534 # GCN-NEXT: %0:vreg_128 = IMPLICIT_DEF
535 # GCN-NEXT: %1:vreg_128 = IMPLICIT_DEF
536 # GCN-NEXT: %0.sub2:vreg_128, %1.sub2:vreg_128 = V_SWAP_B32 %1.sub2, %0.sub2, implicit $exec
537 # GCN-NEXT: %0.sub3:vreg_128, %1.sub3:vreg_128 = V_SWAP_B32 %1.sub3, %0.sub3, implicit $exec
538 # GCN-NEXT: S_ENDPGM 0
540 name: swap_virt_b128_sub2_3
541 tracksRegLiveness: true
543 - { id: 0, class: vreg_128 }
544 - { id: 1, class: vreg_128 }
545 - { id: 2, class: vreg_128 }
550 %2.sub2_sub3 = COPY %0.sub2_sub3
551 %0.sub2_sub3 = COPY %1.sub2_sub3
552 %1.sub2_sub3 = COPY %2.sub2_sub3
557 # GCN-LABEL: name: swap_virt_s_to_s
559 # GCN-NEXT: %0:sgpr_32 = IMPLICIT_DEF
560 # GCN-NEXT: %1:sgpr_32 = IMPLICIT_DEF
561 # GCN-NEXT: %2:sgpr_32 = COPY %0
562 # GCN-NEXT: %0:sgpr_32 = COPY %1
563 # GCN-NEXT: %1:sgpr_32 = COPY %2
565 name: swap_virt_s_to_s
566 tracksRegLiveness: true
568 - { id: 0, class: sgpr_32 }
569 - { id: 1, class: sgpr_32 }
570 - { id: 2, class: sgpr_32 }
580 # GCN-LABEL: name: swap_virt_copy_subreg_impdef_super
581 # GCN: %2:vreg_64 = IMPLICIT_DEF
582 # GCN-NEXT: %2.sub1:vreg_64 = COPY %0.sub1
583 # GCN-NEXT: %0.sub0:vreg_64, %1.sub0:vreg_64 = V_SWAP_B32 %1.sub0, %0.sub0, implicit $exec
585 name: swap_virt_copy_subreg_impdef_super
586 tracksRegLiveness: true
588 - { id: 0, class: vreg_64 }
589 - { id: 1, class: vreg_64 }
590 - { id: 2, class: vreg_64 }
595 %2.sub0 = COPY %0.sub0, implicit-def %2, implicit $exec
596 %2.sub1 = COPY %0.sub1
597 %0.sub0 = COPY %1.sub0
598 %0.sub1 = COPY %1.sub1
599 %1.sub0 = COPY %2.sub0
602 # GCN-LABEL: name: swap_virt_copy_subreg_impuse_x
604 # GCN-NEXT: %0:vreg_64 = IMPLICIT_DEF
605 # GCN-NEXT: %1:vreg_64 = IMPLICIT_DEF
606 # GCN-NEXT: %2.sub0:vreg_64 = COPY %0.sub0
607 # GCN-NEXT: %2.sub1:vreg_64 = COPY %0.sub1
608 # GCN-NEXT: %0.sub0:vreg_64 = COPY %1.sub0, implicit %0
609 # GCN-NEXT: %0.sub1:vreg_64 = COPY %1.sub1
610 # GCN-NEXT: %1.sub0:vreg_64 = COPY %2.sub0
611 # GCN-NEXT: S_ENDPGM 0
613 name: swap_virt_copy_subreg_impuse_x
614 tracksRegLiveness: true
616 - { id: 0, class: vreg_64 }
617 - { id: 1, class: vreg_64 }
618 - { id: 2, class: vreg_64 }
623 %2.sub0 = COPY %0.sub0
624 %2.sub1 = COPY %0.sub1
625 %0.sub0 = COPY %1.sub0, implicit %0
626 %0.sub1 = COPY %1.sub1
627 %1.sub0 = COPY %2.sub0
631 # GCN-LABEL: name: swap_exact_max_insns_apart
633 # GCN-NEXT: %0:vgpr_32 = IMPLICIT_DEF
634 # GCN-NEXT: %1:vgpr_32 = IMPLICIT_DEF
635 # GCN-NEXT: %3:vgpr_32 = IMPLICIT_DEF
636 # GCN-NEXT: %4:vgpr_32 = COPY %3
637 # GCN-NEXT: %3:vgpr_32 = COPY %4
638 # GCN-NEXT: %4:vgpr_32 = COPY %3
639 # GCN-NEXT: %3:vgpr_32 = COPY %4
640 # GCN-NEXT: %4:vgpr_32 = COPY %3
641 # GCN-NEXT: %3:vgpr_32 = COPY %4
642 # GCN-NEXT: %4:vgpr_32 = COPY %3
643 # GCN-NEXT: %3:vgpr_32 = COPY %4
644 # GCN-NEXT: %4:vgpr_32 = COPY %3
645 # GCN-NEXT: %3:vgpr_32 = COPY %4
646 # GCN-NEXT: %4:vgpr_32 = COPY %3
647 # GCN-NEXT: %3:vgpr_32 = COPY %4
648 # GCN-NEXT: %4:vgpr_32 = COPY %3
649 # GCN-NEXT: %0:vgpr_32, %1:vgpr_32 = V_SWAP_B32 %1, %0, implicit $exec
650 # GCN-NEXT: S_ENDPGM 0
653 name: swap_exact_max_insns_apart
654 tracksRegLiveness: true
656 - { id: 0, class: vgpr_32 }
657 - { id: 1, class: vgpr_32 }
658 - { id: 2, class: vgpr_32 }
659 - { id: 3, class: vgpr_32 }
660 - { id: 4, class: vgpr_32 }
685 # GCN-LABEL: name: swap_too_far
687 # GCN-NEXT: %0:vgpr_32 = IMPLICIT_DEF
688 # GCN-NEXT: %1:vgpr_32 = IMPLICIT_DEF
689 # GCN-NEXT: %2:vgpr_32 = COPY %0
690 # GCN-NEXT: %3:vgpr_32 = IMPLICIT_DEF
691 # GCN-NEXT: %4:vgpr_32 = COPY %3
692 # GCN-NEXT: %3:vgpr_32 = COPY %4
693 # GCN-NEXT: %4:vgpr_32 = COPY %3
694 # GCN-NEXT: %3:vgpr_32 = COPY %4
695 # GCN-NEXT: %4:vgpr_32 = COPY %3
696 # GCN-NEXT: %3:vgpr_32 = COPY %4
697 # GCN-NEXT: %4:vgpr_32 = COPY %3
698 # GCN-NEXT: %3:vgpr_32 = COPY %4
699 # GCN-NEXT: %4:vgpr_32 = COPY %3
700 # GCN-NEXT: %3:vgpr_32 = COPY %4
701 # GCN-NEXT: %4:vgpr_32 = COPY %3
702 # GCN-NEXT: %3:vgpr_32 = COPY %4
703 # GCN-NEXT: %4:vgpr_32 = COPY %3
704 # GCN-NEXT: %3:vgpr_32 = COPY %4
705 # GCN-NEXT: %0:vgpr_32 = COPY %1
706 # GCN-NEXT: %1:vgpr_32 = COPY %2
707 # GCN-NEXT: S_ENDPGM 0
711 tracksRegLiveness: true
713 - { id: 0, class: vgpr_32 }
714 - { id: 1, class: vgpr_32 }
715 - { id: 2, class: vgpr_32 }
716 - { id: 3, class: vgpr_32 }
717 - { id: 4, class: vgpr_32 }
743 # GCN-LABEL: name: swap_liveness_error_mov
744 # GCN: $vgpr6 = V_MOV_B32_e32 $vgpr1, implicit $exec
745 # GCN-NEXT: $vgpr1, $vgpr5 = V_SWAP_B32 $vgpr5, $vgpr1, implicit $exec
746 # GCN-NEXT: $vgpr5_vgpr6 = IMPLICIT_DEF
747 # GCN-NEXT: $vgpr6 = V_MOV_B32_e32 $vgpr7, implicit $exec, implicit $vgpr6_vgpr7
748 # GCN-NEXT: $vgpr5 = V_MOV_B32_e32 $vgpr6, implicit $exec
751 name: swap_liveness_error_mov
752 tracksRegLiveness: true
755 liveins: $vgpr5, $vgpr1_vgpr2
757 $vgpr6 = V_MOV_B32_e32 $vgpr1, implicit $exec, implicit killed $vgpr1_vgpr2
758 $vgpr1 = V_MOV_B32_e32 killed $vgpr5, implicit $exec
759 $vgpr5 = V_MOV_B32_e32 $vgpr6, implicit $exec, implicit-def $vgpr5_vgpr6, implicit $vgpr6_vgpr7
760 $vgpr6 = V_MOV_B32_e32 $vgpr7, implicit $exec, implicit $vgpr6_vgpr7
761 $vgpr5 = V_MOV_B32_e32 $vgpr6, implicit $exec
765 # GCN-LABEL: name: swap_liveness_error_copy
766 # GCN: $vgpr6 = COPY $vgpr1
767 # GCN-NEXT: $vgpr1, $vgpr5 = V_SWAP_B32 $vgpr5, $vgpr1, implicit $exec
768 # GCN-NEXT: $vgpr5_vgpr6 = IMPLICIT_DEF
769 # GCN-NEXT: $vgpr6 = COPY $vgpr7, implicit $vgpr6_vgpr7
770 # GCN-NEXT: $vgpr5 = COPY $vgpr6
773 name: swap_liveness_error_copy
774 tracksRegLiveness: true
777 liveins: $vgpr5, $vgpr1_vgpr2
779 $vgpr6 = COPY $vgpr1, implicit killed $vgpr1_vgpr2
780 $vgpr1 = COPY killed $vgpr5
781 $vgpr5 = COPY $vgpr6, implicit-def $vgpr5_vgpr6, implicit $vgpr6_vgpr7
782 $vgpr6 = COPY $vgpr7, implicit $vgpr6_vgpr7
787 # GCN-LABEL: name: swap_killed_t_early
788 # GCN: $vgpr2 = V_MOV_B32_e32 killed $vgpr0, implicit $exec
789 # GCN-NEXT: $vgpr3 = V_MOV_B32_e32 killed $vgpr4, implicit $exec, implicit killed $vgpr2
790 # GCN-NEXT: $vgpr0 = V_MOV_B32_e32 killed $vgpr1, implicit $exec
791 # GCN-NEXT: $vgpr5 = V_MOV_B32_e32 killed $vgpr6, implicit $exec
792 # GCN-NEXT: $vgpr1 = V_MOV_B32_e32 undef $vgpr2, implicit $exec
795 name: swap_killed_t_early
796 tracksRegLiveness: true
799 liveins: $vgpr0, $vgpr1, $vgpr4, $vgpr6, $sgpr30_sgpr31
800 $vgpr2 = V_MOV_B32_e32 killed $vgpr0, implicit $exec
801 $vgpr3 = V_MOV_B32_e32 killed $vgpr4, implicit $exec, implicit killed $vgpr2
802 $vgpr0 = V_MOV_B32_e32 killed $vgpr1, implicit $exec
803 $vgpr5 = V_MOV_B32_e32 killed $vgpr6, implicit $exec
804 $vgpr1 = V_MOV_B32_e32 undef $vgpr2, implicit $exec
805 S_SETPC_B64_return $sgpr30_sgpr31, implicit $vgpr0, implicit $vgpr1
808 # GCN-LABEL: name: swap_killed_t_late
809 # GCN: $vgpr2 = V_MOV_B32_e32 killed $vgpr0, implicit $exec
810 # GCN-NEXT: $vgpr3 = V_MOV_B32_e32 killed $vgpr4, implicit $exec
811 # GCN-NEXT: $vgpr0 = V_MOV_B32_e32 killed $vgpr1, implicit $exec
812 # GCN-NEXT: $vgpr5 = V_MOV_B32_e32 killed $vgpr6, implicit $exec, implicit killed $vgpr2
813 # GCN-NEXT: $vgpr1 = V_MOV_B32_e32 undef $vgpr2, implicit $exec
816 name: swap_killed_t_late
817 tracksRegLiveness: true
820 liveins: $vgpr0, $vgpr1, $vgpr4, $vgpr6, $sgpr30_sgpr31
821 $vgpr2 = V_MOV_B32_e32 killed $vgpr0, implicit $exec
822 $vgpr3 = V_MOV_B32_e32 killed $vgpr4, implicit $exec
823 $vgpr0 = V_MOV_B32_e32 killed $vgpr1, implicit $exec
824 $vgpr5 = V_MOV_B32_e32 killed $vgpr6, implicit $exec, implicit killed $vgpr2
825 $vgpr1 = V_MOV_B32_e32 undef $vgpr2, implicit $exec
826 S_SETPC_B64_return $sgpr30_sgpr31, implicit $vgpr0, implicit $vgpr1
829 # GCN-LABEL: name: swap_killed_x
830 # GCN: $vgpr2 = V_MOV_B32_e32 killed $vgpr0, implicit $exec
831 # GCN-NEXT: $vgpr3 = V_MOV_B32_e32 killed $vgpr4, implicit $exec
832 # GCN-NEXT: $vgpr0 = V_MOV_B32_e32 killed $vgpr1, implicit $exec
833 # GCN-NEXT: $vgpr5 = V_MOV_B32_e32 killed $vgpr6, implicit $exec, implicit killed $vgpr0
834 # GCN-NEXT: $vgpr1 = V_MOV_B32_e32 killed $vgpr2, implicit $exec
838 tracksRegLiveness: true
841 liveins: $vgpr0, $vgpr1, $vgpr4, $vgpr6, $sgpr30_sgpr31
842 $vgpr2 = V_MOV_B32_e32 killed $vgpr0, implicit $exec
843 $vgpr3 = V_MOV_B32_e32 killed $vgpr4, implicit $exec
844 $vgpr0 = V_MOV_B32_e32 killed $vgpr1, implicit $exec
845 $vgpr5 = V_MOV_B32_e32 killed $vgpr6, implicit $exec, implicit killed $vgpr0
846 $vgpr1 = V_MOV_B32_e32 killed $vgpr2, implicit $exec
847 S_SETPC_B64_return $sgpr30_sgpr31, implicit $vgpr1
850 # GCN-LABEL: name: indirect_mov_t
851 # GCN: $vgpr2 = V_MOV_B32_indirect_read killed $vgpr0, implicit $exec, implicit $m0
852 # GCN-NEXT: $vgpr0 = V_MOV_B32_e32 killed $vgpr1, implicit $exec
853 # GCN-NEXT: $vgpr1 = V_MOV_B32_e32 killed $vgpr2, implicit $exec
854 # GCN-NEXT: S_SETPC_B64_return $sgpr30_sgpr31, implicit $vgpr0, implicit $vgpr1
858 tracksRegLiveness: true
861 liveins: $vgpr0, $vgpr1, $sgpr30_sgpr31
862 $vgpr2 = V_MOV_B32_indirect_read killed $vgpr0, implicit $exec, implicit $m0
863 $vgpr0 = V_MOV_B32_e32 killed $vgpr1, implicit $exec
864 $vgpr1 = V_MOV_B32_e32 killed $vgpr2, implicit $exec
865 S_SETPC_B64_return $sgpr30_sgpr31, implicit $vgpr0, implicit $vgpr1
868 # GCN-LABEL: name: indirect_mov_x
869 # GCN: $vgpr2 = V_MOV_B32_e32 killed $vgpr0, implicit $exec
870 # GCN-NEXT: $vgpr0 = V_MOV_B32_indirect_read killed $vgpr1, implicit $exec, implicit $m0
871 # GCN-NEXT: $vgpr1 = V_MOV_B32_e32 killed $vgpr2, implicit $exec
872 # GCN-NEXT: S_SETPC_B64_return $sgpr30_sgpr31, implicit $vgpr0, implicit $vgpr1
876 tracksRegLiveness: true
879 liveins: $vgpr0, $vgpr1, $sgpr30_sgpr31
880 $vgpr2 = V_MOV_B32_e32 killed $vgpr0, implicit $exec
881 $vgpr0 = V_MOV_B32_indirect_read killed $vgpr1, implicit $exec, implicit $m0
882 $vgpr1 = V_MOV_B32_e32 killed $vgpr2, implicit $exec
883 S_SETPC_B64_return $sgpr30_sgpr31, implicit $vgpr0, implicit $vgpr1
886 # GCN-LABEL: name: indirect_mov_y
887 # GCN: $vgpr2 = V_MOV_B32_e32 killed $vgpr0, implicit $exec
888 # GCN-NEXT: $vgpr0 = V_MOV_B32_e32 killed $vgpr1, implicit $exec
889 # GCN-NEXT: $vgpr1 = V_MOV_B32_indirect_read killed $vgpr2, implicit $exec, implicit $m0
890 # GCN-NEXT: S_SETPC_B64_return $sgpr30_sgpr31, implicit $vgpr0, implicit $vgpr1
894 tracksRegLiveness: true
897 liveins: $vgpr0, $vgpr1, $sgpr30_sgpr31
898 $vgpr2 = V_MOV_B32_e32 killed $vgpr0, implicit $exec
899 $vgpr0 = V_MOV_B32_e32 killed $vgpr1, implicit $exec
900 $vgpr1 = V_MOV_B32_indirect_read killed $vgpr2, implicit $exec, implicit $m0
901 S_SETPC_B64_return $sgpr30_sgpr31, implicit $vgpr0, implicit $vgpr1
904 # GCN-LABEL: name: implicit_ops_mov_x_swap_b32
905 # GCN: $vgpr0, $vgpr1 = V_SWAP_B32 $vgpr1, $vgpr0, implicit $exec, implicit $vgpr2, implicit killed $vgpr1_vgpr2
908 name: implicit_ops_mov_x_swap_b32
909 tracksRegLiveness: true
912 liveins: $vgpr0, $vgpr1, $sgpr30_sgpr31
913 $vgpr3 = V_MOV_B32_e32 killed $vgpr0, implicit $exec
914 $vgpr0 = V_MOV_B32_e32 $vgpr1, implicit $exec, implicit $vgpr2, implicit killed $vgpr1_vgpr2
915 $vgpr1 = V_MOV_B32_e32 killed $vgpr3, implicit $exec
916 S_SETPC_B64_return $sgpr30_sgpr31, implicit $vgpr0, implicit $vgpr1
919 # GCN-LABEL: name: implict_ops_mov_x_swap_b64
920 # GCN: %2:vreg_64 = COPY %0
921 # GCN-NEXT: %0:vreg_64 = COPY %1, implicit $vgpr0
922 # GCN-NEXT: %1:vreg_64 = COPY %2
925 name: implict_ops_mov_x_swap_b64
926 tracksRegLiveness: true
930 %0:vreg_64 = IMPLICIT_DEF
931 %1:vreg_64 = IMPLICIT_DEF
933 %0:vreg_64 = COPY %1, implicit $vgpr0
937 # GCN-LABEL: implicit_ops_mov_t_swap_b32
938 # GCN: $vgpr3 = V_MOV_B32_e32 $vgpr0, implicit $exec, implicit $vgpr2, implicit killed $vgpr1_vgpr2, implicit-def $vgpr1
939 # GCN-NEXT: $vgpr0, $vgpr1 = V_SWAP_B32 $vgpr1, $vgpr0, implicit $exec
942 name: implicit_ops_mov_t_swap_b32
943 tracksRegLiveness: true
946 liveins: $vgpr0, $vgpr1, $sgpr30_sgpr31
947 $vgpr3 = V_MOV_B32_e32 killed $vgpr0, implicit $exec, implicit $vgpr2, implicit killed $vgpr1_vgpr2, implicit-def $vgpr1
948 $vgpr0 = V_MOV_B32_e32 $vgpr1, implicit $exec
949 $vgpr1 = V_MOV_B32_e32 killed $vgpr3, implicit $exec
950 S_SETPC_B64_return $sgpr30_sgpr31, implicit $vgpr0, implicit $vgpr1
953 # GCN-LABEL: implicit_ops_mov_y_swap_b32
954 # GCN: $vgpr0, $vgpr1 = V_SWAP_B32 $vgpr1, $vgpr0, implicit $exec
955 # GCN-NEXT: $vgpr0_vgpr1 = IMPLICIT_DEF
958 name: implicit_ops_mov_y_swap_b32
959 tracksRegLiveness: true
962 liveins: $vgpr0, $vgpr1, $vgpr2, $sgpr30_sgpr31
963 $vgpr3 = V_MOV_B32_e32 killed $vgpr0, implicit $exec
964 $vgpr0 = V_MOV_B32_e32 $vgpr1, implicit $exec
965 $vgpr1 = V_MOV_B32_e32 killed $vgpr3, implicit $exec, implicit $vgpr2, implicit-def $vgpr0_vgpr1, implicit killed $vgpr3
966 S_SETPC_B64_return $sgpr30_sgpr31, implicit $vgpr0, implicit $vgpr1