1 ; RUN: llc -mtriple=amdgcn-amd- -mcpu=gfx803 -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,GFX8 %s
2 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx803 -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,GFX8 %s
4 ; GCN-LABEL: {{^}}system_monotonic:
5 ; GCN-NOT: s_waitcnt vmcnt(0){{$}}
6 ; GCN: flat_atomic_swap v[{{[0-9]+}}:{{[0-9]+}}], v{{[0-9]+}}{{$}}
7 ; GCN-NOT: s_waitcnt vmcnt(0){{$}}
8 ; GCN-NOT: buffer_wbinvl1_vol
9 define amdgpu_kernel void @system_monotonic(
12 %val = atomicrmw volatile xchg i32* %out, i32 %in monotonic
16 ; GCN-LABEL: {{^}}system_acquire:
17 ; GCN-NOT: s_waitcnt vmcnt(0){{$}}
18 ; GCN: flat_atomic_swap v[{{[0-9]+}}:{{[0-9]+}}], v{{[0-9]+}}{{$}}
19 ; GCN-NEXT: s_waitcnt vmcnt(0){{$}}
20 ; GFX8-NEXT: buffer_wbinvl1_vol
21 define amdgpu_kernel void @system_acquire(
24 %val = atomicrmw volatile xchg i32* %out, i32 %in acquire
28 ; GCN-LABEL: {{^}}system_release:
29 ; GCN: s_waitcnt vmcnt(0){{$}}
30 ; GCN-NEXT: flat_atomic_swap v[{{[0-9]+}}:{{[0-9]+}}], v{{[0-9]+}}{{$}}
31 ; GCN-NOT: s_waitcnt vmcnt(0){{$}}
32 ; GCN-NOT: buffer_wbinvl1_vol
33 define amdgpu_kernel void @system_release(
36 %val = atomicrmw volatile xchg i32* %out, i32 %in release
40 ; GCN-LABEL: {{^}}system_acq_rel:
41 ; GCN: s_waitcnt vmcnt(0){{$}}
42 ; GCN-NEXT: flat_atomic_swap v[{{[0-9]+}}:{{[0-9]+}}], v{{[0-9]+}}{{$}}
43 ; GCN-NEXT: s_waitcnt vmcnt(0){{$}}
44 ; GFX8-NEXT: buffer_wbinvl1_vol
45 define amdgpu_kernel void @system_acq_rel(
48 %val = atomicrmw volatile xchg i32* %out, i32 %in acq_rel
52 ; GCN-LABEL: {{^}}system_seq_cst:
53 ; GCN: s_waitcnt vmcnt(0){{$}}
54 ; GCN-NEXT: flat_atomic_swap v[{{[0-9]+}}:{{[0-9]+}}], v{{[0-9]+}}{{$}}
55 ; GCN-NEXT: s_waitcnt vmcnt(0){{$}}
56 ; GFX8-NEXT: buffer_wbinvl1_vol
57 define amdgpu_kernel void @system_seq_cst(
60 %val = atomicrmw volatile xchg i32* %out, i32 %in seq_cst
64 ; GCN-LABEL: {{^}}singlethread_monotonic:
65 ; GCN-NOT: s_waitcnt vmcnt(0){{$}}
66 ; GCN: flat_atomic_swap v[{{[0-9]+}}:{{[0-9]+}}], v{{[0-9]+}}{{$}}
67 ; GCN-NOT: s_waitcnt vmcnt(0){{$}}
68 ; GCN-NOT: buffer_wbinvl1_vol
69 define amdgpu_kernel void @singlethread_monotonic(
72 %val = atomicrmw volatile xchg i32* %out, i32 %in syncscope("singlethread") monotonic
76 ; GCN-LABEL: {{^}}singlethread_acquire:
77 ; GCN-NOT: s_waitcnt vmcnt(0){{$}}
78 ; GCN: flat_atomic_swap v[{{[0-9]+}}:{{[0-9]+}}], v{{[0-9]+}}{{$}}
79 ; GCN-NOT: s_waitcnt vmcnt(0){{$}}
80 ; GCN-NOT: buffer_wbinvl1_vol
81 define amdgpu_kernel void @singlethread_acquire(
84 %val = atomicrmw volatile xchg i32* %out, i32 %in syncscope("singlethread") acquire
88 ; GCN-LABEL: {{^}}singlethread_release:
89 ; GCN-NOT: s_waitcnt vmcnt(0){{$}}
90 ; GCN: flat_atomic_swap v[{{[0-9]+}}:{{[0-9]+}}], v{{[0-9]+}}{{$}}
91 ; GCN-NOT: s_waitcnt vmcnt(0){{$}}
92 ; GCN-NOT: buffer_wbinvl1_vol
93 define amdgpu_kernel void @singlethread_release(
96 %val = atomicrmw volatile xchg i32* %out, i32 %in syncscope("singlethread") release
100 ; GCN-LABEL: {{^}}singlethread_acq_rel:
101 ; GCN-NOT: s_waitcnt vmcnt(0){{$}}
102 ; GCN: flat_atomic_swap v[{{[0-9]+}}:{{[0-9]+}}], v{{[0-9]+}}{{$}}
103 ; GCN-NOT: s_waitcnt vmcnt(0){{$}}
104 ; GCN-NOT: buffer_wbinvl1_vol
105 define amdgpu_kernel void @singlethread_acq_rel(
106 i32* %out, i32 %in) {
108 %val = atomicrmw volatile xchg i32* %out, i32 %in syncscope("singlethread") acq_rel
112 ; GCN-LABEL: {{^}}singlethread_seq_cst:
113 ; GCN-NOT: s_waitcnt vmcnt(0){{$}}
114 ; GCN: flat_atomic_swap v[{{[0-9]+}}:{{[0-9]+}}], v{{[0-9]+}}{{$}}
115 ; GCN-NOT: s_waitcnt vmcnt(0){{$}}
116 ; GCN-NOT: buffer_wbinvl1_vol
117 define amdgpu_kernel void @singlethread_seq_cst(
118 i32* %out, i32 %in) {
120 %val = atomicrmw volatile xchg i32* %out, i32 %in syncscope("singlethread") seq_cst
124 ; GCN-LABEL: {{^}}agent_monotonic:
125 ; GCN-NOT: s_waitcnt vmcnt(0){{$}}
126 ; GCN: flat_atomic_swap v[{{[0-9]+}}:{{[0-9]+}}], v{{[0-9]+}}{{$}}
127 ; GCN-NOT: s_waitcnt vmcnt(0){{$}}
128 ; GCN-NOT: buffer_wbinvl1_vol
129 define amdgpu_kernel void @agent_monotonic(
130 i32* %out, i32 %in) {
132 %val = atomicrmw volatile xchg i32* %out, i32 %in syncscope("agent") monotonic
136 ; GCN-LABEL: {{^}}agent_acquire:
137 ; GCN-NOT: s_waitcnt vmcnt(0){{$}}
138 ; GCN: flat_atomic_swap v[{{[0-9]+}}:{{[0-9]+}}], v{{[0-9]+}}{{$}}
139 ; GCN-NEXT: s_waitcnt vmcnt(0){{$}}
140 ; GFX8-NEXT: buffer_wbinvl1_vol
141 define amdgpu_kernel void @agent_acquire(
142 i32* %out, i32 %in) {
144 %val = atomicrmw volatile xchg i32* %out, i32 %in syncscope("agent") acquire
148 ; GCN-LABEL: {{^}}agent_release:
149 ; GCN: s_waitcnt vmcnt(0){{$}}
150 ; GCN-NEXT: flat_atomic_swap v[{{[0-9]+}}:{{[0-9]+}}], v{{[0-9]+}}{{$}}
151 ; GCN-NOT: s_waitcnt vmcnt(0){{$}}
152 ; GCN-NOT: buffer_wbinvl1_vol
153 define amdgpu_kernel void @agent_release(
154 i32* %out, i32 %in) {
156 %val = atomicrmw volatile xchg i32* %out, i32 %in syncscope("agent") release
160 ; GCN-LABEL: {{^}}agent_acq_rel:
161 ; GCN: s_waitcnt vmcnt(0){{$}}
162 ; GCN-NEXT: flat_atomic_swap v[{{[0-9]+}}:{{[0-9]+}}], v{{[0-9]+}}{{$}}
163 ; GCN-NEXT: s_waitcnt vmcnt(0){{$}}
164 ; GFX8-NEXT: buffer_wbinvl1_vol
165 define amdgpu_kernel void @agent_acq_rel(
166 i32* %out, i32 %in) {
168 %val = atomicrmw volatile xchg i32* %out, i32 %in syncscope("agent") acq_rel
172 ; GCN-LABEL: {{^}}agent_seq_cst:
173 ; GCN: s_waitcnt vmcnt(0){{$}}
174 ; GCN-NEXT: flat_atomic_swap v[{{[0-9]+}}:{{[0-9]+}}], v{{[0-9]+}}{{$}}
175 ; GCN-NEXT: s_waitcnt vmcnt(0){{$}}
176 ; GFX8-NEXT: buffer_wbinvl1_vol
177 define amdgpu_kernel void @agent_seq_cst(
178 i32* %out, i32 %in) {
180 %val = atomicrmw volatile xchg i32* %out, i32 %in syncscope("agent") seq_cst
184 ; GCN-LABEL: {{^}}workgroup_monotonic:
185 ; GCN-NOT: s_waitcnt vmcnt(0){{$}}
186 ; GCN: flat_atomic_swap v[{{[0-9]+}}:{{[0-9]+}}], v{{[0-9]+}}{{$}}
187 ; GCN-NOT: s_waitcnt vmcnt(0){{$}}
188 ; GCN-NOT: buffer_wbinvl1_vol
189 define amdgpu_kernel void @workgroup_monotonic(
190 i32* %out, i32 %in) {
192 %val = atomicrmw volatile xchg i32* %out, i32 %in syncscope("workgroup") monotonic
196 ; GCN-LABEL: {{^}}workgroup_acquire:
197 ; GCN-NOT: s_waitcnt vmcnt(0){{$}}
198 ; GCN: flat_atomic_swap v[{{[0-9]+}}:{{[0-9]+}}], v{{[0-9]+}}{{$}}
199 ; GFX8-NOT: s_waitcnt vmcnt(0){{$}}
200 ; GFX8-NOT: buffer_wbinvl1_vol
201 define amdgpu_kernel void @workgroup_acquire(
202 i32* %out, i32 %in) {
204 %val = atomicrmw volatile xchg i32* %out, i32 %in syncscope("workgroup") acquire
208 ; GCN-LABEL: {{^}}workgroup_release:
209 ; GFX8-NOT: s_waitcnt vmcnt(0){{$}}
210 ; GCN: flat_atomic_swap v[{{[0-9]+}}:{{[0-9]+}}], v{{[0-9]+}}{{$}}
211 ; GCN-NOT: s_waitcnt vmcnt(0){{$}}
212 ; GCN-NOT: buffer_wbinvl1_vol
213 define amdgpu_kernel void @workgroup_release(
214 i32* %out, i32 %in) {
216 %val = atomicrmw volatile xchg i32* %out, i32 %in syncscope("workgroup") release
220 ; GCN-LABEL: {{^}}workgroup_acq_rel:
221 ; GFX8-NOT: s_waitcnt vmcnt(0){{$}}
222 ; GCN: flat_atomic_swap v[{{[0-9]+}}:{{[0-9]+}}], v{{[0-9]+}}{{$}}
223 ; GFX8-NOT: s_waitcnt vmcnt(0){{$}}
224 ; GFX8-NOT: buffer_wbinvl1_vol
225 define amdgpu_kernel void @workgroup_acq_rel(
226 i32* %out, i32 %in) {
228 %val = atomicrmw volatile xchg i32* %out, i32 %in syncscope("workgroup") acq_rel
232 ; GCN-LABEL: {{^}}workgroup_seq_cst:
233 ; GFX8-NOT: s_waitcnt vmcnt(0){{$}}
234 ; GCN: flat_atomic_swap v[{{[0-9]+}}:{{[0-9]+}}], v{{[0-9]+}}{{$}}
235 ; GCN-NOT: s_waitcnt vmcnt(0){{$}}
236 ; GFX8-NOT: buffer_wbinvl1_vol
237 define amdgpu_kernel void @workgroup_seq_cst(
238 i32* %out, i32 %in) {
240 %val = atomicrmw volatile xchg i32* %out, i32 %in syncscope("workgroup") seq_cst
244 ; GCN-LABEL: {{^}}wavefront_monotonic:
245 ; GCN-NOT: s_waitcnt vmcnt(0){{$}}
246 ; GCN: flat_atomic_swap v[{{[0-9]+}}:{{[0-9]+}}], v{{[0-9]+}}{{$}}
247 ; GCN-NOT: s_waitcnt vmcnt(0){{$}}
248 ; GCN-NOT: buffer_wbinvl1_vol
249 define amdgpu_kernel void @wavefront_monotonic(
250 i32* %out, i32 %in) {
252 %val = atomicrmw volatile xchg i32* %out, i32 %in syncscope("wavefront") monotonic
256 ; GCN-LABEL: {{^}}wavefront_acquire:
257 ; GCN-NOT: s_waitcnt vmcnt(0){{$}}
258 ; GCN: flat_atomic_swap v[{{[0-9]+}}:{{[0-9]+}}], v{{[0-9]+}}{{$}}
259 ; GCN-NOT: s_waitcnt vmcnt(0){{$}}
260 ; GCN-NOT: buffer_wbinvl1_vol
261 define amdgpu_kernel void @wavefront_acquire(
262 i32* %out, i32 %in) {
264 %val = atomicrmw volatile xchg i32* %out, i32 %in syncscope("wavefront") acquire
268 ; GCN-LABEL: {{^}}wavefront_release:
269 ; GCN-NOT: s_waitcnt vmcnt(0){{$}}
270 ; GCN: flat_atomic_swap v[{{[0-9]+}}:{{[0-9]+}}], v{{[0-9]+}}{{$}}
271 ; GCN-NOT: s_waitcnt vmcnt(0){{$}}
272 ; GCN-NOT: buffer_wbinvl1_vol
273 define amdgpu_kernel void @wavefront_release(
274 i32* %out, i32 %in) {
276 %val = atomicrmw volatile xchg i32* %out, i32 %in syncscope("wavefront") release
280 ; GCN-LABEL: {{^}}wavefront_acq_rel:
281 ; GCN-NOT: s_waitcnt vmcnt(0){{$}}
282 ; GCN: flat_atomic_swap v[{{[0-9]+}}:{{[0-9]+}}], v{{[0-9]+}}{{$}}
283 ; GCN-NOT: s_waitcnt vmcnt(0){{$}}
284 ; GCN-NOT: buffer_wbinvl1_vol
285 define amdgpu_kernel void @wavefront_acq_rel(
286 i32* %out, i32 %in) {
288 %val = atomicrmw volatile xchg i32* %out, i32 %in syncscope("wavefront") acq_rel
292 ; GCN-LABEL: {{^}}wavefront_seq_cst:
293 ; GCN-NOT: s_waitcnt vmcnt(0){{$}}
294 ; GCN: flat_atomic_swap v[{{[0-9]+}}:{{[0-9]+}}], v{{[0-9]+}}{{$}}
295 ; GCN-NOT: s_waitcnt vmcnt(0){{$}}
296 ; GCN-NOT: buffer_wbinvl1_vol
297 define amdgpu_kernel void @wavefront_seq_cst(
298 i32* %out, i32 %in) {
300 %val = atomicrmw volatile xchg i32* %out, i32 %in syncscope("wavefront") seq_cst