Bump version to 19.1.0-rc3
[llvm-project.git] / llvm / test / CodeGen / AMDGPU / vmem-to-salu-hazard.mir
blob27e4d6e9d8032e4bd54a52bd9172bb5ff1522bd5
1 # RUN: llc -mtriple=amdgcn -mcpu=gfx1010 -verify-machineinstrs -run-pass post-RA-hazard-rec -o - %s | FileCheck -check-prefixes=GCN,GFX10 %s
2 # RUN: llc -mtriple=amdgcn -mcpu=gfx1100 -verify-machineinstrs -run-pass post-RA-hazard-rec -o - %s | FileCheck -check-prefixes=GCN %s
4 # GCN-LABEL: name: vmem_write_sgpr
5 # GCN:        BUFFER_LOAD_DWORD_OFFEN
6 # GFX10-NEXT: S_WAITCNT_DEPCTR 65507
7 # GCN-NEXT:   S_MOV_B32
8 ---
9 name:            vmem_write_sgpr
10 body:             |
11   bb.0:
12     $sgpr0_sgpr1_sgpr2_sgpr3 = IMPLICIT_DEF
13     $sgpr4 = IMPLICIT_DEF
14     $vgpr0 = IMPLICIT_DEF
15     $vgpr1 = BUFFER_LOAD_DWORD_OFFEN $vgpr0, $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr4, 0, 0, 0, implicit $exec
16     $sgpr0 = S_MOV_B32 0
17 ...
18 # GCN-LABEL: name: vmem_write_exec
19 # GCN:        BUFFER_STORE_DWORD_OFFEN_exact
20 # GFX10-NEXT: S_WAITCNT_DEPCTR 65507
21 # GCN-NEXT:   S_MOV_B32
22 ---
23 name:            vmem_write_exec
24 body:             |
25   bb.0:
26     $sgpr0_sgpr1_sgpr2_sgpr3 = IMPLICIT_DEF
27     $sgpr4 = IMPLICIT_DEF
28     $vgpr0 = IMPLICIT_DEF
29     $vgpr1 = IMPLICIT_DEF
30     BUFFER_STORE_DWORD_OFFEN_exact killed renamable $vgpr0, renamable $vgpr1, renamable $sgpr0_sgpr1_sgpr2_sgpr3, 0, 0, 0, 0, implicit $exec
31     $exec_lo = S_MOV_B32 -1
32 ...
33 # GCN-LABEL: name: vmem_write_sgpr_chain
34 # GCN:        BUFFER_LOAD_DWORD_OFFEN
35 # GCN-NEXT:   S_MOV_B32
36 # GCN-NEXT:   S_MOV_B32
37 # GCN-NEXT:   S_MOV_B32
38 # GCN-NEXT:   S_MOV_B32
39 # GFX10-NEXT: S_WAITCNT_DEPCTR 65507
40 # GCN-NEXT:   S_MOV_B32
41 ---
42 name:            vmem_write_sgpr_chain
43 body:             |
44   bb.0:
45     successors:
46     $sgpr0_sgpr1_sgpr2_sgpr3 = IMPLICIT_DEF
47     $sgpr4 = IMPLICIT_DEF
48     $vgpr0 = IMPLICIT_DEF
49     $vgpr1 = BUFFER_LOAD_DWORD_OFFEN $vgpr0, $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr4, 0, 0, 0, implicit $exec
50     $sgpr5 = S_MOV_B32 $sgpr0
51     $sgpr6 = S_MOV_B32 $sgpr1
52     $sgpr7 = S_MOV_B32 $sgpr2
53     $sgpr8 = S_MOV_B32 $sgpr3
54     $sgpr0 = S_MOV_B32 0
55 ...
56 # GCN-LABEL: name: vmem_smem_write_sgpr
57 # GCN:        BUFFER_LOAD_DWORD_OFFEN
58 # GFX10-NEXT: S_WAITCNT_DEPCTR 65507
59 # GCN-NEXT:   S_LOAD_DWORD_IMM
60 ---
61 name:            vmem_smem_write_sgpr
62 body:             |
63   bb.0:
64     $sgpr0_sgpr1_sgpr2_sgpr3 = IMPLICIT_DEF
65     $sgpr4 = IMPLICIT_DEF
66     $vgpr0 = IMPLICIT_DEF
67     $vgpr1 = BUFFER_LOAD_DWORD_OFFEN $vgpr0, $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr4, 0, 0, 0, implicit $exec
68     $sgpr0 = S_LOAD_DWORD_IMM $sgpr0_sgpr1, 0, 0
69 ...
70 # GCN-LABEL: name: vmem_snop_write_sgpr
71 # GCN:        BUFFER_LOAD_DWORD_OFFEN
72 # GCN-NEXT:   S_NOP
73 # GFX10-NEXT: S_WAITCNT_DEPCTR 65507
74 # GCN-NEXT:   S_MOV_B32
75 ---
76 name:            vmem_snop_write_sgpr
77 body:             |
78   bb.0:
79     $sgpr0_sgpr1_sgpr2_sgpr3 = IMPLICIT_DEF
80     $sgpr4 = IMPLICIT_DEF
81     $vgpr0 = IMPLICIT_DEF
82     $vgpr1 = BUFFER_LOAD_DWORD_OFFEN $vgpr0, $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr4, 0, 0, 0, implicit $exec
83     S_NOP 0
84     $sgpr0 = S_MOV_B32 0
85 ...
86 # GCN-LABEL: name: vmem_valu_write_sgpr
87 # GCN:      BUFFER_LOAD_DWORD_OFFEN
88 # GCN-NEXT: V_ADD_F32
89 # GCN-NEXT: S_MOV_B32
90 ---
91 name:            vmem_valu_write_sgpr
92 body:             |
93   bb.0:
94     $sgpr0_sgpr1_sgpr2_sgpr3 = IMPLICIT_DEF
95     $sgpr4 = IMPLICIT_DEF
96     $vgpr0 = IMPLICIT_DEF
97     $vgpr1 = BUFFER_LOAD_DWORD_OFFEN $vgpr0, $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr4, 0, 0, 0, implicit $exec
98     $vgpr2 = V_ADD_F32_e32 $vgpr1, $vgpr1, implicit $mode, implicit $exec
99     $sgpr0 = S_MOV_B32 0
101 # GCN-LABEL: name: vmem_swait0_write_sgpr
102 # GCN:      BUFFER_LOAD_DWORD_OFFEN
103 # GCN-NEXT: S_WAITCNT
104 # GCN-NEXT: S_MOV_B32
106 name:            vmem_swait0_write_sgpr
107 body:             |
108   bb.0:
109     $sgpr0_sgpr1_sgpr2_sgpr3 = IMPLICIT_DEF
110     $sgpr4 = IMPLICIT_DEF
111     $vgpr0 = IMPLICIT_DEF
112     $vgpr1 = BUFFER_LOAD_DWORD_OFFEN $vgpr0, $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr4, 0, 0, 0, implicit $exec
113     S_WAITCNT 0
114     $sgpr0 = S_MOV_B32 0
116 # GCN-LABEL: name: vmem_swait_any_write_sgpr
117 # GCN:        BUFFER_LOAD_DWORD_OFFEN
118 # GCN-NEXT:   S_WAITCNT
119 # GFX10-NEXT: S_WAITCNT_DEPCTR 65507
120 # GCN-NEXT:   S_MOV_B32
122 name:            vmem_swait_any_write_sgpr
123 body:             |
124   bb.0:
125     $sgpr0_sgpr1_sgpr2_sgpr3 = IMPLICIT_DEF
126     $sgpr4 = IMPLICIT_DEF
127     $vgpr0 = IMPLICIT_DEF
128     $vgpr1 = BUFFER_LOAD_DWORD_OFFEN $vgpr0, $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr4, 0, 0, 0, implicit $exec
129     S_WAITCNT 1
130     $sgpr0 = S_MOV_B32 0
132 # GCN-LABEL: name: vmem_write_exec_impread
133 # GCN:        BUFFER_LOAD_DWORD_OFFEN
134 # GFX10-NEXT: S_WAITCNT_DEPCTR 65507
135 # GCN-NEXT:   S_MOV_B64
137 name:            vmem_write_exec_impread
138 body:             |
139   bb.0:
140     $sgpr0_sgpr1_sgpr2_sgpr3 = IMPLICIT_DEF
141     $sgpr4 = IMPLICIT_DEF
142     $vgpr0 = IMPLICIT_DEF
143     $vgpr1 = BUFFER_LOAD_DWORD_OFFEN $vgpr0, $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr4, 0, 0, 0, implicit $exec
144     $exec = S_MOV_B64 7
146 # GCN-LABEL: name: vmem_write_exec_expread
147 # GCN:        BUFFER_LOAD_DWORD_OFFEN
148 # GFX10-NEXT: S_WAITCNT_DEPCTR 65507
149 # GCN-NEXT:   S_MOV_B64
151 name:            vmem_write_exec_expread
152 body:             |
153   bb.0:
154     $sgpr0_sgpr1_sgpr2_sgpr3 = IMPLICIT_DEF
155     $vgpr0 = IMPLICIT_DEF
156     $vgpr1 = BUFFER_LOAD_DWORD_OFFEN $vgpr0, $sgpr0_sgpr1_sgpr2_sgpr3, $exec_lo, 0, 0, 0, implicit $exec
157     $exec = S_MOV_B64 7
159 # GCN-LABEL: name: ds_write_m0
160 # GCN:        DS_READ_B32
161 # GFX10-NEXT: S_WAITCNT_DEPCTR 65507
162 # GCN-NEXT:   S_MOV_B32
164 name:            ds_write_m0
165 body:             |
166   bb.0:
167     $sgpr0_sgpr1_sgpr2_sgpr3 = IMPLICIT_DEF
168     $sgpr4 = IMPLICIT_DEF
169     $vgpr0 = IMPLICIT_DEF
170     $vgpr1 = DS_READ_B32 $vgpr0, 0, 0, implicit $m0, implicit $exec
171     $m0 = S_MOV_B32 7
173 # GCN-LABEL: name: vmem_write_sgpr_fall_through
174 # GCN:        BUFFER_LOAD_DWORD_OFFEN
175 # GCN:        bb.1:
176 # GFX10-NEXT: S_WAITCNT_DEPCTR 65507
177 # GCN-NEXT:   S_MOV_B32
179 name:            vmem_write_sgpr_fall_through
180 body:             |
181   bb.0:
182     successors: %bb.1
183     $sgpr0_sgpr1_sgpr2_sgpr3 = IMPLICIT_DEF
184     $sgpr4 = IMPLICIT_DEF
185     $vgpr0 = IMPLICIT_DEF
186     $vgpr1 = BUFFER_LOAD_DWORD_OFFEN $vgpr0, $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr4, 0, 0, 0, implicit $exec
188   bb.1:
189     $sgpr0 = S_MOV_B32 0
191 # GCN-LABEL: name: vmem_write_sgpr_branch
192 # GCN:        BUFFER_LOAD_DWORD_OFFEN
193 # GCN-NEXT:   S_BRANCH
194 # GCN:        bb.1:
195 # GFX10-NEXT: S_WAITCNT_DEPCTR 65507
196 # GCN-NEXT:   S_MOV_B32
198 name:            vmem_write_sgpr_branch
199 body:             |
200   bb.0:
201     successors: %bb.1
202     $sgpr0_sgpr1_sgpr2_sgpr3 = IMPLICIT_DEF
203     $sgpr4 = IMPLICIT_DEF
204     $vgpr0 = IMPLICIT_DEF
205     $vgpr1 = BUFFER_LOAD_DWORD_OFFEN $vgpr0, $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr4, 0, 0, 0, implicit $exec
206     S_BRANCH %bb.1
208   bb.1:
209     $sgpr0 = S_MOV_B32 0
211 # GCN-LABEL: name: vmem_write_sgpr_branch_around
212 # GCN:        BUFFER_LOAD_DWORD_OFFEN
213 # GCN-NEXT:   S_BRANCH
214 # GCN:        bb.2:
215 # GFX10-NEXT: S_WAITCNT_DEPCTR 65507
216 # GCN-NEXT:   S_MOV_B32
218 name:            vmem_write_sgpr_branch_around
219 body:             |
220   bb.0:
221     successors: %bb.2
222     $sgpr0_sgpr1_sgpr2_sgpr3 = IMPLICIT_DEF
223     $sgpr4 = IMPLICIT_DEF
224     $vgpr0 = IMPLICIT_DEF
225     $vgpr1 = BUFFER_LOAD_DWORD_OFFEN $vgpr0, $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr4, 0, 0, 0, implicit $exec
226     S_BRANCH %bb.2
228   bb.1:
229     successors: %bb.2
230     S_WAITCNT 0
232   bb.2:
233     $sgpr0 = S_MOV_B32 0
235 # GCN-LABEL: name: vmem_write_sgpr_cbranch_around
236 # GCN:        BUFFER_LOAD_DWORD_OFFEN
237 # GCN-NEXT:   S_CBRANCH
238 # GCN-NEXT:   S_BRANCH
239 # GCN:        bb.1:
240 # GCN:        S_WAITCNT
241 # GCN:        V_ADD_CO_U32
242 # GCN:        bb.2:
243 # GFX10-NEXT: S_WAITCNT_DEPCTR 65507
244 # GCN-NEXT:   S_MOV_B32
246 name:            vmem_write_sgpr_cbranch_around
247 body:             |
248   bb.0:
249     successors: %bb.1, %bb.2
250     $sgpr0_sgpr1_sgpr2_sgpr3 = IMPLICIT_DEF
251     $sgpr4 = IMPLICIT_DEF
252     $vgpr0 = IMPLICIT_DEF
253     $vgpr1 = BUFFER_LOAD_DWORD_OFFEN $vgpr0, $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr4, 0, 0, 0, implicit $exec
254     S_CBRANCH_SCC0 %bb.2, implicit $scc
255     S_BRANCH %bb.1
257   bb.1:
258     successors: %bb.2
259     S_WAITCNT 0
260     $vgpr2, $vcc_lo = V_ADD_CO_U32_e64 $vgpr1, $vgpr1, 0, implicit $exec
261     S_BRANCH %bb.2
263   bb.2:
264     $sgpr0 = S_MOV_B32 0
266 # GCN-LABEL: name: vmem_write_sgpr_branch_backedge
267 # GCN:        $vgpr0 = IMPLICIT_DEF
268 # GFX10-NEXT: S_WAITCNT_DEPCTR 65507
269 # GCN-NEXT:   S_MOV_B32
271 name:            vmem_write_sgpr_branch_backedge
272 body:             |
273   bb.0:
274     successors: %bb.1
275     $sgpr0_sgpr1_sgpr2_sgpr3 = IMPLICIT_DEF
276     $sgpr4 = IMPLICIT_DEF
277     $vgpr0 = IMPLICIT_DEF
278     $sgpr0 = S_MOV_B32 0
280   bb.1:
281     $vgpr1 = BUFFER_LOAD_DWORD_OFFEN $vgpr0, $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr4, 0, 0, 0, implicit $exec
282     S_BRANCH %bb.0
284 # GCN-LABEL: name: ds_write_exec
285 # GCN:        DS_WRITE_B32_gfx9
286 # GFX10-NEXT: S_WAITCNT_DEPCTR 65507
287 # GCN-NEXT:   S_MOV_B32
289 name:            ds_write_exec
290 body:             |
291   bb.0:
292     $vgpr0 = IMPLICIT_DEF
293     $vgpr1 = IMPLICIT_DEF
294     DS_WRITE_B32_gfx9 $vgpr0, $vgpr1, 0, 0, implicit $exec
295     $exec_lo = S_MOV_B32 -1
297 # GCN-LABEL: name: vmem_scratch_exec
298 # GCN:        SCRATCH_LOAD_DWORD
299 # GFX10-NEXT: S_WAITCNT_DEPCTR 65507
300 # GCN-NEXT:   S_MOV_B32
302 name:            vmem_scratch_exec
303 body:             |
304   bb.0:
305     $vgpr0 = IMPLICIT_DEF
306     $vgpr1 = SCRATCH_LOAD_DWORD undef $vgpr0, 0, 0, implicit $exec, implicit $flat_scr
307     $exec_lo = S_MOV_B32 -1
309 # GCN-LABEL: name: vmem_flat_exec
310 # GCN:        FLAT_LOAD_DWORD
311 # GFX10-NEXT: S_WAITCNT_DEPCTR 65507
312 # GCN-NEXT:   S_MOV_B32
314 name:            vmem_flat_exec
315 body:             |
316   bb.0:
317     $vgpr0 = IMPLICIT_DEF
318     $vgpr1 = IMPLICIT_DEF
319     $vgpr2 = FLAT_LOAD_DWORD $vgpr0_vgpr1, 0, 0, implicit $exec, implicit $flat_scr
320     $exec_lo = S_MOV_B32 -1
322 # GCN-LABEL: name: vmem_global_exec
323 # GCN:        GLOBAL_LOAD_DWORD
324 # GFX10-NEXT: S_WAITCNT_DEPCTR 65507
325 # GCN-NEXT:   S_MOV_B32
327 name:            vmem_global_exec
328 body:             |
329   bb.0:
330     $vgpr0 = IMPLICIT_DEF
331     $vgpr1 = IMPLICIT_DEF
332     $vgpr2 = GLOBAL_LOAD_DWORD $vgpr0_vgpr1, 0, 0, implicit $exec
333     $exec_lo = S_MOV_B32 -1
335 # GCN-LABEL: name: vmem_global_atomic_exec
336 # GCN:        GLOBAL_ATOMIC_ADD_RTN
337 # GFX10-NEXT: S_WAITCNT_DEPCTR 65507
338 # GCN-NEXT:   S_MOV_B32
340 name:            vmem_global_atomic_exec
341 body:             |
342   bb.0:
343     $vgpr0 = IMPLICIT_DEF
344     $vgpr1 = IMPLICIT_DEF
345     $vgpr2 = IMPLICIT_DEF
346     $vgpr3 = GLOBAL_ATOMIC_ADD_RTN $vgpr0_vgpr1, $vgpr2, 0, 1, implicit $exec :: (load store syncscope("agent") seq_cst (s32), addrspace 1)
347     $exec_lo = S_MOV_B32 -1