Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / llvm / test / CodeGen / AMDGPU / lds-branch-vmem-hazard.mir
blob7cb311f3bd70d752c5033ae51182a73dd7a0fa6d
1 # RUN: llc -march=amdgcn -mcpu=gfx1010 -verify-machineinstrs -run-pass post-RA-hazard-rec -o - %s | FileCheck -check-prefixes=GCN,GFX10 %s
2 # RUN: llc -march=amdgcn -mcpu=gfx1100 -verify-machineinstrs -run-pass post-RA-hazard-rec -o - %s | FileCheck -check-prefixes=GCN %s
4 # GCN-LABEL: name: hazard_lds_branch_buf
5 # GCN:        bb.1:
6 # GFX10-NEXT: S_WAITCNT_VSCNT undef $sgpr_null, 0
7 # GCN-NEXT:   BUFFER_LOAD_DWORD_OFFEN
8 ---
9 name:            hazard_lds_branch_buf
10 body:            |
11   bb.0:
12     successors: %bb.1
13     $vgpr1 = DS_READ_B32 undef $vgpr0, 0, 0, implicit $m0, implicit $exec
14     S_BRANCH %bb.1
16   bb.1:
17     $vgpr1 = BUFFER_LOAD_DWORD_OFFEN undef $vgpr0, undef $sgpr0_sgpr1_sgpr2_sgpr3, undef $sgpr4, 0, 0, 0, implicit $exec
18     S_ENDPGM 0
19 ...
21 # GCN-LABEL: name: hazard_buf_branch_lds
22 # GCN:        bb.1:
23 # GFX10-NEXT: S_WAITCNT_VSCNT undef $sgpr_null, 0
24 # GCN-NEXT:   DS_READ_B32
25 ---
26 name:            hazard_buf_branch_lds
27 body:            |
28   bb.0:
29     successors: %bb.1
30     $vgpr1 = BUFFER_LOAD_DWORD_OFFEN undef $vgpr0, undef $sgpr0_sgpr1_sgpr2_sgpr3, undef $sgpr4, 0, 0, 0, implicit $exec
31     S_BRANCH %bb.1
33   bb.1:
34     $vgpr1 = DS_READ_B32 undef $vgpr0, 0, 0, implicit $m0, implicit $exec
35     S_ENDPGM 0
36 ...
38 # GCN-LABEL: name: no_hazard_lds_branch_lds
39 # GCN:       bb.1:
40 # GCN-NEXT:  DS_READ_B32
41 ---
42 name:            no_hazard_lds_branch_lds
43 body:            |
44   bb.0:
45     successors: %bb.1
46     $vgpr1 = DS_READ_B32 undef $vgpr0, 0, 0, implicit $m0, implicit $exec
47     S_BRANCH %bb.1
49   bb.1:
50     $vgpr1 = DS_READ_B32 undef $vgpr0, 0, 0, implicit $m0, implicit $exec
51     S_ENDPGM 0
52 ...
54 # GCN-LABEL: name: no_hazard_buf_branch_buf
55 # GCN:      bb.1:
56 # GCN-NEXT: BUFFER_LOAD_DWORD_OFFEN
57 ---
58 name:            no_hazard_buf_branch_buf
59 body:            |
60   bb.0:
61     successors: %bb.1
62     $vgpr1 = BUFFER_LOAD_DWORD_OFFEN undef $vgpr0, undef $sgpr0_sgpr1_sgpr2_sgpr3, undef $sgpr4, 0, 0, 0, implicit $exec
63     S_BRANCH %bb.1
65   bb.1:
66     $vgpr1 = BUFFER_LOAD_DWORD_OFFEN undef $vgpr0, undef $sgpr0_sgpr1_sgpr2_sgpr3, undef $sgpr4, 0, 0, 0, implicit $exec
67     S_ENDPGM 0
68 ...
70 # GCN-LABEL: name: no_hazard_lds_branch_buf_fallthrough
71 # GCN:      bb.1:
72 # GCN-NEXT: BUFFER_LOAD_DWORD_OFFEN
73 ---
74 name:            no_hazard_lds_branch_buf_fallthrough
75 body:            |
76   bb.0:
77     successors: %bb.1
78     $vgpr1 = DS_READ_B32 undef $vgpr0, 0, 0, implicit $m0, implicit $exec
80   bb.1:
81     $vgpr1 = BUFFER_LOAD_DWORD_OFFEN undef $vgpr0, undef $sgpr0_sgpr1_sgpr2_sgpr3, undef $sgpr4, 0, 0, 0, implicit $exec
82     S_ENDPGM 0
83 ...
85 # GCN-LABEL: name: no_hazard_lds_branch_buf_samebb
86 # GCN:      DS_READ_B32
87 # GCN-NEXT: BUFFER_LOAD_DWORD_OFFEN
88 ---
89 name:            no_hazard_lds_branch_buf_samebb
90 body:            |
91   bb.0:
92     $vgpr1 = DS_READ_B32 undef $vgpr0, 0, 0, implicit $m0, implicit $exec
93     $vgpr1 = BUFFER_LOAD_DWORD_OFFEN undef $vgpr0, undef $sgpr0_sgpr1_sgpr2_sgpr3, undef $sgpr4, 0, 0, 0, implicit $exec
94     S_ENDPGM 0
95 ...
97 # GCN-LABEL: name: hazard_lds_branch_buf_loop
98 # GFX10:    S_WAITCNT_VSCNT undef $sgpr_null, 0
99 # GCN:      DS_READ_B32
100 # GCN-NEXT: BUFFER_LOAD_DWORD_OFFEN
102 name:            hazard_lds_branch_buf_loop
103 body:            |
104   bb.0:
105     successors: %bb.0
106     $vgpr1 = DS_READ_B32 undef $vgpr0, 0, 0, implicit $m0, implicit $exec
107     $vgpr1 = BUFFER_LOAD_DWORD_OFFEN undef $vgpr0, undef $sgpr0_sgpr1_sgpr2_sgpr3, undef $sgpr4, 0, 0, 0, implicit $exec
108     S_BRANCH %bb.0
111 # GCN-LABEL: name: single_hazard_lds_branch_buf
112 # GCN:        bb.1:
113 # GFX10-NEXT: S_WAITCNT_VSCNT undef $sgpr_null, 0
114 # GCN-NEXT:   BUFFER_LOAD_DWORD_OFFEN
115 # GCN-NEXT:   BUFFER_LOAD_DWORD_OFFEN
117 name:            single_hazard_lds_branch_buf
118 body:            |
119   bb.0:
120     successors: %bb.1
121     $vgpr1 = DS_READ_B32 undef $vgpr0, 0, 0, implicit $m0, implicit $exec
122     S_BRANCH %bb.1
124   bb.1:
125     $vgpr1 = BUFFER_LOAD_DWORD_OFFEN undef $vgpr0, undef $sgpr0_sgpr1_sgpr2_sgpr3, undef $sgpr4, 0, 0, 0, implicit $exec
126     $vgpr1 = BUFFER_LOAD_DWORD_OFFEN undef $vgpr0, undef $sgpr0_sgpr1_sgpr2_sgpr3, undef $sgpr4, 0, 0, 0, implicit $exec
127     S_ENDPGM 0
130 # GCN-LABEL: name: no_hazard_lds_branch_lds_buf
131 # GCN:      bb.1:
132 # GCN-NEXT: DS_READ_B32
133 # GCN-NEXT: BUFFER_LOAD_DWORD_OFFEN
135 name:            no_hazard_lds_branch_lds_buf
136 body:            |
137   bb.0:
138     successors: %bb.1
139     $vgpr1 = DS_READ_B32 undef $vgpr0, 0, 0, implicit $m0, implicit $exec
140     S_BRANCH %bb.1
142   bb.1:
143     $vgpr1 = DS_READ_B32 undef $vgpr0, 0, 0, implicit $m0, implicit $exec
144     $vgpr1 = BUFFER_LOAD_DWORD_OFFEN undef $vgpr0, undef $sgpr0_sgpr1_sgpr2_sgpr3, undef $sgpr4, 0, 0, 0, implicit $exec
145     S_ENDPGM 0
148 # GCN-LABEL: name: no_hazard_lds_buf_branch_buf
149 # GCN:      bb.1:
150 # GCN-NEXT: BUFFER_LOAD_DWORD_OFFEN
152 name:            no_hazard_lds_buf_branch_buf
153 body:            |
154   bb.0:
155     successors: %bb.1
156     $vgpr1 = DS_READ_B32 undef $vgpr0, 0, 0, implicit $m0, implicit $exec
157     $vgpr1 = BUFFER_LOAD_DWORD_OFFEN undef $vgpr0, undef $sgpr0_sgpr1_sgpr2_sgpr3, undef $sgpr4, 0, 0, 0, implicit $exec
158     S_BRANCH %bb.1
160   bb.1:
161     $vgpr1 = BUFFER_LOAD_DWORD_OFFEN undef $vgpr0, undef $sgpr0_sgpr1_sgpr2_sgpr3, undef $sgpr4, 0, 0, 0, implicit $exec
162     S_ENDPGM 0
165 # GCN-LABEL: name: hazard_lds_branch_vscnt_1_buf
166 # GCN:        bb.1:
167 # GCN-NEXT:   S_WAITCNT_VSCNT undef $sgpr_null, 1
168 # GFX10-NEXT: S_WAITCNT_VSCNT undef $sgpr_null, 0
169 # GCN-NEXT:   BUFFER_LOAD_DWORD_OFFEN
171 name:            hazard_lds_branch_vscnt_1_buf
172 body:            |
173   bb.0:
174     successors: %bb.1
175     $vgpr1 = DS_READ_B32 undef $vgpr0, 0, 0, implicit $m0, implicit $exec
176     S_BRANCH %bb.1
178   bb.1:
179     S_WAITCNT_VSCNT undef $sgpr_null, 1
180     $vgpr1 = BUFFER_LOAD_DWORD_OFFEN undef $vgpr0, undef $sgpr0_sgpr1_sgpr2_sgpr3, undef $sgpr4, 0, 0, 0, implicit $exec
181     S_ENDPGM 0
184 # GCN-LABEL: name: no_hazard_lds_branch_vscnt_0_buf
185 # GCN:      bb.1:
186 # GCN-NEXT: S_WAITCNT_VSCNT undef $sgpr_null, 0
187 # GCN-NEXT: BUFFER_LOAD_DWORD_OFFEN
189 name:            no_hazard_lds_branch_vscnt_0_buf
190 body:            |
191   bb.0:
192     successors: %bb.1
193     $vgpr1 = DS_READ_B32 undef $vgpr0, 0, 0, implicit $m0, implicit $exec
194     S_BRANCH %bb.1
196   bb.1:
197     S_WAITCNT_VSCNT undef $sgpr_null, 0
198     $vgpr1 = BUFFER_LOAD_DWORD_OFFEN undef $vgpr0, undef $sgpr0_sgpr1_sgpr2_sgpr3, undef $sgpr4, 0, 0, 0, implicit $exec
199     S_ENDPGM 0
202 # GCN-LABEL: name: hazard_lds_branch_vscnt_s0_buf
203 # GCN:        bb.1:
204 # GCN-NEXT:   S_WAITCNT_VSCNT undef $sgpr0, 0
205 # GFX10-NEXT: S_WAITCNT_VSCNT undef $sgpr_null, 0
206 # GCN-NEXT:   BUFFER_LOAD_DWORD_OFFEN
208 name:            hazard_lds_branch_vscnt_s0_buf
209 body:            |
210   bb.0:
211     successors: %bb.1
212     $vgpr1 = DS_READ_B32 undef $vgpr0, 0, 0, implicit $m0, implicit $exec
213     S_BRANCH %bb.1
215   bb.1:
216     S_WAITCNT_VSCNT undef $sgpr0, 0
217     $vgpr1 = BUFFER_LOAD_DWORD_OFFEN undef $vgpr0, undef $sgpr0_sgpr1_sgpr2_sgpr3, undef $sgpr4, 0, 0, 0, implicit $exec
218     S_ENDPGM 0
221 # GCN-LABEL: name: no_hazard_lds_vscnt_0_branch_buf
222 # GCN:      bb.1:
223 # GCN-NEXT: BUFFER_LOAD_DWORD_OFFEN
225 name:            no_hazard_lds_vscnt_0_branch_buf
226 body:            |
227   bb.0:
228     successors: %bb.1
229     $vgpr1 = DS_READ_B32 undef $vgpr0, 0, 0, implicit $m0, implicit $exec
230     S_WAITCNT_VSCNT undef $sgpr_null, 0
231     S_BRANCH %bb.1
233   bb.1:
234     $vgpr1 = BUFFER_LOAD_DWORD_OFFEN undef $vgpr0, undef $sgpr0_sgpr1_sgpr2_sgpr3, undef $sgpr4, 0, 0, 0, implicit $exec
235     S_ENDPGM 0
238 # GCN-LABEL: name: hazard_lds_branch_global
239 # GCN:        bb.1:
240 # GFX10-NEXT: S_WAITCNT_VSCNT undef $sgpr_null, 0
241 # GCN-NEXT:   GLOBAL_LOAD_DWORD
243 name:            hazard_lds_branch_global
244 body:            |
245   bb.0:
246     successors: %bb.1
247     $vgpr1 = DS_READ_B32 undef $vgpr0, 0, 0, implicit $m0, implicit $exec
248     S_BRANCH %bb.1
250   bb.1:
251     $vgpr1 = GLOBAL_LOAD_DWORD undef $vgpr0_vgpr1, 0, 0, implicit $exec
252     S_ENDPGM 0
255 # GCN-LABEL: name: hazard_lds_branch_scratch
256 # GCN:        bb.1:
257 # GFX10-NEXT: S_WAITCNT_VSCNT undef $sgpr_null, 0
258 # GCN-NEXT:   SCRATCH_LOAD_DWORD
260 name:            hazard_lds_branch_scratch
261 body:            |
262   bb.0:
263     successors: %bb.1
264     $vgpr1 = DS_READ_B32 undef $vgpr0, 0, 0, implicit $m0, implicit $exec
265     S_BRANCH %bb.1
267   bb.1:
268     $vgpr1 = SCRATCH_LOAD_DWORD undef $vgpr0, 0, 0, implicit $exec, implicit $flat_scr
269     S_ENDPGM 0
272 # GCN-LABEL: name: no_hazard_lds_branch_flat
273 # GCN:      bb.1:
274 # GCN-NEXT: FLAT_LOAD_DWORD
276 name:            no_hazard_lds_branch_flat
277 body:            |
278   bb.0:
279     successors: %bb.1
280     $vgpr1 = DS_READ_B32 undef $vgpr0, 0, 0, implicit $m0, implicit $exec
281     S_BRANCH %bb.1
283   bb.1:
284     $vgpr1 = FLAT_LOAD_DWORD undef $vgpr0_vgpr1, 0, 0, implicit $exec, implicit $flat_scr
285     S_ENDPGM 0