[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / llvm / test / CodeGen / AMDGPU / smem-war-hazard.mir
blobd69acde0253bb1ad4501b07aa8428708a1bc05ab
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
8 ---
9 name: hazard_smem_war
10 body: |
11   bb.0:
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
15     S_ENDPGM 0
16 ...
18 # GCN-LABEL: name: hazard_smem_war_no_hazard
19 # GCN:      S_LOAD_DWORD_IMM
20 # GCN-NEXT: S_ADD_U32
21 # GCN-NEXT: V_CMP_EQ_F32
22 ---
23 name: hazard_smem_war_no_hazard
24 body: |
25   bb.0:
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
30     S_ENDPGM 0
31 ...
33 # GCN-LABEL: name: hazard_smem_war_dependent_salu
34 # GCN:      S_LOAD_DWORD_IMM
35 # GCN-NEXT: S_WAITCNT
36 # GCN-NEXT: S_ADD_U32
37 # GCN-NEXT: V_CMP_EQ_F32
38 ---
39 name: hazard_smem_war_dependent_salu
40 body: |
41   bb.0:
42     liveins: $sgpr0, $sgpr1, $sgpr4, $vgpr0, $vgpr1
43     $sgpr2 = S_LOAD_DWORD_IMM $sgpr0_sgpr1, 0, 0
44     S_WAITCNT 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
47     S_ENDPGM 0
48 ...
50 # GCN-LABEL: name: hazard_smem_war_independent_salu
51 # GCN:      S_LOAD_DWORD_IMM
52 # GCN-NEXT: S_WAITCNT
53 # GCN-NEXT: S_ADD_U32
54 # GCN-NEXT: V_CMP_EQ_F32
55 ---
56 name: hazard_smem_war_independent_salu
57 body: |
58   bb.0:
59     liveins: $sgpr0, $sgpr1, $sgpr4, $sgpr5, $vgpr0, $vgpr1
60     $sgpr2 = S_LOAD_DWORD_IMM $sgpr0_sgpr1, 0, 0
61     S_WAITCNT 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
64     S_ENDPGM 0
65 ...
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
72 ---
73 name: hazard_smem_war_only_smem
74 body: |
75   bb.0:
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
80     S_ENDPGM 0
81 ...
83 # GCN-LABEL: name: hazard_smem_war_only_waitcnt_0
84 # GCN:      S_LOAD_DWORD_IMM
85 # GCN-NEXT: S_WAITCNT
86 # GCN-NEXT: V_CMP_EQ_F32
87 ---
88 name: hazard_smem_war_only_waitcnt_0
89 body: |
90   bb.0:
91     liveins: $sgpr0, $sgpr1, $vgpr0, $vgpr1
92     $sgpr2 = S_LOAD_DWORD_IMM $sgpr0_sgpr1, 0, 0
93     S_WAITCNT 0
94     $sgpr0_sgpr1 = V_CMP_EQ_F32_e64 0, $vgpr0, 0, $vgpr1, 1, implicit $mode, implicit $exec
95     S_ENDPGM 0
96 ...
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
105 body: |
106   bb.0:
107     liveins: $sgpr0, $sgpr1, $vgpr0, $vgpr1
108     $sgpr2 = S_LOAD_DWORD_IMM $sgpr0_sgpr1, 0, 0
109     S_WAITCNT 3952
110     $sgpr0_sgpr1 = V_CMP_EQ_F32_e64 0, $vgpr0, 0, $vgpr1, 1, implicit $mode, implicit $exec
111     S_ENDPGM 0
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
121 body: |
122   bb.0:
123     liveins: $sgpr0, $sgpr1, $vgpr0, $vgpr1
124     $sgpr2 = S_LOAD_DWORD_IMM $sgpr0_sgpr1, 0, 0
125     S_WAITCNT 53007
126     $sgpr0_sgpr1 = V_CMP_EQ_F32_e64 0, $vgpr0, 0, $vgpr1, 1, implicit $mode, implicit $exec
127     S_ENDPGM 0
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
136 body: |
137   bb.0:
138     liveins: $sgpr0, $sgpr1, $vgpr0, $vgpr1
139     $sgpr2 = S_LOAD_DWORD_IMM $sgpr0_sgpr1, 0, 0
140     S_WAITCNT 49279
141     $sgpr0_sgpr1 = V_CMP_EQ_F32_e64 0, $vgpr0, 0, $vgpr1, 1, implicit $mode, implicit $exec
142     S_ENDPGM 0
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
151 body: |
152   bb.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
157     S_ENDPGM 0
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
167 body: |
168   bb.0:
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
173     S_ENDPGM 0
176 # GCN-LABEL: name: hazard_smem_war_branch
177 # GCN:   S_LOAD_DWORD_IMM
178 # GFX10: $sgpr_null = S_MOV_B32 0
179 # GCN:   V_CMP_EQ_F32
181 name: hazard_smem_war_branch
182 body: |
183   bb.0:
184     liveins: $sgpr0, $sgpr1, $sgpr4, $vgpr0, $vgpr1
185     successors: %bb.1
186     $sgpr2 = S_LOAD_DWORD_IMM $sgpr0_sgpr1, 0, 0
187     S_BRANCH %bb.1
189   bb.1:
190     liveins: $sgpr0, $sgpr1, $sgpr2, $vgpr0, $vgpr1
191     $sgpr0_sgpr1 = V_CMP_EQ_F32_e64 0, $vgpr0, 0, $vgpr1, 1, implicit $mode, implicit $exec
192     S_ENDPGM 0
195 # GCN-LABEL: name: hazard_smem_war_cbranch
196 # GCN:       S_AND_B64
197 # GCN:       S_LOAD_DWORD_IMM
198 # GCN:       S_CBRANCH_VCCZ
199 # GFX10-NOT: $sgpr_null = S_MOV_B32 0
200 # GCN:       V_CMP_EQ_F32
201 # GCN:       S_ENDPGM 0
202 # GFX10:     $sgpr_null = S_MOV_B32 0
203 # GCN:       V_CMP_EQ_F32
205 name: hazard_smem_war_cbranch
206 body: |
207   bb.0:
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
214   bb.1:
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
217     S_ENDPGM 0
219   bb.2:
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
222     S_ENDPGM 0
225 # GCN-LABEL: name: hazard_smem_war_cbranch_carry
226 # GCN:       S_AND_B64
227 # GCN:       S_LOAD_DWORD_IMM
228 # GCN:       S_CBRANCH_VCCZ
229 # GFX10-NOT: $sgpr_null = S_MOV_B32 0
230 # GCN:       V_CMP_EQ_F32
231 # GCN-NEXT:  S_ENDPGM 0
232 # GFX10-NOT: $sgpr_null = S_MOV_B32 0
233 # GCN:       V_CMP_EQ_F32
234 # GFX10:     $sgpr_null = S_MOV_B32 0
235 # GCN:       V_CMP_EQ_F32
237 name: hazard_smem_war_cbranch_carry
238 body: |
239   bb.0:
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
246   bb.1:
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
249     S_ENDPGM 0
251   bb.2:
252     successors: %bb.3
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
256   bb.3:
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
259     S_ENDPGM 0
262 # GCN-LABEL: name: hazard_smem_war_backedge
263 # GFX10: $sgpr_null = S_MOV_B32 0
264 # GCN:   V_CMP_EQ_F32
265 # GCN:   S_LOAD_DWORD_IMM
267 name: hazard_smem_war_backedge
268 body: |
269   bb.0:
270     liveins: $sgpr0, $sgpr1, $sgpr2, $vgpr0, $vgpr1
271     successors: %bb.1
272     $sgpr0_sgpr1 = V_CMP_EQ_F32_e64 0, $vgpr0, 0, $vgpr1, 1, implicit $mode, implicit $exec
274   bb.1:
275     liveins: $sgpr0, $sgpr1, $sgpr2, $vgpr0, $vgpr1
276     $sgpr2 = S_LOAD_DWORD_IMM $sgpr0_sgpr1, 0, 0
277     S_BRANCH %bb.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
286 body: |
287   bb.0:
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
291     S_ENDPGM 0
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
300 body: |
301   bb.0:
302     liveins: $sgpr0, $sgpr1, $sgpr3, $vgpr0
303     $sgpr2 = S_LOAD_DWORD_IMM $sgpr0_sgpr1, 0, 0
304     $sgpr0 = V_READLANE_B32 $vgpr0, $sgpr3
305     S_ENDPGM 0
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
314 body: |
315   bb.0:
316     liveins: $sgpr0, $sgpr1, $vgpr0
317     $sgpr2 = S_LOAD_DWORD_IMM $sgpr0_sgpr1, 0, 0
318     $sgpr0 = V_READFIRSTLANE_B32 $vgpr0, implicit $exec
319     S_ENDPGM 0