1 ; RUN: llc -mtriple=amdgcn-amd- -mcpu=gfx600 -verify-machineinstrs < %s | FileCheck -check-prefix=FUNC -check-prefix=GCN -check-prefix=GFX6 %s
2 ; RUN: llc -mtriple=amdgcn-amd- -mcpu=gfx803 -verify-machineinstrs < %s | FileCheck -check-prefix=FUNC -check-prefix=GCN -check-prefix=GFX8 %s
3 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx803 -verify-machineinstrs < %s | FileCheck -check-prefix=FUNC -check-prefix=GCN -check-prefix=GFX8 %s
5 ; FUNC-LABEL: {{^}}system_acquire
7 ; GCN-NOT: ATOMIC_FENCE
8 ; GFX6: s_waitcnt vmcnt(0){{$}}
9 ; GFX6-NEXT: buffer_wbinvl1{{$}}
10 ; GFX8: s_waitcnt vmcnt(0){{$}}
11 ; GFX8-NEXT: buffer_wbinvl1_vol{{$}}
13 define amdgpu_kernel void @system_acquire() {
19 ; FUNC-LABEL: {{^}}system_release
21 ; GCN-NOT: ATOMIC_FENCE
22 ; GCN: s_waitcnt vmcnt(0){{$}}
24 define amdgpu_kernel void @system_release() {
30 ; FUNC-LABEL: {{^}}system_acq_rel
32 ; GCN-NOT: ATOMIC_FENCE
33 ; GCN: s_waitcnt vmcnt(0){{$}}
34 ; GFX6: buffer_wbinvl1{{$}}
35 ; GFX8: buffer_wbinvl1_vol{{$}}
37 define amdgpu_kernel void @system_acq_rel() {
43 ; FUNC-LABEL: {{^}}system_seq_cst
45 ; GCN-NOT: ATOMIC_FENCE
46 ; GCN: s_waitcnt vmcnt(0){{$}}
47 ; GFX6: buffer_wbinvl1{{$}}
48 ; GFX8: buffer_wbinvl1_vol{{$}}
50 define amdgpu_kernel void @system_seq_cst() {
56 ; FUNC-LABEL: {{^}}singlethread_acquire
58 ; GCN-NOT: ATOMIC_FENCE
60 define amdgpu_kernel void @singlethread_acquire() {
62 fence syncscope("singlethread") acquire
66 ; FUNC-LABEL: {{^}}singlethread_release
68 ; GCN-NOT: ATOMIC_FENCE
70 define amdgpu_kernel void @singlethread_release() {
72 fence syncscope("singlethread") release
76 ; FUNC-LABEL: {{^}}singlethread_acq_rel
78 ; GCN-NOT: ATOMIC_FENCE
80 define amdgpu_kernel void @singlethread_acq_rel() {
82 fence syncscope("singlethread") acq_rel
86 ; FUNC-LABEL: {{^}}singlethread_seq_cst
88 ; GCN-NOT: ATOMIC_FENCE
90 define amdgpu_kernel void @singlethread_seq_cst() {
92 fence syncscope("singlethread") seq_cst
96 ; FUNC-LABEL: {{^}}agent_acquire
98 ; GCN-NOT: ATOMIC_FENCE
99 ; GFX6: s_waitcnt vmcnt(0){{$}}
100 ; GFX6-NEXT: buffer_wbinvl1{{$}}
101 ; GFX8: s_waitcnt vmcnt(0){{$}}
102 ; GFX8-NEXT: buffer_wbinvl1_vol{{$}}
104 define amdgpu_kernel void @agent_acquire() {
106 fence syncscope("agent") acquire
110 ; FUNC-LABEL: {{^}}agent_release
112 ; GCN-NOT: ATOMIC_FENCE
113 ; GCN: s_waitcnt vmcnt(0){{$}}
115 define amdgpu_kernel void @agent_release() {
117 fence syncscope("agent") release
121 ; FUNC-LABEL: {{^}}agent_acq_rel
123 ; GCN-NOT: ATOMIC_FENCE
124 ; GCN: s_waitcnt vmcnt(0){{$}}
125 ; GFX6: buffer_wbinvl1{{$}}
126 ; GFX8: buffer_wbinvl1_vol{{$}}
128 define amdgpu_kernel void @agent_acq_rel() {
130 fence syncscope("agent") acq_rel
134 ; FUNC-LABEL: {{^}}agent_seq_cst
136 ; GCN-NOT: ATOMIC_FENCE
137 ; GCN: s_waitcnt vmcnt(0){{$}}
138 ; GFX6: buffer_wbinvl1{{$}}
139 ; GFX8: buffer_wbinvl1_vol{{$}}
141 define amdgpu_kernel void @agent_seq_cst() {
143 fence syncscope("agent") seq_cst
147 ; FUNC-LABEL: {{^}}workgroup_acquire
149 ; GCN-NOT: ATOMIC_FENCE
151 define amdgpu_kernel void @workgroup_acquire() {
153 fence syncscope("workgroup") acquire
157 ; FUNC-LABEL: {{^}}workgroup_release
159 ; GCN-NOT: ATOMIC_FENCE
161 define amdgpu_kernel void @workgroup_release() {
163 fence syncscope("workgroup") release
167 ; FUNC-LABEL: {{^}}workgroup_acq_rel
169 ; GCN-NOT: ATOMIC_FENCE
171 define amdgpu_kernel void @workgroup_acq_rel() {
173 fence syncscope("workgroup") acq_rel
177 ; FUNC-LABEL: {{^}}workgroup_seq_cst
179 ; GCN-NOT: ATOMIC_FENCE
181 define amdgpu_kernel void @workgroup_seq_cst() {
183 fence syncscope("workgroup") seq_cst
187 ; FUNC-LABEL: {{^}}wavefront_acquire
189 ; GCN-NOT: ATOMIC_FENCE
191 define amdgpu_kernel void @wavefront_acquire() {
193 fence syncscope("wavefront") acquire
197 ; FUNC-LABEL: {{^}}wavefront_release
199 ; GCN-NOT: ATOMIC_FENCE
201 define amdgpu_kernel void @wavefront_release() {
203 fence syncscope("wavefront") release
207 ; FUNC-LABEL: {{^}}wavefront_acq_rel
209 ; GCN-NOT: ATOMIC_FENCE
211 define amdgpu_kernel void @wavefront_acq_rel() {
213 fence syncscope("wavefront") acq_rel
217 ; FUNC-LABEL: {{^}}wavefront_seq_cst
219 ; GCN-NOT: ATOMIC_FENCE
221 define amdgpu_kernel void @wavefront_seq_cst() {
223 fence syncscope("wavefront") seq_cst