1 # RUN: llc -march=amdgcn -mcpu=gfx1010 -mattr=-wavefrontsize32,+wavefrontsize64 -verify-machineinstrs -run-pass post-RA-hazard-rec -o - %s | FileCheck -check-prefixes=GCN,GFX10 %s
2 # RUN: llc -march=amdgcn -mcpu=gfx1100 -mattr=-wavefrontsize32,+wavefrontsize64 -verify-machineinstrs -run-pass post-RA-hazard-rec -o - %s | FileCheck -check-prefixes=GCN %s
4 # GCN-LABEL: name: hazard_smem_war
5 # GCN: S_LOAD_DWORD_IMM
6 # GFX10-NEXT: $sgpr_null = S_MOV_B32 0
7 # GCN-NEXT: V_CMP_EQ_F32
12 liveins: $sgpr0, $sgpr1, $vgpr0, $vgpr1
13 $sgpr2 = S_LOAD_DWORD_IMM $sgpr0_sgpr1, 0, 0
14 $sgpr0_sgpr1 = V_CMP_EQ_F32_e64 0, $vgpr0, 0, $vgpr1, 1, implicit $mode, implicit $exec
18 # GCN-LABEL: name: hazard_smem_war_no_hazard
19 # GCN: S_LOAD_DWORD_IMM
21 # GCN-NEXT: V_CMP_EQ_F32
23 name: hazard_smem_war_no_hazard
26 liveins: $sgpr0, $sgpr1, $sgpr4, $sgpr5, $vgpr0, $vgpr1
27 $sgpr2 = S_LOAD_DWORD_IMM $sgpr0_sgpr1, 0, 0
28 $sgpr3 = S_ADD_U32 $sgpr4, $sgpr5, implicit-def $scc
29 $sgpr0_sgpr1 = V_CMP_EQ_F32_e64 0, $vgpr0, 0, $vgpr1, 1, implicit $mode, implicit $exec
33 # GCN-LABEL: name: hazard_smem_war_dependent_salu
34 # GCN: S_LOAD_DWORD_IMM
37 # GCN-NEXT: V_CMP_EQ_F32
39 name: hazard_smem_war_dependent_salu
42 liveins: $sgpr0, $sgpr1, $sgpr4, $vgpr0, $vgpr1
43 $sgpr2 = S_LOAD_DWORD_IMM $sgpr0_sgpr1, 0, 0
45 $sgpr3 = S_ADD_U32 $sgpr2, $sgpr4, implicit-def $scc
46 $sgpr0_sgpr1 = V_CMP_EQ_F32_e64 0, $vgpr0, 0, $vgpr1, 1, implicit $mode, implicit $exec
50 # GCN-LABEL: name: hazard_smem_war_independent_salu
51 # GCN: S_LOAD_DWORD_IMM
54 # GCN-NEXT: V_CMP_EQ_F32
56 name: hazard_smem_war_independent_salu
59 liveins: $sgpr0, $sgpr1, $sgpr4, $sgpr5, $vgpr0, $vgpr1
60 $sgpr2 = S_LOAD_DWORD_IMM $sgpr0_sgpr1, 0, 0
62 $sgpr3 = S_ADD_U32 $sgpr5, $sgpr4, implicit-def $scc
63 $sgpr0_sgpr1 = V_CMP_EQ_F32_e64 0, $vgpr0, 0, $vgpr1, 1, implicit $mode, implicit $exec
67 # GCN-LABEL: name: hazard_smem_war_only_smem
68 # GCN: S_LOAD_DWORD_IMM
69 # GCN-NEXT: S_LOAD_DWORD_IMM
70 # GFX10-NEXT: $sgpr_null = S_MOV_B32 0
71 # GCN-NEXT: V_CMP_EQ_F32
73 name: hazard_smem_war_only_smem
76 liveins: $sgpr0, $sgpr1, $sgpr6, $sgpr7, $vgpr0, $vgpr1
77 $sgpr2 = S_LOAD_DWORD_IMM $sgpr0_sgpr1, 0, 0
78 $sgpr5 = S_LOAD_DWORD_IMM $sgpr6_sgpr7, 0, 0
79 $sgpr0_sgpr1 = V_CMP_EQ_F32_e64 0, $vgpr0, 0, $vgpr1, 1, implicit $mode, implicit $exec
83 # GCN-LABEL: name: hazard_smem_war_only_waitcnt_0
84 # GCN: S_LOAD_DWORD_IMM
86 # GCN-NEXT: V_CMP_EQ_F32
88 name: hazard_smem_war_only_waitcnt_0
91 liveins: $sgpr0, $sgpr1, $vgpr0, $vgpr1
92 $sgpr2 = S_LOAD_DWORD_IMM $sgpr0_sgpr1, 0, 0
94 $sgpr0_sgpr1 = V_CMP_EQ_F32_e64 0, $vgpr0, 0, $vgpr1, 1, implicit $mode, implicit $exec
98 # GCN-LABEL: name: hazard_smem_war_only_vmcnt_0
99 # GCN: S_LOAD_DWORD_IMM
100 # GCN-NEXT: S_WAITCNT 3952{{$}}
101 # GFX10-NEXT: $sgpr_null = S_MOV_B32 0
102 # GCN-NEXT: V_CMP_EQ_F32
104 name: hazard_smem_war_only_vmcnt_0
107 liveins: $sgpr0, $sgpr1, $vgpr0, $vgpr1
108 $sgpr2 = S_LOAD_DWORD_IMM $sgpr0_sgpr1, 0, 0
110 $sgpr0_sgpr1 = V_CMP_EQ_F32_e64 0, $vgpr0, 0, $vgpr1, 1, implicit $mode, implicit $exec
114 # GCN-LABEL: name: hazard_smem_war_only_expcnt_0
115 # GCN: S_LOAD_DWORD_IMM
116 # GCN-NEXT: S_WAITCNT 53007{{$}}
117 # GFX10-NEXT: $sgpr_null = S_MOV_B32 0
118 # GCN-NEXT: V_CMP_EQ_F32
120 name: hazard_smem_war_only_expcnt_0
123 liveins: $sgpr0, $sgpr1, $vgpr0, $vgpr1
124 $sgpr2 = S_LOAD_DWORD_IMM $sgpr0_sgpr1, 0, 0
126 $sgpr0_sgpr1 = V_CMP_EQ_F32_e64 0, $vgpr0, 0, $vgpr1, 1, implicit $mode, implicit $exec
130 # GCN-LABEL: name: hazard_smem_war_only_lgkmcnt_0
131 # GCN: S_LOAD_DWORD_IMM
132 # GCN-NEXT: S_WAITCNT 49279{{$}}
133 # GCN-NEXT: V_CMP_EQ_F32
135 name: hazard_smem_war_only_lgkmcnt_0
138 liveins: $sgpr0, $sgpr1, $vgpr0, $vgpr1
139 $sgpr2 = S_LOAD_DWORD_IMM $sgpr0_sgpr1, 0, 0
141 $sgpr0_sgpr1 = V_CMP_EQ_F32_e64 0, $vgpr0, 0, $vgpr1, 1, implicit $mode, implicit $exec
145 # GCN-LABEL: name: hazard_smem_war_only_waitcnt_lgkmcnt_0
146 # GCN: S_LOAD_DWORD_IMM
147 # GCN-NEXT: S_WAITCNT_LGKMCNT
148 # GCN-NEXT: V_CMP_EQ_F32
150 name: hazard_smem_war_only_waitcnt_lgkmcnt_0
153 liveins: $sgpr0, $sgpr1, $vgpr0, $vgpr1
154 $sgpr2 = S_LOAD_DWORD_IMM $sgpr0_sgpr1, 0, 0
155 S_WAITCNT_LGKMCNT $sgpr_null, 0
156 $sgpr0_sgpr1 = V_CMP_EQ_F32_e64 0, $vgpr0, 0, $vgpr1, 1, implicit $mode, implicit $exec
160 # GCN-LABEL: name: hazard_smem_war_only_waitcnt_lgkmcnt_1
161 # GCN: S_LOAD_DWORD_IMM
162 # GCN-NEXT: S_WAITCNT_LGKMCNT
163 # GFX10-NEXT: $sgpr_null = S_MOV_B32 0
164 # GCN-NEXT: V_CMP_EQ_F32
166 name: hazard_smem_war_only_waitcnt_lgkmcnt_1
169 liveins: $sgpr0, $sgpr1, $vgpr0, $vgpr1
170 $sgpr2 = S_LOAD_DWORD_IMM $sgpr0_sgpr1, 0, 0
171 S_WAITCNT_LGKMCNT $sgpr_null, 1
172 $sgpr0_sgpr1 = V_CMP_EQ_F32_e64 0, $vgpr0, 0, $vgpr1, 1, implicit $mode, implicit $exec
176 # GCN-LABEL: name: hazard_smem_war_branch
177 # GCN: S_LOAD_DWORD_IMM
178 # GFX10: $sgpr_null = S_MOV_B32 0
181 name: hazard_smem_war_branch
184 liveins: $sgpr0, $sgpr1, $sgpr4, $vgpr0, $vgpr1
186 $sgpr2 = S_LOAD_DWORD_IMM $sgpr0_sgpr1, 0, 0
190 liveins: $sgpr0, $sgpr1, $sgpr2, $vgpr0, $vgpr1
191 $sgpr0_sgpr1 = V_CMP_EQ_F32_e64 0, $vgpr0, 0, $vgpr1, 1, implicit $mode, implicit $exec
195 # GCN-LABEL: name: hazard_smem_war_cbranch
197 # GCN: S_LOAD_DWORD_IMM
198 # GCN: S_CBRANCH_VCCZ
199 # GFX10-NOT: $sgpr_null = S_MOV_B32 0
202 # GFX10: $sgpr_null = S_MOV_B32 0
205 name: hazard_smem_war_cbranch
208 liveins: $sgpr0, $sgpr1, $sgpr4, $sgpr5, $vgpr0, $vgpr1
209 successors: %bb.1, %bb.2
210 $vcc = S_AND_B64 $sgpr4_sgpr5, $sgpr4_sgpr5, implicit-def $scc
211 $sgpr2 = S_LOAD_DWORD_IMM $sgpr0_sgpr1, 0, 0
212 S_CBRANCH_VCCZ %bb.2, implicit killed $vcc
215 liveins: $sgpr0, $sgpr1, $sgpr2, $sgpr4, $sgpr5, $vgpr0, $vgpr1
216 $sgpr4_sgpr5 = V_CMP_EQ_F32_e64 0, $vgpr0, 0, $vgpr1, 1, implicit $mode, implicit $exec
220 liveins: $sgpr0, $sgpr1, $sgpr2, $sgpr4, $sgpr5, $vgpr0, $vgpr1
221 $sgpr0_sgpr1 = V_CMP_EQ_F32_e64 0, $vgpr0, 0, $vgpr1, 1, implicit $mode, implicit $exec
225 # GCN-LABEL: name: hazard_smem_war_cbranch_carry
227 # GCN: S_LOAD_DWORD_IMM
228 # GCN: S_CBRANCH_VCCZ
229 # GFX10-NOT: $sgpr_null = S_MOV_B32 0
231 # GCN-NEXT: S_ENDPGM 0
232 # GFX10-NOT: $sgpr_null = S_MOV_B32 0
234 # GFX10: $sgpr_null = S_MOV_B32 0
237 name: hazard_smem_war_cbranch_carry
240 liveins: $sgpr0, $sgpr1, $sgpr4, $sgpr5, $vgpr0, $vgpr1
241 successors: %bb.1, %bb.2
242 $vcc = S_AND_B64 $sgpr4_sgpr5, $sgpr4_sgpr5, implicit-def $scc
243 $sgpr2 = S_LOAD_DWORD_IMM $sgpr0_sgpr1, 0, 0
244 S_CBRANCH_VCCZ %bb.2, implicit killed $vcc
247 liveins: $sgpr0, $sgpr1, $sgpr2, $sgpr4, $sgpr5, $vgpr0, $vgpr1
248 $sgpr4_sgpr5 = V_CMP_EQ_F32_e64 0, $vgpr0, 0, $vgpr1, 1, implicit $mode, implicit $exec
253 liveins: $sgpr0, $sgpr1, $sgpr2, $sgpr4, $sgpr5, $vgpr0, $vgpr1
254 $sgpr4_sgpr5 = V_CMP_EQ_F32_e64 0, $vgpr0, 0, $vgpr1, 1, implicit $mode, implicit $exec
257 liveins: $sgpr0, $sgpr1, $sgpr2, $sgpr4, $sgpr5, $vgpr0, $vgpr1
258 $sgpr0_sgpr1 = V_CMP_EQ_F32_e64 0, $vgpr0, 0, $vgpr1, 1, implicit $mode, implicit $exec
262 # GCN-LABEL: name: hazard_smem_war_backedge
263 # GFX10: $sgpr_null = S_MOV_B32 0
265 # GCN: S_LOAD_DWORD_IMM
267 name: hazard_smem_war_backedge
270 liveins: $sgpr0, $sgpr1, $sgpr2, $vgpr0, $vgpr1
272 $sgpr0_sgpr1 = V_CMP_EQ_F32_e64 0, $vgpr0, 0, $vgpr1, 1, implicit $mode, implicit $exec
275 liveins: $sgpr0, $sgpr1, $sgpr2, $vgpr0, $vgpr1
276 $sgpr2 = S_LOAD_DWORD_IMM $sgpr0_sgpr1, 0, 0
280 # GCN-LABEL: name: hazard_smem_war_impdef
281 # GCN: S_LOAD_DWORD_IMM
282 # GFX10: $sgpr_null = S_MOV_B32 0
283 # GCN-NEXT: V_CMP_EQ_F32
285 name: hazard_smem_war_impdef
288 liveins: $vcc, $vgpr0
289 $sgpr0 = S_LOAD_DWORD_IMM $vcc, 0, 0
290 V_CMP_EQ_F32_e32 $vgpr0, $vgpr0, implicit-def $vcc, implicit $mode, implicit $exec
294 # GCN-LABEL: name: hazard_smem_war_readlane
295 # GCN: S_LOAD_DWORD_IMM
296 # GFX10: $sgpr_null = S_MOV_B32 0
297 # GCN-NEXT: V_READLANE_B32
299 name: hazard_smem_war_readlane
302 liveins: $sgpr0, $sgpr1, $sgpr3, $vgpr0
303 $sgpr2 = S_LOAD_DWORD_IMM $sgpr0_sgpr1, 0, 0
304 $sgpr0 = V_READLANE_B32 $vgpr0, $sgpr3
308 # GCN-LABEL: name: hazard_smem_war_readfirstlane
309 # GCN: S_LOAD_DWORD_IMM
310 # GFX10: $sgpr_null = S_MOV_B32 0
311 # GCN-NEXT: V_READFIRSTLANE_B32
313 name: hazard_smem_war_readfirstlane
316 liveins: $sgpr0, $sgpr1, $vgpr0
317 $sgpr2 = S_LOAD_DWORD_IMM $sgpr0_sgpr1, 0, 0
318 $sgpr0 = V_READFIRSTLANE_B32 $vgpr0, implicit $exec