1 ; RUN: llc -mtriple=amdgcn--mesa3d -mcpu=gfx600 -verify-machineinstrs < %s | FileCheck -check-prefixes=FUNC,GCN %s
2 ; RUN: llc -mtriple=amdgcn--mesa3d -mcpu=gfx700 -verify-machineinstrs < %s | FileCheck -check-prefixes=FUNC,GCN %s
3 ; RUN: llc -mtriple=amdgcn--mesa3d -mcpu=gfx803 -verify-machineinstrs < %s | FileCheck -check-prefixes=FUNC,GCN %s
4 ; RUN: llc -mtriple=amdgcn--mesa3d -mcpu=gfx900 -verify-machineinstrs < %s | FileCheck -check-prefixes=FUNC,GCN %s
6 ; FUNC-LABEL: {{^}}system_one_as_acquire:
8 ; GCN-NOT: ATOMIC_FENCE
9 ; GCN: s_waitcnt vmcnt(0){{$}}
10 ; GCN-NEXT: buffer_wbinvl1{{$}}
12 define amdgpu_kernel void @system_one_as_acquire() {
14 fence syncscope("one-as") acquire
18 ; FUNC-LABEL: {{^}}system_one_as_release:
20 ; GCN-NOT: ATOMIC_FENCE
21 ; GCN: s_waitcnt vmcnt(0){{$}}
23 define amdgpu_kernel void @system_one_as_release() {
25 fence syncscope("one-as") release
29 ; FUNC-LABEL: {{^}}system_one_as_acq_rel:
31 ; GCN-NOT: ATOMIC_FENCE
32 ; GCN: s_waitcnt vmcnt(0){{$}}
33 ; GCN: buffer_wbinvl1{{$}}
35 define amdgpu_kernel void @system_one_as_acq_rel() {
37 fence syncscope("one-as") acq_rel
41 ; FUNC-LABEL: {{^}}system_one_as_seq_cst:
43 ; GCN-NOT: ATOMIC_FENCE
44 ; GCN: s_waitcnt vmcnt(0){{$}}
45 ; GCN: buffer_wbinvl1{{$}}
47 define amdgpu_kernel void @system_one_as_seq_cst() {
49 fence syncscope("one-as") seq_cst
53 ; FUNC-LABEL: {{^}}singlethread_one_as_acquire:
55 ; GCN-NOT: ATOMIC_FENCE
57 define amdgpu_kernel void @singlethread_one_as_acquire() {
59 fence syncscope("singlethread-one-as") acquire
63 ; FUNC-LABEL: {{^}}singlethread_one_as_release:
65 ; GCN-NOT: ATOMIC_FENCE
67 define amdgpu_kernel void @singlethread_one_as_release() {
69 fence syncscope("singlethread-one-as") release
73 ; FUNC-LABEL: {{^}}singlethread_one_as_acq_rel:
75 ; GCN-NOT: ATOMIC_FENCE
77 define amdgpu_kernel void @singlethread_one_as_acq_rel() {
79 fence syncscope("singlethread-one-as") acq_rel
83 ; FUNC-LABEL: {{^}}singlethread_one_as_seq_cst:
85 ; GCN-NOT: ATOMIC_FENCE
87 define amdgpu_kernel void @singlethread_one_as_seq_cst() {
89 fence syncscope("singlethread-one-as") seq_cst
93 ; FUNC-LABEL: {{^}}agent_one_as_acquire:
95 ; GCN-NOT: ATOMIC_FENCE
96 ; GCN: s_waitcnt vmcnt(0){{$}}
97 ; GCN-NEXT: buffer_wbinvl1{{$}}
99 define amdgpu_kernel void @agent_one_as_acquire() {
101 fence syncscope("agent-one-as") acquire
105 ; FUNC-LABEL: {{^}}agent_one_as_release:
107 ; GCN-NOT: ATOMIC_FENCE
108 ; GCN: s_waitcnt vmcnt(0){{$}}
110 define amdgpu_kernel void @agent_one_as_release() {
112 fence syncscope("agent-one-as") release
116 ; FUNC-LABEL: {{^}}agent_one_as_acq_rel:
118 ; GCN-NOT: ATOMIC_FENCE
119 ; GCN: s_waitcnt vmcnt(0){{$}}
120 ; GCN: buffer_wbinvl1{{$}}
122 define amdgpu_kernel void @agent_one_as_acq_rel() {
124 fence syncscope("agent-one-as") acq_rel
128 ; FUNC-LABEL: {{^}}agent_one_as_seq_cst:
130 ; GCN-NOT: ATOMIC_FENCE
131 ; GCN: s_waitcnt vmcnt(0){{$}}
132 ; GCN: buffer_wbinvl1{{$}}
134 define amdgpu_kernel void @agent_one_as_seq_cst() {
136 fence syncscope("agent-one-as") seq_cst
140 ; FUNC-LABEL: {{^}}workgroup_one_as_acquire:
142 ; GCN-NOT: s_waitcnt vmcnt(0){{$}}
143 ; GCN-NOT: ATOMIC_FENCE
145 define amdgpu_kernel void @workgroup_one_as_acquire() {
147 fence syncscope("workgroup-one-as") acquire
151 ; FUNC-LABEL: {{^}}workgroup_one_as_release:
153 ; GCN-NOT: s_waitcnt vmcnt(0){{$}}
154 ; GCN-NOT: ATOMIC_FENCE
156 define amdgpu_kernel void @workgroup_one_as_release() {
158 fence syncscope("workgroup-one-as") release
162 ; FUNC-LABEL: {{^}}workgroup_one_as_acq_rel:
164 ; GCN-NOT: s_waitcnt vmcnt(0){{$}}
165 ; GCN-NOT: ATOMIC_FENCE
167 define amdgpu_kernel void @workgroup_one_as_acq_rel() {
169 fence syncscope("workgroup-one-as") acq_rel
173 ; FUNC-LABEL: {{^}}workgroup_one_as_seq_cst:
175 ; GCN-NOT: s_waitcnt vmcnt(0){{$}}
176 ; GCN-NOT: ATOMIC_FENCE
178 define amdgpu_kernel void @workgroup_one_as_seq_cst() {
180 fence syncscope("workgroup-one-as") seq_cst
184 ; FUNC-LABEL: {{^}}wavefront_one_as_acquire:
186 ; GCN-NOT: ATOMIC_FENCE
188 define amdgpu_kernel void @wavefront_one_as_acquire() {
190 fence syncscope("wavefront-one-as") acquire
194 ; FUNC-LABEL: {{^}}wavefront_one_as_release:
196 ; GCN-NOT: ATOMIC_FENCE
198 define amdgpu_kernel void @wavefront_one_as_release() {
200 fence syncscope("wavefront-one-as") release
204 ; FUNC-LABEL: {{^}}wavefront_one_as_acq_rel:
206 ; GCN-NOT: ATOMIC_FENCE
208 define amdgpu_kernel void @wavefront_one_as_acq_rel() {
210 fence syncscope("wavefront-one-as") acq_rel
214 ; FUNC-LABEL: {{^}}wavefront_one_as_seq_cst:
216 ; GCN-NOT: ATOMIC_FENCE
218 define amdgpu_kernel void @wavefront_one_as_seq_cst() {
220 fence syncscope("wavefront-one-as") seq_cst
224 ; FUNC-LABEL: {{^}}system_acquire:
226 ; GCN-NOT: ATOMIC_FENCE
227 ; GCN: s_waitcnt vmcnt(0) lgkmcnt(0){{$}}
228 ; GCN-NEXT: buffer_wbinvl1{{$}}
230 define amdgpu_kernel void @system_acquire() {
236 ; FUNC-LABEL: {{^}}system_release:
238 ; GCN-NOT: ATOMIC_FENCE
239 ; GCN: s_waitcnt vmcnt(0) lgkmcnt(0){{$}}
241 define amdgpu_kernel void @system_release() {
247 ; FUNC-LABEL: {{^}}system_acq_rel:
249 ; GCN-NOT: ATOMIC_FENCE
250 ; GCN: s_waitcnt vmcnt(0) lgkmcnt(0){{$}}
251 ; GCN: buffer_wbinvl1{{$}}
253 define amdgpu_kernel void @system_acq_rel() {
259 ; FUNC-LABEL: {{^}}system_seq_cst:
261 ; GCN-NOT: ATOMIC_FENCE
262 ; GCN: s_waitcnt vmcnt(0) lgkmcnt(0){{$}}
263 ; GCN: buffer_wbinvl1{{$}}
265 define amdgpu_kernel void @system_seq_cst() {
271 ; FUNC-LABEL: {{^}}singlethread_acquire:
273 ; GCN-NOT: ATOMIC_FENCE
275 define amdgpu_kernel void @singlethread_acquire() {
277 fence syncscope("singlethread") acquire
281 ; FUNC-LABEL: {{^}}singlethread_release:
283 ; GCN-NOT: ATOMIC_FENCE
285 define amdgpu_kernel void @singlethread_release() {
287 fence syncscope("singlethread") release
291 ; FUNC-LABEL: {{^}}singlethread_acq_rel:
293 ; GCN-NOT: ATOMIC_FENCE
295 define amdgpu_kernel void @singlethread_acq_rel() {
297 fence syncscope("singlethread") acq_rel
301 ; FUNC-LABEL: {{^}}singlethread_seq_cst:
303 ; GCN-NOT: ATOMIC_FENCE
305 define amdgpu_kernel void @singlethread_seq_cst() {
307 fence syncscope("singlethread") seq_cst
311 ; FUNC-LABEL: {{^}}agent_acquire:
313 ; GCN-NOT: ATOMIC_FENCE
314 ; GCN: s_waitcnt vmcnt(0) lgkmcnt(0){{$}}
315 ; GCN-NEXT: buffer_wbinvl1{{$}}
317 define amdgpu_kernel void @agent_acquire() {
319 fence syncscope("agent") acquire
323 ; FUNC-LABEL: {{^}}agent_release:
325 ; GCN-NOT: ATOMIC_FENCE
326 ; GCN: s_waitcnt vmcnt(0) lgkmcnt(0){{$}}
328 define amdgpu_kernel void @agent_release() {
330 fence syncscope("agent") release
334 ; FUNC-LABEL: {{^}}agent_acq_rel:
336 ; GCN-NOT: ATOMIC_FENCE
337 ; GCN: s_waitcnt vmcnt(0) lgkmcnt(0){{$}}
338 ; GCN: buffer_wbinvl1{{$}}
340 define amdgpu_kernel void @agent_acq_rel() {
342 fence syncscope("agent") acq_rel
346 ; FUNC-LABEL: {{^}}agent_seq_cst:
348 ; GCN-NOT: ATOMIC_FENCE
349 ; GCN: s_waitcnt vmcnt(0) lgkmcnt(0){{$}}
350 ; GCN: buffer_wbinvl1{{$}}
352 define amdgpu_kernel void @agent_seq_cst() {
354 fence syncscope("agent") seq_cst
358 ; FUNC-LABEL: {{^}}workgroup_acquire:
360 ; GCN-NOT: s_waitcnt vmcnt(0) lgkmcnt(0){{$}}
361 ; GCN-NOT: ATOMIC_FENCE
363 define amdgpu_kernel void @workgroup_acquire() {
365 fence syncscope("workgroup") acquire
369 ; FUNC-LABEL: {{^}}workgroup_release:
371 ; GCN-NOT: s_waitcnt vmcnt(0) lgkmcnt(0){{$}}
372 ; GCN-NOT: ATOMIC_FENCE
374 define amdgpu_kernel void @workgroup_release() {
376 fence syncscope("workgroup") release
380 ; FUNC-LABEL: {{^}}workgroup_acq_rel:
382 ; GCN-NOT: s_waitcnt vmcnt(0) lgkmcnt(0){{$}}
383 ; GCN-NOT: ATOMIC_FENCE
385 define amdgpu_kernel void @workgroup_acq_rel() {
387 fence syncscope("workgroup") acq_rel
391 ; FUNC-LABEL: {{^}}workgroup_seq_cst:
393 ; GCN-NOT: s_waitcnt vmcnt(0) lgkmcnt(0){{$}}
394 ; GCN-NOT: ATOMIC_FENCE
396 define amdgpu_kernel void @workgroup_seq_cst() {
398 fence syncscope("workgroup") seq_cst
402 ; FUNC-LABEL: {{^}}wavefront_acquire:
404 ; GCN-NOT: ATOMIC_FENCE
406 define amdgpu_kernel void @wavefront_acquire() {
408 fence syncscope("wavefront") acquire
412 ; FUNC-LABEL: {{^}}wavefront_release:
414 ; GCN-NOT: ATOMIC_FENCE
416 define amdgpu_kernel void @wavefront_release() {
418 fence syncscope("wavefront") release
422 ; FUNC-LABEL: {{^}}wavefront_acq_rel:
424 ; GCN-NOT: ATOMIC_FENCE
426 define amdgpu_kernel void @wavefront_acq_rel() {
428 fence syncscope("wavefront") acq_rel
432 ; FUNC-LABEL: {{^}}wavefront_seq_cst:
434 ; GCN-NOT: ATOMIC_FENCE
436 define amdgpu_kernel void @wavefront_seq_cst() {
438 fence syncscope("wavefront") seq_cst