1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -march=amdgcn -mcpu=gfx1100 -mattr=+wavefrontsize64 -verify-machineinstrs -run-pass post-RA-hazard-rec -o - %s | FileCheck -check-prefix=GCN %s
5 @mem = internal unnamed_addr addrspace(4) constant [4 x <4 x i32>] [<4 x i32> <i32 0, i32 0, i32 0, i32 0>, <4 x i32> <i32 0, i32 0, i32 0, i32 0>, <4 x i32> <i32 0, i32 0, i32 0, i32 0>, <4 x i32> <i32 0, i32 0, i32 0, i32 0>]
7 define amdgpu_gs void @mask_hazard_getpc1() { ret void }
8 define amdgpu_gs void @mask_hazard_getpc2() { ret void }
9 define amdgpu_gs void @mask_hazard_vcc1() { ret void }
10 define amdgpu_gs void @mask_hazard_vcc2() { ret void }
11 define amdgpu_gs void @mask_hazard_cndmask_dpp1() { ret void }
12 define amdgpu_gs void @mask_hazard_cndmask_dpp2() { ret void }
13 define amdgpu_gs void @mask_hazard_cndmask_dpp3() { ret void }
14 define amdgpu_gs void @mask_hazard_cndmask_dpp4() { ret void }
15 define amdgpu_gs void @mask_hazard_addc1() { ret void }
16 define amdgpu_gs void @mask_hazard_addc2() { ret void }
17 define amdgpu_gs void @mask_hazard_addc3() { ret void }
18 define amdgpu_gs void @mask_hazard_addc4() { ret void }
19 define amdgpu_gs void @mask_hazard_subb1() { ret void }
20 define amdgpu_gs void @mask_hazard_subb2() { ret void }
21 define amdgpu_gs void @mask_hazard_subb3() { ret void }
22 define amdgpu_gs void @mask_hazard_subb4() { ret void }
23 define amdgpu_gs void @mask_hazard_subbrev1() { ret void }
24 define amdgpu_gs void @mask_hazard_subbrev2() { ret void }
25 define amdgpu_gs void @mask_hazard_subbrev3() { ret void }
26 define amdgpu_gs void @mask_hazard_subbrev4() { ret void }
27 define amdgpu_gs void @mask_hazard_div_fmas_f32() { ret void }
28 define amdgpu_gs void @mask_hazard_div_fmas_f64() { ret void }
29 define amdgpu_gs void @mask_hazard_subreg1() { ret void }
30 define amdgpu_gs void @mask_hazard_subreg2() { ret void }
31 define amdgpu_gs void @mask_hazard_subreg3() { ret void }
32 define amdgpu_gs void @mask_hazard_subreg4() { ret void }
33 define amdgpu_gs void @mask_hazard_subreg5() { ret void }
34 define amdgpu_gs void @mask_hazard_waitcnt() { ret void }
35 define amdgpu_gs void @mask_hazard_gap1() { ret void }
36 define amdgpu_gs void @mask_hazard_gap2() { ret void }
37 define amdgpu_gs void @mask_hazard_gap3() { ret void }
38 define amdgpu_gs void @mask_hazard_no_hazard1() { ret void }
39 define amdgpu_gs void @mask_hazard_no_hazard2() { ret void }
40 define amdgpu_gs void @mask_hazard_no_hazard3() { ret void }
44 name: mask_hazard_getpc1
47 ; GCN-LABEL: name: mask_hazard_getpc1
48 ; GCN: $vgpr1 = V_CNDMASK_B32_e64 0, $vgpr1, 0, $vgpr2, $sgpr0_sgpr1, implicit $exec
49 ; GCN-NEXT: $sgpr0_sgpr1 = S_GETPC_B64
50 ; GCN-NEXT: S_WAITCNT_DEPCTR 65534
51 ; GCN-NEXT: $sgpr0 = S_ADD_U32 $sgpr0, 0, implicit-def $scc
52 ; GCN-NEXT: S_ENDPGM 0
53 $vgpr1 = V_CNDMASK_B32_e64 0, $vgpr1, 0, $vgpr2, $sgpr0_sgpr1, implicit $exec
54 $sgpr0_sgpr1 = S_GETPC_B64
55 $sgpr0 = S_ADD_U32 $sgpr0, 0, implicit-def $scc
60 name: mask_hazard_getpc2
63 ; GCN-LABEL: name: mask_hazard_getpc2
64 ; GCN: $vgpr1 = V_CNDMASK_B32_e64 0, $vgpr1, 0, $vgpr2, $sgpr0_sgpr1, implicit $exec
65 ; GCN-NEXT: BUNDLE implicit-def $sgpr0_sgpr1 {
66 ; GCN-NEXT: $sgpr0_sgpr1 = S_GETPC_B64
67 ; GCN-NEXT: S_WAITCNT_DEPCTR 65534
68 ; GCN-NEXT: $sgpr0 = S_ADD_U32 $sgpr0, target-flags(amdgpu-rel32-lo) @mem + 8, implicit-def $scc
69 ; GCN-NEXT: $sgpr1 = S_ADDC_U32 $sgpr1, target-flags(amdgpu-rel32-lo) @mem + 16, implicit-def $scc, implicit $scc
71 ; GCN-NEXT: S_ENDPGM 0
72 $vgpr1 = V_CNDMASK_B32_e64 0, $vgpr1, 0, $vgpr2, $sgpr0_sgpr1, implicit $exec
73 BUNDLE implicit-def $sgpr0_sgpr1 {
74 $sgpr0_sgpr1 = S_GETPC_B64
75 $sgpr0 = S_ADD_U32 $sgpr0, target-flags(amdgpu-rel32-lo) @mem + 4, implicit-def $scc
76 $sgpr1 = S_ADDC_U32 $sgpr1, target-flags(amdgpu-rel32-lo) @mem + 12, implicit-def $scc, implicit $scc
82 name: mask_hazard_vcc1
85 ; GCN-LABEL: name: mask_hazard_vcc1
86 ; GCN: $vgpr1 = V_CNDMASK_B32_e64 0, $vgpr1, 0, $vgpr2, $sgpr2_sgpr3, implicit $exec
87 ; GCN-NEXT: $sgpr2_sgpr3 = S_CSELECT_B64 -1, 0, implicit $scc
88 ; GCN-NEXT: S_WAITCNT_DEPCTR 65534
89 ; GCN-NEXT: S_ENDPGM 0
90 $vgpr1 = V_CNDMASK_B32_e64 0, $vgpr1, 0, $vgpr2, $sgpr2_sgpr3, implicit $exec
91 $sgpr2_sgpr3 = S_CSELECT_B64 -1, 0, implicit $scc
96 name: mask_hazard_vcc2
99 ; GCN-LABEL: name: mask_hazard_vcc2
100 ; GCN: $vgpr1 = V_CNDMASK_B32_e32 $vgpr1, $vgpr2, implicit $vcc, implicit $exec
101 ; GCN-NEXT: $vcc = S_CSELECT_B64 -1, 0, implicit $scc
102 ; GCN-NEXT: S_WAITCNT_DEPCTR 65534
103 ; GCN-NEXT: S_ENDPGM 0
104 $vgpr1 = V_CNDMASK_B32_e32 $vgpr1, $vgpr2, implicit $vcc, implicit $exec
105 $vcc = S_CSELECT_B64 -1, 0, implicit $scc
110 name: mask_hazard_cndmask_dpp1
113 ; GCN-LABEL: name: mask_hazard_cndmask_dpp1
114 ; GCN: $vgpr0 = V_CNDMASK_B32_dpp $vgpr0, 0, $vgpr1, 0, $vgpr2, 1, 15, 15, 1, implicit $vcc, implicit $exec
115 ; GCN-NEXT: $vcc = S_CSELECT_B64 -1, 0, implicit $scc
116 ; GCN-NEXT: S_WAITCNT_DEPCTR 65534
117 ; GCN-NEXT: S_ENDPGM 0
118 $vgpr0 = V_CNDMASK_B32_dpp $vgpr0, 0, $vgpr1, 0, $vgpr2, 1, 15, 15, 1, implicit $vcc, implicit $exec
119 $vcc = S_CSELECT_B64 -1, 0, implicit $scc
124 name: mask_hazard_cndmask_dpp2
127 ; GCN-LABEL: name: mask_hazard_cndmask_dpp2
128 ; GCN: $vgpr0 = V_CNDMASK_B32_e64_dpp $vgpr0, 0, $vgpr1, 0, $vgpr2, $sgpr2_sgpr3, 1, 15, 15, 1, implicit $exec
129 ; GCN-NEXT: $sgpr2_sgpr3 = S_CSELECT_B64 -1, 0, implicit $scc
130 ; GCN-NEXT: S_WAITCNT_DEPCTR 65534
131 ; GCN-NEXT: S_ENDPGM 0
132 $vgpr0 = V_CNDMASK_B32_e64_dpp $vgpr0, 0, $vgpr1, 0, $vgpr2, $sgpr2_sgpr3, 1, 15, 15, 1, implicit $exec
133 $sgpr2_sgpr3 = S_CSELECT_B64 -1, 0, implicit $scc
138 name: mask_hazard_cndmask_dpp4
141 ; GCN-LABEL: name: mask_hazard_cndmask_dpp4
142 ; GCN: $vgpr0 = V_CNDMASK_B16_e64_dpp $vgpr0, 0, $vgpr1, 0, $vgpr2, $sgpr2_sgpr3, 1, 15, 15, 1, implicit $exec
143 ; GCN-NEXT: $sgpr2_sgpr3 = S_CSELECT_B64 -1, 0, implicit $scc
144 ; GCN-NEXT: S_WAITCNT_DEPCTR 65534
145 ; GCN-NEXT: S_ENDPGM 0
146 $vgpr0 = V_CNDMASK_B16_e64_dpp $vgpr0, 0, $vgpr1, 0, $vgpr2, $sgpr2_sgpr3, 1, 15, 15, 1, implicit $exec
147 $sgpr2_sgpr3 = S_CSELECT_B64 -1, 0, implicit $scc
152 name: mask_hazard_addc1
155 ; GCN-LABEL: name: mask_hazard_addc1
156 ; GCN: $vgpr1, $vcc = V_ADDC_U32_e64 0, $vgpr1, $sgpr2_sgpr3, 0, implicit $exec
157 ; GCN-NEXT: $sgpr2_sgpr3 = S_CSELECT_B64 -1, 0, implicit $scc
158 ; GCN-NEXT: S_WAITCNT_DEPCTR 65534
159 ; GCN-NEXT: S_ENDPGM 0
160 $vgpr1, $vcc = V_ADDC_U32_e64 0, $vgpr1, $sgpr2_sgpr3, 0, implicit $exec
161 $sgpr2_sgpr3 = S_CSELECT_B64 -1, 0, implicit $scc
166 name: mask_hazard_addc2
169 ; GCN-LABEL: name: mask_hazard_addc2
170 ; GCN: $vgpr1 = V_ADDC_U32_e32 0, $vgpr1, implicit-def $vcc, implicit $vcc, implicit $exec
171 ; GCN-NEXT: $vcc = S_CSELECT_B64 -1, 0, implicit $scc
172 ; GCN-NEXT: S_WAITCNT_DEPCTR 65534
173 ; GCN-NEXT: S_ENDPGM 0
174 $vgpr1 = V_ADDC_U32_e32 0, $vgpr1, implicit-def $vcc, implicit $vcc, implicit $exec
175 $vcc = S_CSELECT_B64 -1, 0, implicit $scc
180 name: mask_hazard_addc3
183 ; GCN-LABEL: name: mask_hazard_addc3
184 ; GCN: $vgpr0 = V_ADDC_U32_dpp $vgpr0, $vgpr1, $vgpr2, 1, 15, 15, 1, implicit-def $vcc, implicit $vcc, implicit $exec
185 ; GCN-NEXT: $vcc = S_CSELECT_B64 -1, 0, implicit $scc
186 ; GCN-NEXT: S_WAITCNT_DEPCTR 65534
187 ; GCN-NEXT: S_ENDPGM 0
188 $vgpr0 = V_ADDC_U32_dpp $vgpr0, $vgpr1, $vgpr2, 1, 15, 15, 1, implicit-def $vcc, implicit $vcc, implicit $exec
189 $vcc = S_CSELECT_B64 -1, 0, implicit $scc
194 name: mask_hazard_addc4
197 ; GCN-LABEL: name: mask_hazard_addc4
198 ; GCN: $vgpr0, $sgpr2_sgpr3 = V_ADDC_U32_e64_dpp $vgpr0, $vgpr1, $vgpr2, $sgpr2_sgpr3, 0, 1, 15, 15, 1, implicit $exec
199 ; GCN-NEXT: $sgpr2_sgpr3 = S_CSELECT_B64 -1, 0, implicit $scc
200 ; GCN-NEXT: S_WAITCNT_DEPCTR 65534
201 ; GCN-NEXT: S_ENDPGM 0
202 $vgpr0, $sgpr2_sgpr3 = V_ADDC_U32_e64_dpp $vgpr0, $vgpr1, $vgpr2, $sgpr2_sgpr3, 0, 1, 15, 15, 1, implicit $exec
203 $sgpr2_sgpr3 = S_CSELECT_B64 -1, 0, implicit $scc
208 name: mask_hazard_subb1
211 ; GCN-LABEL: name: mask_hazard_subb1
212 ; GCN: $vgpr1, $vcc = V_SUBB_U32_e64 0, $vgpr1, $sgpr2_sgpr3, 0, implicit $exec
213 ; GCN-NEXT: $sgpr2_sgpr3 = S_CSELECT_B64 -1, 0, implicit $scc
214 ; GCN-NEXT: S_WAITCNT_DEPCTR 65534
215 ; GCN-NEXT: S_ENDPGM 0
216 $vgpr1, $vcc = V_SUBB_U32_e64 0, $vgpr1, $sgpr2_sgpr3, 0, implicit $exec
217 $sgpr2_sgpr3 = S_CSELECT_B64 -1, 0, implicit $scc
222 name: mask_hazard_subb2
225 ; GCN-LABEL: name: mask_hazard_subb2
226 ; GCN: $vgpr1 = V_SUBB_U32_e32 0, $vgpr1, implicit-def $vcc, implicit $vcc, implicit $exec
227 ; GCN-NEXT: $vcc = S_CSELECT_B64 -1, 0, implicit $scc
228 ; GCN-NEXT: S_WAITCNT_DEPCTR 65534
229 ; GCN-NEXT: S_ENDPGM 0
230 $vgpr1 = V_SUBB_U32_e32 0, $vgpr1, implicit-def $vcc, implicit $vcc, implicit $exec
231 $vcc = S_CSELECT_B64 -1, 0, implicit $scc
236 name: mask_hazard_subb3
239 ; GCN-LABEL: name: mask_hazard_subb3
240 ; GCN: $vgpr0 = V_SUBB_U32_dpp $vgpr0, $vgpr1, $vgpr2, 1, 15, 15, 1, implicit-def $vcc, implicit $vcc, implicit $exec
241 ; GCN-NEXT: $vcc = S_CSELECT_B64 -1, 0, implicit $scc
242 ; GCN-NEXT: S_WAITCNT_DEPCTR 65534
243 ; GCN-NEXT: S_ENDPGM 0
244 $vgpr0 = V_SUBB_U32_dpp $vgpr0, $vgpr1, $vgpr2, 1, 15, 15, 1, implicit-def $vcc, implicit $vcc, implicit $exec
245 $vcc = S_CSELECT_B64 -1, 0, implicit $scc
250 name: mask_hazard_subb4
253 ; GCN-LABEL: name: mask_hazard_subb4
254 ; GCN: $vgpr0, $sgpr2_sgpr3 = V_SUBB_U32_e64_dpp $vgpr0, $vgpr1, $vgpr2, $sgpr2_sgpr3, 0, 1, 15, 15, 1, implicit $exec
255 ; GCN-NEXT: $sgpr2_sgpr3 = S_CSELECT_B64 -1, 0, implicit $scc
256 ; GCN-NEXT: S_WAITCNT_DEPCTR 65534
257 ; GCN-NEXT: S_ENDPGM 0
258 $vgpr0, $sgpr2_sgpr3 = V_SUBB_U32_e64_dpp $vgpr0, $vgpr1, $vgpr2, $sgpr2_sgpr3, 0, 1, 15, 15, 1, implicit $exec
259 $sgpr2_sgpr3 = S_CSELECT_B64 -1, 0, implicit $scc
264 name: mask_hazard_subbrev1
267 ; GCN-LABEL: name: mask_hazard_subbrev1
268 ; GCN: $vgpr1, $vcc = V_SUBBREV_U32_e64 0, $vgpr1, $sgpr2_sgpr3, 0, implicit $exec
269 ; GCN-NEXT: $sgpr2_sgpr3 = S_CSELECT_B64 -1, 0, implicit $scc
270 ; GCN-NEXT: S_WAITCNT_DEPCTR 65534
271 ; GCN-NEXT: S_ENDPGM 0
272 $vgpr1, $vcc = V_SUBBREV_U32_e64 0, $vgpr1, $sgpr2_sgpr3, 0, implicit $exec
273 $sgpr2_sgpr3 = S_CSELECT_B64 -1, 0, implicit $scc
278 name: mask_hazard_subbrev2
281 ; GCN-LABEL: name: mask_hazard_subbrev2
282 ; GCN: $vgpr1 = V_SUBBREV_U32_e32 0, $vgpr1, implicit-def $vcc, implicit $vcc, implicit $exec
283 ; GCN-NEXT: $vcc = S_CSELECT_B64 -1, 0, implicit $scc
284 ; GCN-NEXT: S_WAITCNT_DEPCTR 65534
285 ; GCN-NEXT: S_ENDPGM 0
286 $vgpr1 = V_SUBBREV_U32_e32 0, $vgpr1, implicit-def $vcc, implicit $vcc, implicit $exec
287 $vcc = S_CSELECT_B64 -1, 0, implicit $scc
292 name: mask_hazard_subbrev3
295 ; GCN-LABEL: name: mask_hazard_subbrev3
296 ; GCN: $vgpr0 = V_SUBBREV_U32_dpp $vgpr0, $vgpr1, $vgpr2, 1, 15, 15, 1, implicit-def $vcc, implicit $vcc, implicit $exec
297 ; GCN-NEXT: $vcc = S_CSELECT_B64 -1, 0, implicit $scc
298 ; GCN-NEXT: S_WAITCNT_DEPCTR 65534
299 ; GCN-NEXT: S_ENDPGM 0
300 $vgpr0 = V_SUBBREV_U32_dpp $vgpr0, $vgpr1, $vgpr2, 1, 15, 15, 1, implicit-def $vcc, implicit $vcc, implicit $exec
301 $vcc = S_CSELECT_B64 -1, 0, implicit $scc
306 name: mask_hazard_subbrev4
309 ; GCN-LABEL: name: mask_hazard_subbrev4
310 ; GCN: $vgpr0, $sgpr2_sgpr3 = V_SUBBREV_U32_e64_dpp $vgpr0, $vgpr1, $vgpr2, $sgpr2_sgpr3, 0, 1, 15, 15, 1, implicit $exec
311 ; GCN-NEXT: $sgpr2_sgpr3 = S_CSELECT_B64 -1, 0, implicit $scc
312 ; GCN-NEXT: S_WAITCNT_DEPCTR 65534
313 ; GCN-NEXT: S_ENDPGM 0
314 $vgpr0, $sgpr2_sgpr3 = V_SUBBREV_U32_e64_dpp $vgpr0, $vgpr1, $vgpr2, $sgpr2_sgpr3, 0, 1, 15, 15, 1, implicit $exec
315 $sgpr2_sgpr3 = S_CSELECT_B64 -1, 0, implicit $scc
320 name: mask_hazard_div_fmas_f32
323 ; GCN-LABEL: name: mask_hazard_div_fmas_f32
324 ; GCN: $vgpr0 = V_DIV_FMAS_F32_e64 0, $vgpr1, 0, $vgpr2, 0, $vgpr3, 0, 0, implicit $mode, implicit $vcc, implicit $exec
325 ; GCN-NEXT: $vcc = S_CSELECT_B64 -1, 0, implicit $scc
326 ; GCN-NEXT: S_WAITCNT_DEPCTR 65534
327 ; GCN-NEXT: S_ENDPGM 0
328 $vgpr0 = V_DIV_FMAS_F32_e64 0, $vgpr1, 0, $vgpr2, 0, $vgpr3, 0, 0, implicit $mode, implicit $vcc, implicit $exec
329 $vcc = S_CSELECT_B64 -1, 0, implicit $scc
334 name: mask_hazard_div_fmas_f64
337 ; GCN-LABEL: name: mask_hazard_div_fmas_f64
338 ; GCN: $vgpr0_vgpr1 = V_DIV_FMAS_F64_e64 0, $vgpr0_vgpr1, 0, $vgpr2_vgpr3, 0, $vgpr4_vgpr5, 0, 0, implicit $mode, implicit $vcc, implicit $exec
339 ; GCN-NEXT: $vcc = S_CSELECT_B64 -1, 0, implicit $scc
340 ; GCN-NEXT: S_WAITCNT_DEPCTR 65534
341 ; GCN-NEXT: S_ENDPGM 0
342 $vgpr0_vgpr1 = V_DIV_FMAS_F64_e64 0, $vgpr0_vgpr1, 0, $vgpr2_vgpr3, 0, $vgpr4_vgpr5, 0, 0, implicit $mode, implicit $vcc, implicit $exec
343 $vcc = S_CSELECT_B64 -1, 0, implicit $scc
347 # Check low word overlap
349 name: mask_hazard_subreg1
352 ; GCN-LABEL: name: mask_hazard_subreg1
353 ; GCN: $vgpr1 = V_CNDMASK_B32_e64 0, $vgpr1, 0, $vgpr2, $sgpr2_sgpr3, implicit $exec
354 ; GCN-NEXT: $sgpr2 = S_MOV_B32 0
355 ; GCN-NEXT: S_WAITCNT_DEPCTR 65534
356 ; GCN-NEXT: S_ENDPGM 0
357 $vgpr1 = V_CNDMASK_B32_e64 0, $vgpr1, 0, $vgpr2, $sgpr2_sgpr3, implicit $exec
362 # Check high word overlap
364 name: mask_hazard_subreg2
367 ; GCN-LABEL: name: mask_hazard_subreg2
368 ; GCN: $vgpr1 = V_CNDMASK_B32_e64 0, $vgpr1, 0, $vgpr2, $sgpr2_sgpr3, implicit $exec
369 ; GCN-NEXT: $sgpr3 = S_MOV_B32 0
370 ; GCN-NEXT: S_WAITCNT_DEPCTR 65534
371 ; GCN-NEXT: S_ENDPGM 0
372 $vgpr1 = V_CNDMASK_B32_e64 0, $vgpr1, 0, $vgpr2, $sgpr2_sgpr3, implicit $exec
377 # Check multiple subreg overlap
379 name: mask_hazard_subreg3
382 ; GCN-LABEL: name: mask_hazard_subreg3
383 ; GCN: $vgpr1 = V_CNDMASK_B32_e64 0, $vgpr1, 0, $vgpr2, $sgpr2_sgpr3, implicit $exec
384 ; GCN-NEXT: $sgpr2 = S_MOV_B32 0
385 ; GCN-NEXT: S_WAITCNT_DEPCTR 65534
386 ; GCN-NEXT: $sgpr3 = S_MOV_B32 0
387 ; GCN-NEXT: S_ENDPGM 0
388 $vgpr1 = V_CNDMASK_B32_e64 0, $vgpr1, 0, $vgpr2, $sgpr2_sgpr3, implicit $exec
394 # Check vcc_lo overlap
396 name: mask_hazard_subreg4
399 ; GCN-LABEL: name: mask_hazard_subreg4
400 ; GCN: $vgpr1 = V_CNDMASK_B32_e32 $vgpr1, $vgpr2, implicit $vcc, implicit $exec
401 ; GCN-NEXT: $vcc_lo = S_MOV_B32 0
402 ; GCN-NEXT: S_WAITCNT_DEPCTR 65534
403 ; GCN-NEXT: $sgpr2 = S_MOV_B32 $vcc_lo
404 ; GCN-NEXT: S_ENDPGM 0
405 $vgpr1 = V_CNDMASK_B32_e32 $vgpr1, $vgpr2, implicit $vcc, implicit $exec
406 $vcc_lo = S_MOV_B32 0
407 $sgpr2 = S_MOV_B32 $vcc_lo
411 # Check vcc_hi overlap
413 name: mask_hazard_subreg5
416 ; GCN-LABEL: name: mask_hazard_subreg5
417 ; GCN: $vgpr1 = V_CNDMASK_B32_e32 $vgpr1, $vgpr2, implicit $vcc, implicit $exec
418 ; GCN-NEXT: $vcc_hi = S_MOV_B32 0
419 ; GCN-NEXT: S_WAITCNT_DEPCTR 65534
420 ; GCN-NEXT: $sgpr2 = S_MOV_B32 $vcc_hi
421 ; GCN-NEXT: S_ENDPGM 0
422 $vgpr1 = V_CNDMASK_B32_e32 $vgpr1, $vgpr2, implicit $vcc, implicit $exec
423 $vcc_hi = S_MOV_B32 0
424 $sgpr2 = S_MOV_B32 $vcc_hi
428 # S_WAITCNT does not mitigate hazard
430 name: mask_hazard_waitcnt
433 ; GCN-LABEL: name: mask_hazard_waitcnt
434 ; GCN: $vgpr1 = V_CNDMASK_B32_e64 0, $vgpr1, 0, $vgpr2, $sgpr0_sgpr1, implicit $exec
435 ; GCN-NEXT: S_WAITCNT 0
436 ; GCN-NEXT: $sgpr0_sgpr1 = S_GETPC_B64
437 ; GCN-NEXT: S_WAITCNT_DEPCTR 65534
438 ; GCN-NEXT: $sgpr0 = S_ADD_U32 $sgpr0, 0, implicit-def $scc
439 ; GCN-NEXT: S_ENDPGM 0
440 $vgpr1 = V_CNDMASK_B32_e64 0, $vgpr1, 0, $vgpr2, $sgpr0_sgpr1, implicit $exec
442 $sgpr0_sgpr1 = S_GETPC_B64
443 $sgpr0 = S_ADD_U32 $sgpr0, 0, implicit-def $scc
447 # Check implicit $exec
449 name: mask_hazard_gap1
452 ; GCN-LABEL: name: mask_hazard_gap1
453 ; GCN: $vgpr1 = V_CNDMASK_B32_e64 0, $vgpr1, 0, $vgpr2, $sgpr0_sgpr1, implicit $exec
454 ; GCN-NEXT: $vgpr2 = V_MOV_B32_e32 0, implicit $exec
455 ; GCN-NEXT: $vgpr3 = V_MOV_B32_e32 0, implicit $exec
456 ; GCN-NEXT: $sgpr0_sgpr1 = S_GETPC_B64
457 ; GCN-NEXT: S_WAITCNT_DEPCTR 65534
458 ; GCN-NEXT: $sgpr0 = S_ADD_U32 $sgpr0, 0, implicit-def $scc
459 ; GCN-NEXT: S_ENDPGM 0
460 $vgpr1 = V_CNDMASK_B32_e64 0, $vgpr1, 0, $vgpr2, $sgpr0_sgpr1, implicit $exec
461 $vgpr2 = V_MOV_B32_e32 0, implicit $exec
462 $vgpr3 = V_MOV_B32_e32 0, implicit $exec
463 $sgpr0_sgpr1 = S_GETPC_B64
464 $sgpr0 = S_ADD_U32 $sgpr0, 0, implicit-def $scc
468 # Check implicit $mode
470 name: mask_hazard_gap2
473 ; GCN-LABEL: name: mask_hazard_gap2
474 ; GCN: $vgpr1 = V_CNDMASK_B32_e64 0, $vgpr1, 0, $vgpr2, $sgpr0_sgpr1, implicit $exec
475 ; GCN-NEXT: $vgpr2 = V_MOV_B32_e32 0, implicit $exec, implicit $mode
476 ; GCN-NEXT: $sgpr0_sgpr1 = S_GETPC_B64
477 ; GCN-NEXT: S_WAITCNT_DEPCTR 65534
478 ; GCN-NEXT: $sgpr0 = S_ADD_U32 $sgpr0, 0, implicit-def $scc
479 ; GCN-NEXT: S_ENDPGM 0
480 $vgpr1 = V_CNDMASK_B32_e64 0, $vgpr1, 0, $vgpr2, $sgpr0_sgpr1, implicit $exec
481 $vgpr2 = V_MOV_B32_e32 0, implicit $exec, implicit $mode
482 $sgpr0_sgpr1 = S_GETPC_B64
483 $sgpr0 = S_ADD_U32 $sgpr0, 0, implicit-def $scc
487 # Check explicit $exec
489 name: mask_hazard_gap3
492 ; GCN-LABEL: name: mask_hazard_gap3
493 ; GCN: $vgpr1 = V_CNDMASK_B32_e64 0, $vgpr1, 0, $vgpr2, $sgpr0_sgpr1, implicit $exec
494 ; GCN-NEXT: $vgpr2 = V_WRITELANE_B32 $exec_lo, 0, $vgpr2
495 ; GCN-NEXT: $sgpr0_sgpr1 = S_GETPC_B64
496 ; GCN-NEXT: S_WAITCNT_DEPCTR 65534
497 ; GCN-NEXT: $sgpr0 = S_ADD_U32 $sgpr0, 0, implicit-def $scc
498 ; GCN-NEXT: S_ENDPGM 0
499 $vgpr1 = V_CNDMASK_B32_e64 0, $vgpr1, 0, $vgpr2, $sgpr0_sgpr1, implicit $exec
500 $vgpr2 = V_WRITELANE_B32 $exec_lo, 0, $vgpr2
501 $sgpr0_sgpr1 = S_GETPC_B64
502 $sgpr0 = S_ADD_U32 $sgpr0, 0, implicit-def $scc
506 # Different SGPR write
508 name: mask_hazard_no_hazard1
511 ; GCN-LABEL: name: mask_hazard_no_hazard1
512 ; GCN: $vgpr1 = V_CNDMASK_B32_e64 0, $vgpr1, 0, $vgpr2, $sgpr2_sgpr3, implicit $exec
513 ; GCN-NEXT: $sgpr0 = S_MOV_B32 0
514 ; GCN-NEXT: S_ENDPGM 0
515 $vgpr1 = V_CNDMASK_B32_e64 0, $vgpr1, 0, $vgpr2, $sgpr2_sgpr3, implicit $exec
520 # Different SGPR write with mask read overlap
522 name: mask_hazard_no_hazard2
525 ; GCN-LABEL: name: mask_hazard_no_hazard2
526 ; GCN: $vgpr1 = V_CNDMASK_B32_e32 $vgpr1, $vgpr2, implicit $vcc, implicit $exec
527 ; GCN-NEXT: $sgpr0_sgpr1 = S_MOV_B64 $vcc
528 ; GCN-NEXT: S_ENDPGM 0
529 $vgpr1 = V_CNDMASK_B32_e32 $vgpr1, $vgpr2, implicit $vcc, implicit $exec
530 $sgpr0_sgpr1 = S_MOV_B64 $vcc
534 # Overlapping VGPR write
536 name: mask_hazard_no_hazard3
539 ; GCN-LABEL: name: mask_hazard_no_hazard3
540 ; GCN: $vgpr1 = V_CNDMASK_B32_e32 $vgpr1, $vgpr2, implicit $vcc, implicit $exec
541 ; GCN-NEXT: $vgpr2 = V_MOV_B32_e32 0, implicit $exec
542 ; GCN-NEXT: S_ENDPGM 0
543 $vgpr1 = V_CNDMASK_B32_e32 $vgpr1, $vgpr2, implicit $vcc, implicit $exec
544 $vgpr2 = V_MOV_B32_e32 0, implicit $exec