1 # RUN: llc -march=amdgcn -amdgpu-enable-merge-m0 -verify-machineinstrs -run-pass si-fix-sgpr-copies %s -o - | FileCheck -check-prefix=GCN %s
5 # GCN-NEXT: DS_WRITE_B32
6 # GCN-NEXT: DS_WRITE_B32
7 # GCN-NEXT: SI_INIT_M0 65536
8 # GCN-NEXT: DS_WRITE_B32
9 # GCN-NEXT: DS_WRITE_B32
10 # GCN-NEXT: SI_INIT_M0 -1
11 # GCN-NEXT: DS_WRITE_B32
12 # GCN-NEXT: SI_INIT_M0 65536
13 # GCN-NEXT: DS_WRITE_B32
17 # GCN-NEXT: DS_WRITE_B32
18 # GCN-NEXT: DS_WRITE_B32
21 # GCN: SI_INIT_M0 65536
22 # GCN-NEXT: DS_WRITE_B32
30 # GCN-NEXT: SI_INIT_M0 4
31 # GCN-NEXT: DS_WRITE_B32
36 # GCN-NEXT: SI_INIT_M0 4
37 # GCN-NEXT: DS_WRITE_B32
41 # GCN-NEXT: DS_WRITE_B32
43 # GCN-NEXT: DS_WRITE_B32
44 # GCN-NEXT: SI_INIT_M0 %2
45 # GCN-NEXT: DS_WRITE_B32
46 # GCN-NEXT: SI_INIT_M0 -1
47 # GCN-NEXT: DS_WRITE_B32
50 name: merge-m0-many-init
52 - { id: 0, class: vgpr_32 }
53 - { id: 1, class: vgpr_32 }
54 - { id: 2, class: sreg_32_xm0 }
57 successors: %bb.1, %bb.2
61 SI_INIT_M0 -1, implicit-def $m0
62 DS_WRITE_B32 %0, %1, 0, 0, implicit $m0, implicit $exec
63 SI_INIT_M0 -1, implicit-def $m0
64 DS_WRITE_B32 %0, %1, 0, 0, implicit $m0, implicit $exec
65 SI_INIT_M0 65536, implicit-def $m0
66 DS_WRITE_B32 %0, %1, 0, 0, implicit $m0, implicit $exec
67 SI_INIT_M0 65536, implicit-def $m0
68 DS_WRITE_B32 %0, %1, 0, 0, implicit $m0, implicit $exec
69 SI_INIT_M0 -1, implicit-def $m0
70 DS_WRITE_B32 %0, %1, 0, 0, implicit $m0, implicit $exec
71 SI_INIT_M0 65536, implicit-def $m0
72 DS_WRITE_B32 %0, %1, 0, 0, implicit $m0, implicit $exec
73 S_CBRANCH_VCCZ %bb.1, implicit undef $vcc
78 SI_INIT_M0 -1, implicit-def $m0
79 DS_WRITE_B32 %0, %1, 0, 0, implicit $m0, implicit $exec
80 SI_INIT_M0 -1, implicit-def $m0
81 DS_WRITE_B32 %0, %1, 0, 0, implicit $m0, implicit $exec
86 SI_INIT_M0 65536, implicit-def $m0
87 DS_WRITE_B32 %0, %1, 0, 0, implicit $m0, implicit $exec
91 successors: %bb.4, %bb.5
92 S_CBRANCH_VCCZ %bb.4, implicit undef $vcc
97 SI_INIT_M0 3, implicit-def $m0
98 DS_WRITE_B32 %0, %1, 0, 0, implicit $m0, implicit $exec
99 SI_INIT_M0 4, implicit-def $m0
100 DS_WRITE_B32 %0, %1, 0, 0, implicit $m0, implicit $exec
105 SI_INIT_M0 3, implicit-def $m0
106 DS_WRITE_B32 %0, %1, 0, 0, implicit $m0, implicit $exec
107 SI_INIT_M0 4, implicit-def $m0
108 DS_WRITE_B32 %0, %1, 0, 0, implicit $m0, implicit $exec
112 successors: %bb.0.entry, %bb.6
113 SI_INIT_M0 -1, implicit-def $m0
114 DS_WRITE_B32 %0, %1, 0, 0, implicit $m0, implicit $exec
116 SI_INIT_M0 %2, implicit-def $m0
117 DS_WRITE_B32 %0, %1, 0, 0, implicit $m0, implicit $exec
118 SI_INIT_M0 %2, implicit-def $m0
119 DS_WRITE_B32 %0, %1, 0, 0, implicit $m0, implicit $exec
120 SI_INIT_M0 -1, implicit-def $m0
121 DS_WRITE_B32 %0, %1, 0, 0, implicit $m0, implicit $exec
122 S_CBRANCH_VCCZ %bb.6, implicit undef $vcc
128 # GCN: SI_INIT_M0 65536
129 # GCN-NEXT: DS_WRITE_B32
132 #GCN-NOT: SI_INIT_M0 65536
133 #GCN-NOT: SI_INIT_M0 -1
142 name: merge-m0-dont-hoist-past-init-with-different-initializer
144 - { id: 0, class: vgpr_32 }
145 - { id: 1, class: vgpr_32 }
152 SI_INIT_M0 65536, implicit-def $m0
153 DS_WRITE_B32 %0, %1, 0, 0, implicit $m0, implicit $exec
157 successors: %bb.2, %bb.3
159 SI_INIT_M0 65536, implicit-def $m0
160 DS_WRITE_B32 %0, %1, 0, 0, implicit $m0, implicit $exec
161 S_CBRANCH_VCCZ %bb.2, implicit undef $vcc
167 SI_INIT_M0 -1, implicit-def $m0
168 DS_WRITE_B32 %0, %1, 0, 0, implicit $m0, implicit $exec
174 SI_INIT_M0 -1, implicit-def $m0
175 DS_WRITE_B32 %0, %1, 0, 0, implicit $m0, implicit $exec
183 # GCN-NOT: SI_INIT_M0
185 # GCN-NEXT: SI_INIT_M0
188 #GCN-NOT: SI_INIT_M0 -1
191 #GCN-NOT: SI_INIT_MO -1
194 name: merge-m0-after-prologue
196 - { id: 0, class: vgpr_32 }
197 - { id: 1, class: vgpr_32 }
200 successors: %bb.1, %bb.2
201 liveins: $sgpr0_sgpr1
203 $exec = S_OR_B64 $exec, killed $sgpr0_sgpr1, implicit-def $scc
206 S_CBRANCH_VCCZ %bb.1, implicit undef $vcc
212 SI_INIT_M0 -1, implicit-def $m0
213 DS_WRITE_B32 %0, %1, 0, 0, implicit $m0, implicit $exec
219 SI_INIT_M0 -1, implicit-def $m0
220 DS_WRITE_B32 %0, %1, 0, 0, implicit $m0, implicit $exec