[InstCombine] Signed saturation patterns
[llvm-complete.git] / test / CodeGen / AMDGPU / memory-legalizer-atomic-fence.ll
blob52635d006585f42ccceff203173dc78dff4426b0
1 ; RUN: llc -mtriple=amdgcn-amd- -mcpu=gfx600 -verify-machineinstrs < %s | FileCheck -check-prefixes=FUNC,GCN,GFX6,GFX68 %s
2 ; RUN: llc -mtriple=amdgcn-amd- -mcpu=gfx803 -verify-machineinstrs < %s | FileCheck -check-prefixes=FUNC,GCN,GFX8,GFX68 %s
3 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx803 -verify-machineinstrs < %s | FileCheck -check-prefixes=FUNC,GCN,GFX8,GFX68 %s
4 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 -mattr=+code-object-v3 -verify-machineinstrs < %s | FileCheck -check-prefixes=FUNC,GCN,GFX10,GFX10WGP %s
5 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 -mattr=+code-object-v3,+cumode -verify-machineinstrs < %s | FileCheck -check-prefixes=FUNC,GCN,GFX10,GFX10CU %s
7 ; FUNC-LABEL: {{^}}system_one_as_acquire:
8 ; GCN:        %bb.0
9 ; GCN-NOT:    ATOMIC_FENCE
10 ; GFX6:       s_waitcnt vmcnt(0){{$}}
11 ; GFX6-NEXT:  buffer_wbinvl1{{$}}
12 ; GFX8:       s_waitcnt vmcnt(0){{$}}
13 ; GFX8-NEXT:  buffer_wbinvl1_vol{{$}}
14 ; GFX10:      s_waitcnt vmcnt(0){{$}}
15 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0{{$}}
16 ; GFX10-NEXT: buffer_gl0_inv{{$}}
17 ; GFX10-NEXT: buffer_gl1_inv{{$}}
18 ; GCN:        s_endpgm
19 ; GFX10:         .amdhsa_kernel system_one_as_acquire
20 ; GFX10WGP-NOT:  .amdhsa_workgroup_processor_mode 0
21 ; GFX10CU:       .amdhsa_workgroup_processor_mode 0
22 ; GFX10-NOT:     .amdhsa_memory_ordered 0
23 define amdgpu_kernel void @system_one_as_acquire() {
24 entry:
25   fence syncscope("one-as") acquire
26   ret void
29 ; FUNC-LABEL: {{^}}system_one_as_release:
30 ; GCN:        %bb.0
31 ; GCN-NOT:    ATOMIC_FENCE
32 ; GCN:        s_waitcnt vmcnt(0){{$}}
33 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0{{$}}
34 ; GCN:        s_endpgm
35 ; GFX10:         .amdhsa_kernel system_one_as_release
36 ; GFX10WGP-NOT:  .amdhsa_workgroup_processor_mode 0
37 ; GFX10CU:       .amdhsa_workgroup_processor_mode 0
38 ; GFX10-NOT:     .amdhsa_memory_ordered 0
39 define amdgpu_kernel void @system_one_as_release() {
40 entry:
41   fence syncscope("one-as") release
42   ret void
45 ; FUNC-LABEL: {{^}}system_one_as_acq_rel:
46 ; GCN:        %bb.0
47 ; GCN-NOT:    ATOMIC_FENCE
48 ; GCN:        s_waitcnt vmcnt(0){{$}}
49 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0{{$}}
50 ; GFX6:       buffer_wbinvl1{{$}}
51 ; GFX8:       buffer_wbinvl1_vol{{$}}
52 ; GFX10-NEXT: buffer_gl0_inv{{$}}
53 ; GFX10-NEXT: buffer_gl1_inv{{$}}
54 ; GCN:        s_endpgm
55 ; GFX10:         .amdhsa_kernel system_one_as_acq_rel
56 ; GFX10WGP-NOT:  .amdhsa_workgroup_processor_mode 0
57 ; GFX10CU:       .amdhsa_workgroup_processor_mode 0
58 ; GFX10-NOT:     .amdhsa_memory_ordered 0
59 define amdgpu_kernel void @system_one_as_acq_rel() {
60 entry:
61   fence syncscope("one-as") acq_rel
62   ret void
65 ; FUNC-LABEL: {{^}}system_one_as_seq_cst:
66 ; GCN:        %bb.0
67 ; GCN-NOT:    ATOMIC_FENCE
68 ; GCN:        s_waitcnt vmcnt(0){{$}}
69 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0{{$}}
70 ; GFX6:       buffer_wbinvl1{{$}}
71 ; GFX8:       buffer_wbinvl1_vol{{$}}
72 ; GFX10-NEXT: buffer_gl0_inv{{$}}
73 ; GFX10-NEXT: buffer_gl1_inv{{$}}
74 ; GCN:        s_endpgm
75 ; GFX10:         .amdhsa_kernel system_one_as_seq_cst
76 ; GFX10WGP-NOT:  .amdhsa_workgroup_processor_mode 0
77 ; GFX10CU:       .amdhsa_workgroup_processor_mode 0
78 ; GFX10-NOT:     .amdhsa_memory_ordered 0
79 define amdgpu_kernel void @system_one_as_seq_cst() {
80 entry:
81   fence syncscope("one-as") seq_cst
82   ret void
85 ; FUNC-LABEL: {{^}}singlethread_one_as_acquire:
86 ; GCN:        %bb.0
87 ; GCN-NOT:    ATOMIC_FENCE
88 ; GCN:        s_endpgm
89 ; GFX10:         .amdhsa_kernel singlethread_one_as_acquire
90 ; GFX10WGP-NOT:  .amdhsa_workgroup_processor_mode 0
91 ; GFX10CU:       .amdhsa_workgroup_processor_mode 0
92 ; GFX10-NOT:     .amdhsa_memory_ordered 0
93 define amdgpu_kernel void @singlethread_one_as_acquire() {
94 entry:
95   fence syncscope("singlethread-one-as") acquire
96   ret void
99 ; FUNC-LABEL: {{^}}singlethread_one_as_release:
100 ; GCN:        %bb.0
101 ; GCN-NOT:    ATOMIC_FENCE
102 ; GCN:        s_endpgm
103 ; GFX10:         .amdhsa_kernel singlethread_one_as_release
104 ; GFX10WGP-NOT:  .amdhsa_workgroup_processor_mode 0
105 ; GFX10CU:       .amdhsa_workgroup_processor_mode 0
106 ; GFX10-NOT:     .amdhsa_memory_ordered 0
107 define amdgpu_kernel void @singlethread_one_as_release() {
108 entry:
109   fence syncscope("singlethread-one-as") release
110   ret void
113 ; FUNC-LABEL: {{^}}singlethread_one_as_acq_rel:
114 ; GCN:        %bb.0
115 ; GCN-NOT:    ATOMIC_FENCE
116 ; GCN:        s_endpgm
117 ; GFX10:         .amdhsa_kernel singlethread_one_as_acq_rel
118 ; GFX10WGP-NOT:  .amdhsa_workgroup_processor_mode 0
119 ; GFX10CU:       .amdhsa_workgroup_processor_mode 0
120 ; GFX10-NOT:     .amdhsa_memory_ordered 0
121 define amdgpu_kernel void @singlethread_one_as_acq_rel() {
122 entry:
123   fence syncscope("singlethread-one-as") acq_rel
124   ret void
127 ; FUNC-LABEL: {{^}}singlethread_one_as_seq_cst:
128 ; GCN:        %bb.0
129 ; GCN-NOT:    ATOMIC_FENCE
130 ; GCN:        s_endpgm
131 ; GFX10:         .amdhsa_kernel singlethread_one_as_seq_cst
132 ; GFX10WGP-NOT:  .amdhsa_workgroup_processor_mode 0
133 ; GFX10CU:       .amdhsa_workgroup_processor_mode 0
134 ; GFX10-NOT:     .amdhsa_memory_ordered 0
135 define amdgpu_kernel void @singlethread_one_as_seq_cst() {
136 entry:
137   fence syncscope("singlethread-one-as") seq_cst
138   ret void
141 ; FUNC-LABEL: {{^}}agent_one_as_acquire:
142 ; GCN:        %bb.0
143 ; GCN-NOT:    ATOMIC_FENCE
144 ; GFX6:       s_waitcnt vmcnt(0){{$}}
145 ; GFX6-NEXT:  buffer_wbinvl1{{$}}
146 ; GFX8:       s_waitcnt vmcnt(0){{$}}
147 ; GFX8-NEXT:  buffer_wbinvl1_vol{{$}}
148 ; GFX10:      s_waitcnt vmcnt(0){{$}}
149 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0{{$}}
150 ; GFX10-NEXT: buffer_gl0_inv{{$}}
151 ; GFX10-NEXT: buffer_gl1_inv{{$}}
152 ; GCN:        s_endpgm
153 ; GFX10:         .amdhsa_kernel agent_one_as_acquire
154 ; GFX10WGP-NOT:  .amdhsa_workgroup_processor_mode 0
155 ; GFX10CU:       .amdhsa_workgroup_processor_mode 0
156 ; GFX10-NOT:     .amdhsa_memory_ordered 0
157 define amdgpu_kernel void @agent_one_as_acquire() {
158 entry:
159   fence syncscope("agent-one-as") acquire
160   ret void
163 ; FUNC-LABEL: {{^}}agent_one_as_release:
164 ; GCN:        %bb.0
165 ; GCN-NOT:    ATOMIC_FENCE
166 ; GCN:        s_waitcnt vmcnt(0){{$}}
167 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0{{$}}
168 ; GCN:        s_endpgm
169 ; GFX10:         .amdhsa_kernel agent_one_as_release
170 ; GFX10WGP-NOT:  .amdhsa_workgroup_processor_mode 0
171 ; GFX10CU:       .amdhsa_workgroup_processor_mode 0
172 ; GFX10-NOT:     .amdhsa_memory_ordered 0
173 define amdgpu_kernel void @agent_one_as_release() {
174 entry:
175   fence syncscope("agent-one-as") release
176   ret void
179 ; FUNC-LABEL: {{^}}agent_one_as_acq_rel:
180 ; GCN:        %bb.0
181 ; GCN-NOT:    ATOMIC_FENCE
182 ; GCN:        s_waitcnt vmcnt(0){{$}}
183 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0{{$}}
184 ; GFX6:       buffer_wbinvl1{{$}}
185 ; GFX8:       buffer_wbinvl1_vol{{$}}
186 ; GFX10-NEXT: buffer_gl0_inv{{$}}
187 ; GFX10-NEXT: buffer_gl1_inv{{$}}
188 ; GCN:        s_endpgm
189 ; GFX10:         .amdhsa_kernel agent_one_as_acq_rel
190 ; GFX10WGP-NOT:  .amdhsa_workgroup_processor_mode 0
191 ; GFX10CU:       .amdhsa_workgroup_processor_mode 0
192 ; GFX10-NOT:     .amdhsa_memory_ordered 0
193 define amdgpu_kernel void @agent_one_as_acq_rel() {
194 entry:
195   fence syncscope("agent-one-as") acq_rel
196   ret void
199 ; FUNC-LABEL: {{^}}agent_one_as_seq_cst:
200 ; GCN:        %bb.0
201 ; GCN-NOT:    ATOMIC_FENCE
202 ; GCN:        s_waitcnt vmcnt(0){{$}}
203 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0{{$}}
204 ; GFX6:       buffer_wbinvl1{{$}}
205 ; GFX8:       buffer_wbinvl1_vol{{$}}
206 ; GFX10-NEXT: buffer_gl0_inv{{$}}
207 ; GFX10-NEXT: buffer_gl1_inv{{$}}
208 ; GCN:        s_endpgm
209 ; GFX10:         .amdhsa_kernel agent_one_as_seq_cst
210 ; GFX10WGP-NOT:  .amdhsa_workgroup_processor_mode 0
211 ; GFX10CU:       .amdhsa_workgroup_processor_mode 0
212 ; GFX10-NOT:     .amdhsa_memory_ordered 0
213 define amdgpu_kernel void @agent_one_as_seq_cst() {
214 entry:
215   fence syncscope("agent-one-as") seq_cst
216   ret void
219 ; FUNC-LABEL:    {{^}}workgroup_one_as_acquire:
220 ; GCN:           %bb.0
221 ; GFX68-NOT:     s_waitcnt vmcnt(0){{$}}
222 ; GFX10WGP:      s_waitcnt vmcnt(0){{$}}
223 ; GFX10WGP-NEXT: s_waitcnt_vscnt null, 0x0{{$}}
224 ; GFX10CU-NOT:   s_waitcnt vmcnt(0){{$}}
225 ; GFX10CU-NOT:   s_waitcnt_vscnt null, 0x0{{$}}
226 ; GFX10WGP-NEXT: buffer_gl0_inv{{$}}
227 ; GFX10CU-NOT:   buffer_gl0_inv{{$}}
228 ; GCN-NOT:       ATOMIC_FENCE
229 ; GCN:           s_endpgm
230 ; GFX10:         .amdhsa_kernel workgroup_one_as_acquire
231 ; GFX10WGP-NOT:  .amdhsa_workgroup_processor_mode 0
232 ; GFX10CU:       .amdhsa_workgroup_processor_mode 0
233 ; GFX10-NOT:     .amdhsa_memory_ordered 0
234 define amdgpu_kernel void @workgroup_one_as_acquire() {
235 entry:
236   fence syncscope("workgroup-one-as") acquire
237   ret void
240 ; FUNC-LABEL:    {{^}}workgroup_one_as_release:
241 ; GCN:           %bb.0
242 ; GFX68-NOT:     s_waitcnt vmcnt(0){{$}}
243 ; GFX10WGP:      s_waitcnt vmcnt(0){{$}}
244 ; GFX10WGP-NEXT: s_waitcnt_vscnt null, 0x0{{$}}
245 ; GFX10CU-NOT:   s_waitcnt vmcnt(0){{$}}
246 ; GFX10CU-NOT:   s_waitcnt_vscnt null, 0x0{{$}}
247 ; GFX10-NOT:     buffer_gl0_inv
248 ; GCN-NOT:       ATOMIC_FENCE
249 ; GCN:           s_endpgm
250 ; GFX10:         .amdhsa_kernel workgroup_one_as_release
251 ; GFX10WGP-NOT:  .amdhsa_workgroup_processor_mode 0
252 ; GFX10CU:       .amdhsa_workgroup_processor_mode 0
253 ; GFX10-NOT:     .amdhsa_memory_ordered 0
254 define amdgpu_kernel void @workgroup_one_as_release() {
255 entry:
256   fence syncscope("workgroup-one-as") release
257   ret void
260 ; FUNC-LABEL:    {{^}}workgroup_one_as_acq_rel:
261 ; GCN:           %bb.0
262 ; GFX68-NOT:     s_waitcnt vmcnt(0){{$}}
263 ; GFX10WGP:      s_waitcnt vmcnt(0){{$}}
264 ; GFX10WGP-NEXT: s_waitcnt_vscnt null, 0x0{{$}}
265 ; GFX10WGP-NEXT: buffer_gl0_inv{{$}}
266 ; GFX10CU-NOT:   s_waitcnt vmcnt(0){{$}}
267 ; GFX10CU-NOT:   s_waitcnt_vscnt null, 0x0{{$}}
268 ; GFX10CU-NOT:   buffer_gl0_inv{{$}}
269 ; GCN-NOT:       ATOMIC_FENCE
270 ; GCN:           s_endpgm
271 ; GFX10:         .amdhsa_kernel workgroup_one_as_acq_rel
272 ; GFX10WGP-NOT:  .amdhsa_workgroup_processor_mode 0
273 ; GFX10CU:       .amdhsa_workgroup_processor_mode 0
274 ; GFX10-NOT:     .amdhsa_memory_ordered 0
275 define amdgpu_kernel void @workgroup_one_as_acq_rel() {
276 entry:
277   fence syncscope("workgroup-one-as") acq_rel
278   ret void
281 ; FUNC-LABEL:    {{^}}workgroup_one_as_seq_cst:
282 ; GCN:           %bb.0
283 ; GFX68-NOT:     s_waitcnt vmcnt(0){{$}}
284 ; GFX10WGP:      s_waitcnt vmcnt(0){{$}}
285 ; GFX10WGP-NEXT: s_waitcnt_vscnt null, 0x0{{$}}
286 ; GFX10WGP-NEXT: buffer_gl0_inv{{$}}
287 ; GFX10CU-NOT:   s_waitcnt vmcnt(0){{$}}
288 ; GFX10CU-NOT:   s_waitcnt_vscnt null, 0x0{{$}}
289 ; GFX10CU-NOT:   buffer_gl0_inv{{$}}
290 ; GCN-NOT:       ATOMIC_FENCE
291 ; GCN:           s_endpgm
292 ; GFX10:         .amdhsa_kernel workgroup_one_as_seq_cst
293 ; GFX10WGP-NOT:  .amdhsa_workgroup_processor_mode 0
294 ; GFX10CU:       .amdhsa_workgroup_processor_mode 0
295 ; GFX10-NOT:     .amdhsa_memory_ordered 0
296 define amdgpu_kernel void @workgroup_one_as_seq_cst() {
297 entry:
298   fence syncscope("workgroup-one-as") seq_cst
299   ret void
302 ; FUNC-LABEL: {{^}}wavefront_one_as_acquire:
303 ; GCN:        %bb.0
304 ; GCN-NOT:    ATOMIC_FENCE
305 ; GCN:        s_endpgm
306 ; GFX10:         .amdhsa_kernel wavefront_one_as_acquire
307 ; GFX10WGP-NOT:  .amdhsa_workgroup_processor_mode 0
308 ; GFX10CU:       .amdhsa_workgroup_processor_mode 0
309 ; GFX10-NOT:     .amdhsa_memory_ordered 0
310 define amdgpu_kernel void @wavefront_one_as_acquire() {
311 entry:
312   fence syncscope("wavefront-one-as") acquire
313   ret void
316 ; FUNC-LABEL: {{^}}wavefront_one_as_release:
317 ; GCN:        %bb.0
318 ; GCN-NOT:    ATOMIC_FENCE
319 ; GCN:        s_endpgm
320 ; GFX10:         .amdhsa_kernel wavefront_one_as_release
321 ; GFX10WGP-NOT:  .amdhsa_workgroup_processor_mode 0
322 ; GFX10CU:       .amdhsa_workgroup_processor_mode 0
323 ; GFX10-NOT:     .amdhsa_memory_ordered 0
324 define amdgpu_kernel void @wavefront_one_as_release() {
325 entry:
326   fence syncscope("wavefront-one-as") release
327   ret void
330 ; FUNC-LABEL: {{^}}wavefront_one_as_acq_rel:
331 ; GCN:        %bb.0
332 ; GCN-NOT:    ATOMIC_FENCE
333 ; GCN:        s_endpgm
334 ; GFX10:         .amdhsa_kernel wavefront_one_as_acq_rel
335 ; GFX10WGP-NOT:  .amdhsa_workgroup_processor_mode 0
336 ; GFX10CU:       .amdhsa_workgroup_processor_mode 0
337 ; GFX10-NOT:     .amdhsa_memory_ordered 0
338 define amdgpu_kernel void @wavefront_one_as_acq_rel() {
339 entry:
340   fence syncscope("wavefront-one-as") acq_rel
341   ret void
344 ; FUNC-LABEL: {{^}}wavefront_one_as_seq_cst:
345 ; GCN:        %bb.0
346 ; GCN-NOT:    ATOMIC_FENCE
347 ; GCN:        s_endpgm
348 ; GFX10:         .amdhsa_kernel wavefront_one_as_seq_cst
349 ; GFX10WGP-NOT:  .amdhsa_workgroup_processor_mode 0
350 ; GFX10CU:       .amdhsa_workgroup_processor_mode 0
351 ; GFX10-NOT:     .amdhsa_memory_ordered 0
352 define amdgpu_kernel void @wavefront_one_as_seq_cst() {
353 entry:
354   fence syncscope("wavefront-one-as") seq_cst
355   ret void
358 ; FUNC-LABEL: {{^}}system_acquire:
359 ; GCN:        %bb.0
360 ; GCN-NOT:    ATOMIC_FENCE
361 ; GFX6:       s_waitcnt vmcnt(0) lgkmcnt(0){{$}}
362 ; GFX6-NEXT:  buffer_wbinvl1{{$}}
363 ; GFX8:       s_waitcnt vmcnt(0) lgkmcnt(0){{$}}
364 ; GFX8-NEXT:  buffer_wbinvl1_vol{{$}}
365 ; GFX10:      s_waitcnt vmcnt(0) lgkmcnt(0){{$}}
366 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0{{$}}
367 ; GFX10-NEXT: buffer_gl0_inv{{$}}
368 ; GFX10-NEXT: buffer_gl1_inv{{$}}
369 ; GCN:        s_endpgm
370 ; GFX10:         .amdhsa_kernel system_acquire
371 ; GFX10WGP-NOT:  .amdhsa_workgroup_processor_mode 0
372 ; GFX10CU:       .amdhsa_workgroup_processor_mode 0
373 ; GFX10-NOT:     .amdhsa_memory_ordered 0
374 define amdgpu_kernel void @system_acquire() {
375 entry:
376   fence acquire
377   ret void
380 ; FUNC-LABEL: {{^}}system_release:
381 ; GCN:        %bb.0
382 ; GCN-NOT:    ATOMIC_FENCE
383 ; GFX6:       s_waitcnt vmcnt(0) lgkmcnt(0){{$}}
384 ; GFX8:       s_waitcnt vmcnt(0) lgkmcnt(0){{$}}
385 ; GFX10:      s_waitcnt vmcnt(0) lgkmcnt(0){{$}}
386 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0{{$}}
387 ; GCN:        s_endpgm
388 ; GFX10:         .amdhsa_kernel system_release
389 ; GFX10WGP-NOT:  .amdhsa_workgroup_processor_mode 0
390 ; GFX10CU:       .amdhsa_workgroup_processor_mode 0
391 ; GFX10-NOT:     .amdhsa_memory_ordered 0
392 define amdgpu_kernel void @system_release() {
393 entry:
394   fence release
395   ret void
398 ; FUNC-LABEL: {{^}}system_acq_rel:
399 ; GCN:        %bb.0
400 ; GCN-NOT:    ATOMIC_FENCE
401 ; GFX6:       s_waitcnt vmcnt(0) lgkmcnt(0){{$}}
402 ; GFX8:       s_waitcnt vmcnt(0) lgkmcnt(0){{$}}
403 ; GFX10:      s_waitcnt vmcnt(0) lgkmcnt(0){{$}}
404 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0{{$}}
405 ; GFX6:       buffer_wbinvl1{{$}}
406 ; GFX8:       buffer_wbinvl1_vol{{$}}
407 ; GFX10-NEXT: buffer_gl0_inv{{$}}
408 ; GFX10-NEXT: buffer_gl1_inv{{$}}
409 ; GCN:        s_endpgm
410 ; GFX10:         .amdhsa_kernel system_acq_rel
411 ; GFX10WGP-NOT:  .amdhsa_workgroup_processor_mode 0
412 ; GFX10CU:       .amdhsa_workgroup_processor_mode 0
413 ; GFX10-NOT:     .amdhsa_memory_ordered 0
414 define amdgpu_kernel void @system_acq_rel() {
415 entry:
416   fence acq_rel
417   ret void
420 ; FUNC-LABEL: {{^}}system_seq_cst:
421 ; GCN:        %bb.0
422 ; GCN-NOT:    ATOMIC_FENCE
423 ; GFX6:       s_waitcnt vmcnt(0) lgkmcnt(0){{$}}
424 ; GFX8:       s_waitcnt vmcnt(0) lgkmcnt(0){{$}}
425 ; GFX10:      s_waitcnt vmcnt(0) lgkmcnt(0){{$}}
426 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0{{$}}
427 ; GFX6:       buffer_wbinvl1{{$}}
428 ; GFX8:       buffer_wbinvl1_vol{{$}}
429 ; GFX10-NEXT: buffer_gl0_inv{{$}}
430 ; GFX10-NEXT: buffer_gl1_inv{{$}}
431 ; GCN:        s_endpgm
432 ; GFX10:         .amdhsa_kernel system_seq_cst
433 ; GFX10WGP-NOT:  .amdhsa_workgroup_processor_mode 0
434 ; GFX10CU:       .amdhsa_workgroup_processor_mode 0
435 ; GFX10-NOT:     .amdhsa_memory_ordered 0
436 define amdgpu_kernel void @system_seq_cst() {
437 entry:
438   fence seq_cst
439   ret void
442 ; FUNC-LABEL: {{^}}singlethread_acquire:
443 ; GCN:        %bb.0
444 ; GCN-NOT:    ATOMIC_FENCE
445 ; GCN:        s_endpgm
446 ; GFX10:         .amdhsa_kernel singlethread_acquire
447 ; GFX10WGP-NOT:  .amdhsa_workgroup_processor_mode 0
448 ; GFX10CU:       .amdhsa_workgroup_processor_mode 0
449 ; GFX10-NOT:     .amdhsa_memory_ordered 0
450 define amdgpu_kernel void @singlethread_acquire() {
451 entry:
452   fence syncscope("singlethread") acquire
453   ret void
456 ; FUNC-LABEL: {{^}}singlethread_release:
457 ; GCN:        %bb.0
458 ; GCN-NOT:    ATOMIC_FENCE
459 ; GCN:        s_endpgm
460 ; GFX10:         .amdhsa_kernel singlethread_release
461 ; GFX10WGP-NOT:  .amdhsa_workgroup_processor_mode 0
462 ; GFX10CU:       .amdhsa_workgroup_processor_mode 0
463 ; GFX10-NOT:     .amdhsa_memory_ordered 0
464 define amdgpu_kernel void @singlethread_release() {
465 entry:
466   fence syncscope("singlethread") release
467   ret void
470 ; FUNC-LABEL: {{^}}singlethread_acq_rel:
471 ; GCN:        %bb.0
472 ; GCN-NOT:    ATOMIC_FENCE
473 ; GCN:        s_endpgm
474 ; GFX10:         .amdhsa_kernel singlethread_acq_rel
475 ; GFX10WGP-NOT:  .amdhsa_workgroup_processor_mode 0
476 ; GFX10CU:       .amdhsa_workgroup_processor_mode 0
477 ; GFX10-NOT:     .amdhsa_memory_ordered 0
478 define amdgpu_kernel void @singlethread_acq_rel() {
479 entry:
480   fence syncscope("singlethread") acq_rel
481   ret void
484 ; FUNC-LABEL: {{^}}singlethread_seq_cst:
485 ; GCN:        %bb.0
486 ; GCN-NOT:    ATOMIC_FENCE
487 ; GCN:        s_endpgm
488 ; GFX10:         .amdhsa_kernel singlethread_seq_cst
489 ; GFX10WGP-NOT:  .amdhsa_workgroup_processor_mode 0
490 ; GFX10CU:       .amdhsa_workgroup_processor_mode 0
491 ; GFX10-NOT:     .amdhsa_memory_ordered 0
492 define amdgpu_kernel void @singlethread_seq_cst() {
493 entry:
494   fence syncscope("singlethread") seq_cst
495   ret void
498 ; FUNC-LABEL: {{^}}agent_acquire:
499 ; GCN:        %bb.0
500 ; GCN-NOT:    ATOMIC_FENCE
501 ; GFX6:       s_waitcnt vmcnt(0) lgkmcnt(0){{$}}
502 ; GFX6-NEXT:  buffer_wbinvl1{{$}}
503 ; GFX8:       s_waitcnt vmcnt(0) lgkmcnt(0){{$}}
504 ; GFX8-NEXT:  buffer_wbinvl1_vol{{$}}
505 ; GFX10:      s_waitcnt vmcnt(0) lgkmcnt(0){{$}}
506 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0{{$}}
507 ; GFX10-NEXT: buffer_gl0_inv{{$}}
508 ; GFX10-NEXT: buffer_gl1_inv{{$}}
509 ; GCN:        s_endpgm
510 ; GFX10:         .amdhsa_kernel agent_acquire
511 ; GFX10WGP-NOT:  .amdhsa_workgroup_processor_mode 0
512 ; GFX10CU:       .amdhsa_workgroup_processor_mode 0
513 ; GFX10-NOT:     .amdhsa_memory_ordered 0
514 define amdgpu_kernel void @agent_acquire() {
515 entry:
516   fence syncscope("agent") acquire
517   ret void
520 ; FUNC-LABEL: {{^}}agent_release:
521 ; GCN:        %bb.0
522 ; GCN-NOT:    ATOMIC_FENCE
523 ; GFX6:       s_waitcnt vmcnt(0) lgkmcnt(0){{$}}
524 ; GFX8:       s_waitcnt vmcnt(0) lgkmcnt(0){{$}}
525 ; GFX10:      s_waitcnt vmcnt(0) lgkmcnt(0){{$}}
526 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0{{$}}
527 ; GCN:        s_endpgm
528 ; GFX10:         .amdhsa_kernel agent_release
529 ; GFX10WGP-NOT:  .amdhsa_workgroup_processor_mode 0
530 ; GFX10CU:       .amdhsa_workgroup_processor_mode 0
531 ; GFX10-NOT:     .amdhsa_memory_ordered 0
532 define amdgpu_kernel void @agent_release() {
533 entry:
534   fence syncscope("agent") release
535   ret void
538 ; FUNC-LABEL: {{^}}agent_acq_rel:
539 ; GCN:        %bb.0
540 ; GCN-NOT:    ATOMIC_FENCE
541 ; GFX6:       s_waitcnt vmcnt(0) lgkmcnt(0){{$}}
542 ; GFX8:       s_waitcnt vmcnt(0) lgkmcnt(0){{$}}
543 ; GFX10:      s_waitcnt vmcnt(0) lgkmcnt(0){{$}}
544 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0{{$}}
545 ; GFX6:       buffer_wbinvl1{{$}}
546 ; GFX8:       buffer_wbinvl1_vol{{$}}
547 ; GFX10-NEXT: buffer_gl0_inv{{$}}
548 ; GFX10-NEXT: buffer_gl1_inv{{$}}
549 ; GCN:        s_endpgm
550 ; GFX10:         .amdhsa_kernel agent_acq_rel
551 ; GFX10WGP-NOT:  .amdhsa_workgroup_processor_mode 0
552 ; GFX10CU:       .amdhsa_workgroup_processor_mode 0
553 ; GFX10-NOT:     .amdhsa_memory_ordered 0
554 define amdgpu_kernel void @agent_acq_rel() {
555 entry:
556   fence syncscope("agent") acq_rel
557   ret void
560 ; FUNC-LABEL: {{^}}agent_seq_cst:
561 ; GCN:        %bb.0
562 ; GCN-NOT:    ATOMIC_FENCE
563 ; GFX6:       s_waitcnt vmcnt(0) lgkmcnt(0){{$}}
564 ; GFX8:       s_waitcnt vmcnt(0) lgkmcnt(0){{$}}
565 ; GFX10:      s_waitcnt vmcnt(0) lgkmcnt(0){{$}}
566 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0{{$}}
567 ; GFX6:       buffer_wbinvl1{{$}}
568 ; GFX8:       buffer_wbinvl1_vol{{$}}
569 ; GFX10-NEXT: buffer_gl0_inv{{$}}
570 ; GFX10-NEXT: buffer_gl1_inv{{$}}
571 ; GCN:        s_endpgm
572 ; GFX10:         .amdhsa_kernel agent_seq_cst
573 ; GFX10WGP-NOT:  .amdhsa_workgroup_processor_mode 0
574 ; GFX10CU:       .amdhsa_workgroup_processor_mode 0
575 ; GFX10-NOT:     .amdhsa_memory_ordered 0
576 define amdgpu_kernel void @agent_seq_cst() {
577 entry:
578   fence syncscope("agent") seq_cst
579   ret void
582 ; FUNC-LABEL:    {{^}}workgroup_acquire:
583 ; GCN:           %bb.0
584 ; GFX68-NOT:     s_waitcnt vmcnt(0){{$}}
585 ; GFX10WGP:      s_waitcnt vmcnt(0) lgkmcnt(0){{$}}
586 ; GFX10WGP-NEXT: s_waitcnt_vscnt null, 0x0{{$}}
587 ; GFX10CU-NOT:   s_waitcnt vmcnt(0){{$}}
588 ; GFX10CU-NOT:   s_waitcnt_vscnt null, 0x0{{$}}
589 ; GFX10WGP-NEXT: buffer_gl0_inv{{$}}
590 ; GFX10CU-NOT:   buffer_gl0_inv{{$}}
591 ; GCN-NOT:       ATOMIC_FENCE
592 ; GCN:           s_endpgm
593 ; GFX10:         .amdhsa_kernel workgroup_acquire
594 ; GFX10WGP-NOT:  .amdhsa_workgroup_processor_mode 0
595 ; GFX10CU:       .amdhsa_workgroup_processor_mode 0
596 ; GFX10-NOT:     .amdhsa_memory_ordered 0
597 define amdgpu_kernel void @workgroup_acquire() {
598 entry:
599   fence syncscope("workgroup") acquire
600   ret void
603 ; FUNC-LABEL:    {{^}}workgroup_release:
604 ; GCN:           %bb.0
605 ; GFX68-NOT:     s_waitcnt vmcnt(0){{$}}
606 ; GFX10WGP:      s_waitcnt vmcnt(0) lgkmcnt(0){{$}}
607 ; GFX10WGP-NEXT: s_waitcnt_vscnt null, 0x0{{$}}
608 ; GFX10CU-NOT:   s_waitcnt vmcnt(0){{$}}
609 ; GFX10CU-NOT:   s_waitcnt_vscnt null, 0x0{{$}}
610 ; GFX10-NOT:     buffer_gl0_inv
611 ; GCN-NOT:       ATOMIC_FENCE
612 ; GCN:           s_endpgm
613 ; GFX10:         .amdhsa_kernel workgroup_release
614 ; GFX10WGP-NOT:  .amdhsa_workgroup_processor_mode 0
615 ; GFX10CU:       .amdhsa_workgroup_processor_mode 0
616 ; GFX10-NOT:     .amdhsa_memory_ordered 0
617 define amdgpu_kernel void @workgroup_release() {
618 entry:
619   fence syncscope("workgroup") release
620   ret void
623 ; FUNC-LABEL:    {{^}}workgroup_acq_rel:
624 ; GCN:           %bb.0
625 ; GFX68-NOT:     s_waitcnt vmcnt(0){{$}}
626 ; GFX10WGP:      s_waitcnt vmcnt(0) lgkmcnt(0){{$}}
627 ; GFX10WGP-NEXT: s_waitcnt_vscnt null, 0x0{{$}}
628 ; GFX10WGP-NEXT: buffer_gl0_inv{{$}}
629 ; GFX10CU-NOT:   s_waitcnt vmcnt(0){{$}}
630 ; GFX10CU-NOT:   s_waitcnt_vscnt null, 0x0{{$}}
631 ; GFX10CU-NOT:   buffer_gl0_inv{{$}}
632 ; GCN-NOT:       ATOMIC_FENCE
633 ; GCN:           s_endpgm
634 ; GFX10:         .amdhsa_kernel workgroup_acq_rel
635 ; GFX10WGP-NOT:  .amdhsa_workgroup_processor_mode 0
636 ; GFX10CU:       .amdhsa_workgroup_processor_mode 0
637 ; GFX10-NOT:     .amdhsa_memory_ordered 0
638 define amdgpu_kernel void @workgroup_acq_rel() {
639 entry:
640   fence syncscope("workgroup") acq_rel
641   ret void
644 ; FUNC-LABEL:    {{^}}workgroup_seq_cst:
645 ; GCN:           %bb.0
646 ; GFX68-NOT:     s_waitcnt vmcnt(0){{$}}
647 ; GFX10WGP:      s_waitcnt vmcnt(0) lgkmcnt(0){{$}}
648 ; GFX10WGP-NEXT: s_waitcnt_vscnt null, 0x0{{$}}
649 ; GFX10WGP-NEXT: buffer_gl0_inv{{$}}
650 ; GFX10CU-NOT:   s_waitcnt vmcnt(0){{$}}
651 ; GFX10CU-NOT:   s_waitcnt_vscnt null, 0x0{{$}}
652 ; GFX10CU-NOT:   buffer_gl0_inv{{$}}
653 ; GCN-NOT:       ATOMIC_FENCE
654 ; GCN:           s_endpgm
655 ; GFX10:         .amdhsa_kernel workgroup_seq_cst
656 ; GFX10WGP-NOT:  .amdhsa_workgroup_processor_mode 0
657 ; GFX10CU:       .amdhsa_workgroup_processor_mode 0
658 ; GFX10-NOT:     .amdhsa_memory_ordered 0
659 define amdgpu_kernel void @workgroup_seq_cst() {
660 entry:
661   fence syncscope("workgroup") seq_cst
662   ret void
665 ; FUNC-LABEL: {{^}}wavefront_acquire:
666 ; GCN:        %bb.0
667 ; GCN-NOT:    ATOMIC_FENCE
668 ; GCN:        s_endpgm
669 ; GFX10:         .amdhsa_kernel wavefront_acquire
670 ; GFX10WGP-NOT:  .amdhsa_workgroup_processor_mode 0
671 ; GFX10CU:       .amdhsa_workgroup_processor_mode 0
672 ; GFX10-NOT:     .amdhsa_memory_ordered 0
673 define amdgpu_kernel void @wavefront_acquire() {
674 entry:
675   fence syncscope("wavefront") acquire
676   ret void
679 ; FUNC-LABEL: {{^}}wavefront_release:
680 ; GCN:        %bb.0
681 ; GCN-NOT:    ATOMIC_FENCE
682 ; GCN:        s_endpgm
683 ; GFX10:         .amdhsa_kernel wavefront_release
684 ; GFX10WGP-NOT:  .amdhsa_workgroup_processor_mode 0
685 ; GFX10CU:       .amdhsa_workgroup_processor_mode 0
686 ; GFX10-NOT:     .amdhsa_memory_ordered 0
687 define amdgpu_kernel void @wavefront_release() {
688 entry:
689   fence syncscope("wavefront") release
690   ret void
693 ; FUNC-LABEL: {{^}}wavefront_acq_rel:
694 ; GCN:        %bb.0
695 ; GCN-NOT:    ATOMIC_FENCE
696 ; GCN:        s_endpgm
697 ; GFX10:         .amdhsa_kernel wavefront_acq_rel
698 ; GFX10WGP-NOT:  .amdhsa_workgroup_processor_mode 0
699 ; GFX10CU:       .amdhsa_workgroup_processor_mode 0
700 ; GFX10-NOT:     .amdhsa_memory_ordered 0
701 define amdgpu_kernel void @wavefront_acq_rel() {
702 entry:
703   fence syncscope("wavefront") acq_rel
704   ret void
707 ; FUNC-LABEL: {{^}}wavefront_seq_cst:
708 ; GCN:        %bb.0
709 ; GCN-NOT:    ATOMIC_FENCE
710 ; GCN:        s_endpgm
711 ; GFX10:         .amdhsa_kernel wavefront_seq_cst
712 ; GFX10WGP-NOT:  .amdhsa_workgroup_processor_mode 0
713 ; GFX10CU:       .amdhsa_workgroup_processor_mode 0
714 ; GFX10-NOT:     .amdhsa_memory_ordered 0
715 define amdgpu_kernel void @wavefront_seq_cst() {
716 entry:
717   fence syncscope("wavefront") seq_cst
718   ret void