1# RUN: llc -march=amdgcn -run-pass si-fix-sgpr-copies %s -o - | FileCheck %s -check-prefixes=GCN
2
3---
4
5name: phi_visit_order
6tracksRegLiveness: true
7registers:
8  - { id: 0, class: sreg_32_xm0 }
9  - { id: 1, class: sreg_64 }
10  - { id: 2, class: sreg_32_xm0 }
11  - { id: 7, class: vgpr_32 }
12  - { id: 8, class: sreg_32_xm0 }
13  - { id: 9, class: vgpr_32 }
14  - { id: 10, class: sreg_64 }
15  - { id: 11, class: sreg_32_xm0 }
16
17body: |
18  ; GCN-LABEL: name: phi_visit_order
19  ; GCN: S_ADD_I32
20  bb.0:
21    liveins: $vgpr0
22    %7 = COPY $vgpr0
23    %8 = S_MOV_B32 0
24
25  bb.1:
26    %0 = PHI %8, %bb.0, %0, %bb.1, %2, %bb.2
27    %9 = V_MOV_B32_e32 9, implicit $exec
28    %10 = V_CMP_EQ_U32_e64 %7, %9, implicit $exec
29    %1 = SI_IF %10, %bb.2, implicit-def $exec, implicit-def $scc, implicit $exec
30    S_BRANCH %bb.1
31
32  bb.2:
33    SI_END_CF %1, implicit-def $exec, implicit-def $scc, implicit $exec
34    %11 = S_MOV_B32 1
35    %2 = S_ADD_I32 %0, %11, implicit-def $scc
36    S_BRANCH %bb.1
37
38...
39
40---
41
42# GCN-LABEL: name: dead_illegal_virtreg_copy
43# GCN: %0:vgpr_32 = COPY $vgpr0
44# GCN: %1:sreg_32_xm0 = IMPLICIT_DEF
45# GCN: S_ENDPGM 0, implicit %0
46
47name: dead_illegal_virtreg_copy
48tracksRegLiveness: true
49
50body: |
51  bb.0:
52    liveins: $vgpr0
53    %0:vgpr_32 = COPY $vgpr0
54    %1:sreg_32_xm0 = COPY %0
55    S_ENDPGM 0, implicit %1
56...
57
58---
59
60# GCN-LABEL: name: dead_illegal_physreg_copy
61# GCN: %2:vgpr_32 = COPY $vgpr0
62# GCN: %1:sreg_32_xm0 = IMPLICIT_DEF
63# GCN: S_ENDPGM 0, implicit %2
64
65name: dead_illegal_physreg_copy
66tracksRegLiveness: true
67
68body: |
69  bb.0:
70    liveins: $vgpr0
71    %0:sreg_32_xm0 = COPY $vgpr0
72    %1:sreg_32_xm0 = COPY %0
73    S_ENDPGM 0, implicit %1
74...
75