1 # RUN: llc -march=amdgcn -mcpu=gfx1010 -mattr=-WavefrontSize32,+WavefrontSize64 -verify-machineinstrs -run-pass post-RA-hazard-rec -o - %s | FileCheck -check-prefix=GCN %s
3 # GCN-LABEL: name: hazard_smem_war
4 # GCN: S_LOAD_DWORD_IMM
5 # GCN: $sgpr_null = S_MOV_B32 0
6 # GCN-NEXT: V_CMP_EQ_F32
11 liveins: $sgpr0, $sgpr1, $vgpr0, $vgpr1
12 $sgpr2 = S_LOAD_DWORD_IMM $sgpr0_sgpr1, 0, 0, 0
13 $sgpr0_sgpr1 = V_CMP_EQ_F32_e64 0, $vgpr0, 0, $vgpr1, 1, implicit $exec
17 # GCN-LABEL: name: hazard_smem_war_no_hazard
18 # GCN: S_LOAD_DWORD_IMM
20 # GCN-NEXT: V_CMP_EQ_F32
22 name: hazard_smem_war_no_hazard
25 liveins: $sgpr0, $sgpr1, $sgpr4, $sgpr5, $vgpr0, $vgpr1
26 $sgpr2 = S_LOAD_DWORD_IMM $sgpr0_sgpr1, 0, 0, 0
27 $sgpr3 = S_ADD_U32 $sgpr4, $sgpr5, implicit-def $scc
28 $sgpr0_sgpr1 = V_CMP_EQ_F32_e64 0, $vgpr0, 0, $vgpr1, 1, implicit $exec
32 # GCN-LABEL: name: hazard_smem_war_dependent_salu
33 # GCN: S_LOAD_DWORD_IMM
36 # GCN-NEXT: V_CMP_EQ_F32
38 name: hazard_smem_war_dependent_salu
41 liveins: $sgpr0, $sgpr1, $sgpr4, $vgpr0, $vgpr1
42 $sgpr2 = S_LOAD_DWORD_IMM $sgpr0_sgpr1, 0, 0, 0
44 $sgpr3 = S_ADD_U32 $sgpr2, $sgpr4, implicit-def $scc
45 $sgpr0_sgpr1 = V_CMP_EQ_F32_e64 0, $vgpr0, 0, $vgpr1, 1, implicit $exec
49 # GCN-LABEL: name: hazard_smem_war_independent_salu
50 # GCN: S_LOAD_DWORD_IMM
53 # GCN-NEXT: V_CMP_EQ_F32
55 name: hazard_smem_war_independent_salu
58 liveins: $sgpr0, $sgpr1, $sgpr4, $sgpr5, $vgpr0, $vgpr1
59 $sgpr2 = S_LOAD_DWORD_IMM $sgpr0_sgpr1, 0, 0, 0
61 $sgpr3 = S_ADD_U32 $sgpr5, $sgpr4, implicit-def $scc
62 $sgpr0_sgpr1 = V_CMP_EQ_F32_e64 0, $vgpr0, 0, $vgpr1, 1, implicit $exec
66 # GCN-LABEL: name: hazard_smem_war_only_smem
67 # GCN: S_LOAD_DWORD_IMM
68 # GCN-NEXT: S_LOAD_DWORD_IMM
69 # GCN-NEXT: $sgpr_null = S_MOV_B32 0
70 # GCN-NEXT: V_CMP_EQ_F32
72 name: hazard_smem_war_only_smem
75 liveins: $sgpr0, $sgpr1, $sgpr6, $sgpr7, $vgpr0, $vgpr1
76 $sgpr2 = S_LOAD_DWORD_IMM $sgpr0_sgpr1, 0, 0, 0
77 $sgpr5 = S_LOAD_DWORD_IMM $sgpr6_sgpr7, 0, 0, 0
78 $sgpr0_sgpr1 = V_CMP_EQ_F32_e64 0, $vgpr0, 0, $vgpr1, 1, implicit $exec
82 # GCN-LABEL: name: hazard_smem_war_only_waitcnt_0
83 # GCN: S_LOAD_DWORD_IMM
85 # GCN-NEXT: V_CMP_EQ_F32
87 name: hazard_smem_war_only_waitcnt_0
90 liveins: $sgpr0, $sgpr1, $vgpr0, $vgpr1
91 $sgpr2 = S_LOAD_DWORD_IMM $sgpr0_sgpr1, 0, 0, 0
93 $sgpr0_sgpr1 = V_CMP_EQ_F32_e64 0, $vgpr0, 0, $vgpr1, 1, implicit $exec
97 # GCN-LABEL: name: hazard_smem_war_only_vmcnt_0
98 # GCN: S_LOAD_DWORD_IMM
99 # GCN-NEXT: S_WAITCNT 3952{{$}}
100 # GCN-NEXT: $sgpr_null = S_MOV_B32 0
101 # GCN-NEXT: V_CMP_EQ_F32
103 name: hazard_smem_war_only_vmcnt_0
106 liveins: $sgpr0, $sgpr1, $vgpr0, $vgpr1
107 $sgpr2 = S_LOAD_DWORD_IMM $sgpr0_sgpr1, 0, 0, 0
109 $sgpr0_sgpr1 = V_CMP_EQ_F32_e64 0, $vgpr0, 0, $vgpr1, 1, implicit $exec
113 # GCN-LABEL: name: hazard_smem_war_only_expcnt_0
114 # GCN: S_LOAD_DWORD_IMM
115 # GCN-NEXT: S_WAITCNT 53007{{$}}
116 # GCN-NEXT: $sgpr_null = S_MOV_B32 0
117 # GCN-NEXT: V_CMP_EQ_F32
119 name: hazard_smem_war_only_expcnt_0
122 liveins: $sgpr0, $sgpr1, $vgpr0, $vgpr1
123 $sgpr2 = S_LOAD_DWORD_IMM $sgpr0_sgpr1, 0, 0, 0
125 $sgpr0_sgpr1 = V_CMP_EQ_F32_e64 0, $vgpr0, 0, $vgpr1, 1, implicit $exec
129 # GCN-LABEL: name: hazard_smem_war_only_lgkmcnt_0
130 # GCN: S_LOAD_DWORD_IMM
131 # GCN-NEXT: S_WAITCNT 49279{{$}}
132 # GCN-NEXT: V_CMP_EQ_F32
134 name: hazard_smem_war_only_lgkmcnt_0
137 liveins: $sgpr0, $sgpr1, $vgpr0, $vgpr1
138 $sgpr2 = S_LOAD_DWORD_IMM $sgpr0_sgpr1, 0, 0, 0
140 $sgpr0_sgpr1 = V_CMP_EQ_F32_e64 0, $vgpr0, 0, $vgpr1, 1, implicit $exec
144 # GCN-LABEL: name: hazard_smem_war_only_waitcnt_lgkmcnt_0
145 # GCN: S_LOAD_DWORD_IMM
146 # GCN-NEXT: S_WAITCNT_LGKMCNT
147 # GCN-NEXT: V_CMP_EQ_F32
149 name: hazard_smem_war_only_waitcnt_lgkmcnt_0
152 liveins: $sgpr0, $sgpr1, $vgpr0, $vgpr1
153 $sgpr2 = S_LOAD_DWORD_IMM $sgpr0_sgpr1, 0, 0, 0
154 S_WAITCNT_LGKMCNT $sgpr_null, 0
155 $sgpr0_sgpr1 = V_CMP_EQ_F32_e64 0, $vgpr0, 0, $vgpr1, 1, implicit $exec
159 # GCN-LABEL: name: hazard_smem_war_only_waitcnt_lgkmcnt_1
160 # GCN: S_LOAD_DWORD_IMM
161 # GCN-NEXT: S_WAITCNT_LGKMCNT
162 # GCN-NEXT: $sgpr_null = S_MOV_B32 0
163 # GCN-NEXT: V_CMP_EQ_F32
165 name: hazard_smem_war_only_waitcnt_lgkmcnt_1
168 liveins: $sgpr0, $sgpr1, $vgpr0, $vgpr1
169 $sgpr2 = S_LOAD_DWORD_IMM $sgpr0_sgpr1, 0, 0, 0
170 S_WAITCNT_LGKMCNT $sgpr_null, 1
171 $sgpr0_sgpr1 = V_CMP_EQ_F32_e64 0, $vgpr0, 0, $vgpr1, 1, implicit $exec
175 # GCN-LABEL: name: hazard_smem_war_branch
176 # GCN: S_LOAD_DWORD_IMM
177 # GCN: $sgpr_null = S_MOV_B32 0
178 # GCN-NEXT: V_CMP_EQ_F32
180 name: hazard_smem_war_branch
183 liveins: $sgpr0, $sgpr1, $sgpr4, $vgpr0, $vgpr1
185 $sgpr2 = S_LOAD_DWORD_IMM $sgpr0_sgpr1, 0, 0, 0
189 liveins: $sgpr0, $sgpr1, $sgpr2, $vgpr0, $vgpr1
190 $sgpr0_sgpr1 = V_CMP_EQ_F32_e64 0, $vgpr0, 0, $vgpr1, 1, implicit $exec
194 # GCN-LABEL: name: hazard_smem_war_cbranch
196 # GCN: S_LOAD_DWORD_IMM
197 # GCN: S_CBRANCH_VCCZ
198 # GCN-NOT: $sgpr_null = S_MOV_B32 0
201 # GCN: $sgpr_null = S_MOV_B32 0
202 # GCN-NEXT: V_CMP_EQ_F32
204 name: hazard_smem_war_cbranch
207 liveins: $sgpr0, $sgpr1, $sgpr4, $sgpr5, $vgpr0, $vgpr1
208 successors: %bb.1, %bb.2
209 $vcc = S_AND_B64 $sgpr4_sgpr5, $sgpr4_sgpr5, implicit-def $scc
210 $sgpr2 = S_LOAD_DWORD_IMM $sgpr0_sgpr1, 0, 0, 0
211 S_CBRANCH_VCCZ %bb.2, implicit killed $vcc
214 liveins: $sgpr0, $sgpr1, $sgpr2, $sgpr4, $sgpr5, $vgpr0, $vgpr1
215 $sgpr4_sgpr5 = V_CMP_EQ_F32_e64 0, $vgpr0, 0, $vgpr1, 1, implicit $exec
219 liveins: $sgpr0, $sgpr1, $sgpr2, $sgpr4, $sgpr5, $vgpr0, $vgpr1
220 $sgpr0_sgpr1 = V_CMP_EQ_F32_e64 0, $vgpr0, 0, $vgpr1, 1, implicit $exec
224 # GCN-LABEL: name: hazard_smem_war_cbranch_carry
226 # GCN: S_LOAD_DWORD_IMM
227 # GCN: S_CBRANCH_VCCZ
228 # GCN-NOT: $sgpr_null = S_MOV_B32 0
230 # GCN-NEXT: S_ENDPGM 0
231 # GCN-NOT: $sgpr_null = S_MOV_B32 0
233 # GCN: $sgpr_null = S_MOV_B32 0
234 # GCN-NEXT: V_CMP_EQ_F32
236 name: hazard_smem_war_cbranch_carry
239 liveins: $sgpr0, $sgpr1, $sgpr4, $sgpr5, $vgpr0, $vgpr1
240 successors: %bb.1, %bb.2
241 $vcc = S_AND_B64 $sgpr4_sgpr5, $sgpr4_sgpr5, implicit-def $scc
242 $sgpr2 = S_LOAD_DWORD_IMM $sgpr0_sgpr1, 0, 0, 0
243 S_CBRANCH_VCCZ %bb.2, implicit killed $vcc
246 liveins: $sgpr0, $sgpr1, $sgpr2, $sgpr4, $sgpr5, $vgpr0, $vgpr1
247 $sgpr4_sgpr5 = V_CMP_EQ_F32_e64 0, $vgpr0, 0, $vgpr1, 1, implicit $exec
252 liveins: $sgpr0, $sgpr1, $sgpr2, $sgpr4, $sgpr5, $vgpr0, $vgpr1
253 $sgpr4_sgpr5 = V_CMP_EQ_F32_e64 0, $vgpr0, 0, $vgpr1, 1, implicit $exec
256 liveins: $sgpr0, $sgpr1, $sgpr2, $sgpr4, $sgpr5, $vgpr0, $vgpr1
257 $sgpr0_sgpr1 = V_CMP_EQ_F32_e64 0, $vgpr0, 0, $vgpr1, 1, implicit $exec
261 # GCN-LABEL: name: hazard_smem_war_backedge
262 # GCN: $sgpr_null = S_MOV_B32 0
263 # GCN-NEXT: V_CMP_EQ_F32
264 # GCN: S_LOAD_DWORD_IMM
266 name: hazard_smem_war_backedge
269 liveins: $sgpr0, $sgpr1, $sgpr2, $vgpr0, $vgpr1
271 $sgpr0_sgpr1 = V_CMP_EQ_F32_e64 0, $vgpr0, 0, $vgpr1, 1, implicit $exec
274 liveins: $sgpr0, $sgpr1, $sgpr2, $vgpr0, $vgpr1
275 $sgpr2 = S_LOAD_DWORD_IMM $sgpr0_sgpr1, 0, 0, 0
279 # GCN-LABEL: name: hazard_smem_war_impdef
280 # GCN: S_LOAD_DWORD_IMM
281 # GCN: $sgpr_null = S_MOV_B32 0
282 # GCN-NEXT: V_CMP_EQ_F32
284 name: hazard_smem_war_impdef
287 liveins: $vcc, $vgpr0
288 $sgpr0 = S_LOAD_DWORD_IMM $vcc, 0, 0, 0
289 V_CMP_EQ_F32_e32 $vgpr0, $vgpr0, implicit-def $vcc, implicit $exec
293 # GCN-LABEL: name: hazard_smem_war_readlane
294 # GCN: S_LOAD_DWORD_IMM
295 # GCN: $sgpr_null = S_MOV_B32 0
296 # GCN-NEXT: V_READLANE_B32
298 name: hazard_smem_war_readlane
301 liveins: $sgpr0, $sgpr1, $sgpr3, $vgpr0
302 $sgpr2 = S_LOAD_DWORD_IMM $sgpr0_sgpr1, 0, 0, 0
303 $sgpr0 = V_READLANE_B32 $vgpr0, $sgpr3
307 # Workaround since spilling/restoring SGPRs use real opcodes.
308 # GCN-LABEL: name: hazard_smem_war_readlane_gfx10
309 # GCN: S_LOAD_DWORD_IMM
310 # GCN: $sgpr_null = S_MOV_B32 0
311 # GCN-NEXT: V_READLANE_B32_gfx10
313 name: hazard_smem_war_readlane_gfx10
316 liveins: $sgpr0, $sgpr1, $sgpr3, $vgpr0
317 $sgpr2 = S_LOAD_DWORD_IMM $sgpr0_sgpr1, 0, 0, 0
318 $sgpr0 = V_READLANE_B32_gfx10 $vgpr0, $sgpr3
322 # GCN-LABEL: name: hazard_smem_war_readfirstlane
323 # GCN: S_LOAD_DWORD_IMM
324 # GCN: $sgpr_null = S_MOV_B32 0
325 # GCN-NEXT: V_READFIRSTLANE_B32
327 name: hazard_smem_war_readfirstlane
330 liveins: $sgpr0, $sgpr1, $vgpr0
331 $sgpr2 = S_LOAD_DWORD_IMM $sgpr0_sgpr1, 0, 0, 0
332 $sgpr0 = V_READFIRSTLANE_B32 $vgpr0, implicit $exec