xref: /llvm-project/llvm/test/CodeGen/AMDGPU/memory-legalizer-fence.ll (revision 924a64a3486f9962c42d4ec253774eb2c586ac33)
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc -mtriple=amdgcn-amd-amdhsa -O0 -mcpu=gfx600 < %s | FileCheck --check-prefixes=GFX6 %s
3; RUN: llc -mtriple=amdgcn-amd-amdhsa -O0 -mcpu=gfx700 < %s | FileCheck --check-prefixes=GFX7 %s
4; RUN: llc -mtriple=amdgcn-amd-amdhsa -O0 -mcpu=gfx1010 < %s | FileCheck --check-prefixes=GFX10-WGP %s
5; RUN: llc -mtriple=amdgcn-amd-amdhsa -O0 -mcpu=gfx1010 -mattr=+cumode < %s | FileCheck --check-prefixes=GFX10-CU %s
6; RUN: llc -mtriple=amdgcn-amd-amdpal -O0 -mcpu=gfx700 -amdgcn-skip-cache-invalidations < %s | FileCheck --check-prefixes=SKIP-CACHE-INV %s
7; RUN: llc -mtriple=amdgcn-amd-amdhsa -O0 -mcpu=gfx90a < %s | FileCheck -check-prefixes=GFX90A-NOTTGSPLIT %s
8; RUN: llc -mtriple=amdgcn-amd-amdhsa -O0 -mcpu=gfx90a -mattr=+tgsplit < %s | FileCheck -check-prefixes=GFX90A-TGSPLIT %s
9; RUN: llc -mtriple=amdgcn-amd-amdhsa -O0 -mcpu=gfx940 < %s | FileCheck -check-prefixes=GFX940-NOTTGSPLIT %s
10; RUN: llc -mtriple=amdgcn-amd-amdhsa -O0 -mcpu=gfx940 -mattr=+tgsplit < %s | FileCheck -check-prefixes=GFX940-TGSPLIT %s
11; RUN: llc -mtriple=amdgcn-amd-amdhsa -O0 -mcpu=gfx1100 < %s | FileCheck --check-prefixes=GFX11-WGP %s
12; RUN: llc -mtriple=amdgcn-amd-amdhsa -O0 -mcpu=gfx1100 -mattr=+cumode < %s | FileCheck --check-prefixes=GFX11-CU %s
13; RUN: llc -mtriple=amdgcn-amd-amdhsa -O0 -mcpu=gfx1200 < %s | FileCheck --check-prefixes=GFX12-WGP %s
14; RUN: llc -mtriple=amdgcn-amd-amdhsa -O0 -mcpu=gfx1200 -mattr=+cumode < %s | FileCheck --check-prefixes=GFX12-CU %s
15
16define amdgpu_kernel void @singlethread_acquire_fence() {
17; GFX6-LABEL: singlethread_acquire_fence:
18; GFX6:       ; %bb.0: ; %entry
19; GFX6-NEXT:    s_endpgm
20;
21; GFX7-LABEL: singlethread_acquire_fence:
22; GFX7:       ; %bb.0: ; %entry
23; GFX7-NEXT:    s_endpgm
24;
25; GFX10-WGP-LABEL: singlethread_acquire_fence:
26; GFX10-WGP:       ; %bb.0: ; %entry
27; GFX10-WGP-NEXT:    s_endpgm
28;
29; GFX10-CU-LABEL: singlethread_acquire_fence:
30; GFX10-CU:       ; %bb.0: ; %entry
31; GFX10-CU-NEXT:    s_endpgm
32;
33; SKIP-CACHE-INV-LABEL: singlethread_acquire_fence:
34; SKIP-CACHE-INV:       ; %bb.0: ; %entry
35; SKIP-CACHE-INV-NEXT:    s_endpgm
36;
37; GFX90A-NOTTGSPLIT-LABEL: singlethread_acquire_fence:
38; GFX90A-NOTTGSPLIT:       ; %bb.0: ; %entry
39; GFX90A-NOTTGSPLIT-NEXT:    s_endpgm
40;
41; GFX90A-TGSPLIT-LABEL: singlethread_acquire_fence:
42; GFX90A-TGSPLIT:       ; %bb.0: ; %entry
43; GFX90A-TGSPLIT-NEXT:    s_endpgm
44;
45; GFX940-NOTTGSPLIT-LABEL: singlethread_acquire_fence:
46; GFX940-NOTTGSPLIT:       ; %bb.0: ; %entry
47; GFX940-NOTTGSPLIT-NEXT:    s_endpgm
48;
49; GFX940-TGSPLIT-LABEL: singlethread_acquire_fence:
50; GFX940-TGSPLIT:       ; %bb.0: ; %entry
51; GFX940-TGSPLIT-NEXT:    s_endpgm
52;
53; GFX11-WGP-LABEL: singlethread_acquire_fence:
54; GFX11-WGP:       ; %bb.0: ; %entry
55; GFX11-WGP-NEXT:    s_endpgm
56;
57; GFX11-CU-LABEL: singlethread_acquire_fence:
58; GFX11-CU:       ; %bb.0: ; %entry
59; GFX11-CU-NEXT:    s_endpgm
60;
61; GFX12-WGP-LABEL: singlethread_acquire_fence:
62; GFX12-WGP:       ; %bb.0: ; %entry
63; GFX12-WGP-NEXT:    s_endpgm
64;
65; GFX12-CU-LABEL: singlethread_acquire_fence:
66; GFX12-CU:       ; %bb.0: ; %entry
67; GFX12-CU-NEXT:    s_endpgm
68entry:
69  fence syncscope("singlethread") acquire
70  ret void
71}
72
73define amdgpu_kernel void @singlethread_release_fence() {
74; GFX6-LABEL: singlethread_release_fence:
75; GFX6:       ; %bb.0: ; %entry
76; GFX6-NEXT:    s_endpgm
77;
78; GFX7-LABEL: singlethread_release_fence:
79; GFX7:       ; %bb.0: ; %entry
80; GFX7-NEXT:    s_endpgm
81;
82; GFX10-WGP-LABEL: singlethread_release_fence:
83; GFX10-WGP:       ; %bb.0: ; %entry
84; GFX10-WGP-NEXT:    s_endpgm
85;
86; GFX10-CU-LABEL: singlethread_release_fence:
87; GFX10-CU:       ; %bb.0: ; %entry
88; GFX10-CU-NEXT:    s_endpgm
89;
90; SKIP-CACHE-INV-LABEL: singlethread_release_fence:
91; SKIP-CACHE-INV:       ; %bb.0: ; %entry
92; SKIP-CACHE-INV-NEXT:    s_endpgm
93;
94; GFX90A-NOTTGSPLIT-LABEL: singlethread_release_fence:
95; GFX90A-NOTTGSPLIT:       ; %bb.0: ; %entry
96; GFX90A-NOTTGSPLIT-NEXT:    s_endpgm
97;
98; GFX90A-TGSPLIT-LABEL: singlethread_release_fence:
99; GFX90A-TGSPLIT:       ; %bb.0: ; %entry
100; GFX90A-TGSPLIT-NEXT:    s_endpgm
101;
102; GFX940-NOTTGSPLIT-LABEL: singlethread_release_fence:
103; GFX940-NOTTGSPLIT:       ; %bb.0: ; %entry
104; GFX940-NOTTGSPLIT-NEXT:    s_endpgm
105;
106; GFX940-TGSPLIT-LABEL: singlethread_release_fence:
107; GFX940-TGSPLIT:       ; %bb.0: ; %entry
108; GFX940-TGSPLIT-NEXT:    s_endpgm
109;
110; GFX11-WGP-LABEL: singlethread_release_fence:
111; GFX11-WGP:       ; %bb.0: ; %entry
112; GFX11-WGP-NEXT:    s_endpgm
113;
114; GFX11-CU-LABEL: singlethread_release_fence:
115; GFX11-CU:       ; %bb.0: ; %entry
116; GFX11-CU-NEXT:    s_endpgm
117;
118; GFX12-WGP-LABEL: singlethread_release_fence:
119; GFX12-WGP:       ; %bb.0: ; %entry
120; GFX12-WGP-NEXT:    s_endpgm
121;
122; GFX12-CU-LABEL: singlethread_release_fence:
123; GFX12-CU:       ; %bb.0: ; %entry
124; GFX12-CU-NEXT:    s_endpgm
125entry:
126  fence syncscope("singlethread") release
127  ret void
128}
129
130define amdgpu_kernel void @singlethread_acq_rel_fence() {
131; GFX6-LABEL: singlethread_acq_rel_fence:
132; GFX6:       ; %bb.0: ; %entry
133; GFX6-NEXT:    s_endpgm
134;
135; GFX7-LABEL: singlethread_acq_rel_fence:
136; GFX7:       ; %bb.0: ; %entry
137; GFX7-NEXT:    s_endpgm
138;
139; GFX10-WGP-LABEL: singlethread_acq_rel_fence:
140; GFX10-WGP:       ; %bb.0: ; %entry
141; GFX10-WGP-NEXT:    s_endpgm
142;
143; GFX10-CU-LABEL: singlethread_acq_rel_fence:
144; GFX10-CU:       ; %bb.0: ; %entry
145; GFX10-CU-NEXT:    s_endpgm
146;
147; SKIP-CACHE-INV-LABEL: singlethread_acq_rel_fence:
148; SKIP-CACHE-INV:       ; %bb.0: ; %entry
149; SKIP-CACHE-INV-NEXT:    s_endpgm
150;
151; GFX90A-NOTTGSPLIT-LABEL: singlethread_acq_rel_fence:
152; GFX90A-NOTTGSPLIT:       ; %bb.0: ; %entry
153; GFX90A-NOTTGSPLIT-NEXT:    s_endpgm
154;
155; GFX90A-TGSPLIT-LABEL: singlethread_acq_rel_fence:
156; GFX90A-TGSPLIT:       ; %bb.0: ; %entry
157; GFX90A-TGSPLIT-NEXT:    s_endpgm
158;
159; GFX940-NOTTGSPLIT-LABEL: singlethread_acq_rel_fence:
160; GFX940-NOTTGSPLIT:       ; %bb.0: ; %entry
161; GFX940-NOTTGSPLIT-NEXT:    s_endpgm
162;
163; GFX940-TGSPLIT-LABEL: singlethread_acq_rel_fence:
164; GFX940-TGSPLIT:       ; %bb.0: ; %entry
165; GFX940-TGSPLIT-NEXT:    s_endpgm
166;
167; GFX11-WGP-LABEL: singlethread_acq_rel_fence:
168; GFX11-WGP:       ; %bb.0: ; %entry
169; GFX11-WGP-NEXT:    s_endpgm
170;
171; GFX11-CU-LABEL: singlethread_acq_rel_fence:
172; GFX11-CU:       ; %bb.0: ; %entry
173; GFX11-CU-NEXT:    s_endpgm
174;
175; GFX12-WGP-LABEL: singlethread_acq_rel_fence:
176; GFX12-WGP:       ; %bb.0: ; %entry
177; GFX12-WGP-NEXT:    s_endpgm
178;
179; GFX12-CU-LABEL: singlethread_acq_rel_fence:
180; GFX12-CU:       ; %bb.0: ; %entry
181; GFX12-CU-NEXT:    s_endpgm
182entry:
183  fence syncscope("singlethread") acq_rel
184  ret void
185}
186
187define amdgpu_kernel void @singlethread_seq_cst_fence() {
188; GFX6-LABEL: singlethread_seq_cst_fence:
189; GFX6:       ; %bb.0: ; %entry
190; GFX6-NEXT:    s_endpgm
191;
192; GFX7-LABEL: singlethread_seq_cst_fence:
193; GFX7:       ; %bb.0: ; %entry
194; GFX7-NEXT:    s_endpgm
195;
196; GFX10-WGP-LABEL: singlethread_seq_cst_fence:
197; GFX10-WGP:       ; %bb.0: ; %entry
198; GFX10-WGP-NEXT:    s_endpgm
199;
200; GFX10-CU-LABEL: singlethread_seq_cst_fence:
201; GFX10-CU:       ; %bb.0: ; %entry
202; GFX10-CU-NEXT:    s_endpgm
203;
204; SKIP-CACHE-INV-LABEL: singlethread_seq_cst_fence:
205; SKIP-CACHE-INV:       ; %bb.0: ; %entry
206; SKIP-CACHE-INV-NEXT:    s_endpgm
207;
208; GFX90A-NOTTGSPLIT-LABEL: singlethread_seq_cst_fence:
209; GFX90A-NOTTGSPLIT:       ; %bb.0: ; %entry
210; GFX90A-NOTTGSPLIT-NEXT:    s_endpgm
211;
212; GFX90A-TGSPLIT-LABEL: singlethread_seq_cst_fence:
213; GFX90A-TGSPLIT:       ; %bb.0: ; %entry
214; GFX90A-TGSPLIT-NEXT:    s_endpgm
215;
216; GFX940-NOTTGSPLIT-LABEL: singlethread_seq_cst_fence:
217; GFX940-NOTTGSPLIT:       ; %bb.0: ; %entry
218; GFX940-NOTTGSPLIT-NEXT:    s_endpgm
219;
220; GFX940-TGSPLIT-LABEL: singlethread_seq_cst_fence:
221; GFX940-TGSPLIT:       ; %bb.0: ; %entry
222; GFX940-TGSPLIT-NEXT:    s_endpgm
223;
224; GFX11-WGP-LABEL: singlethread_seq_cst_fence:
225; GFX11-WGP:       ; %bb.0: ; %entry
226; GFX11-WGP-NEXT:    s_endpgm
227;
228; GFX11-CU-LABEL: singlethread_seq_cst_fence:
229; GFX11-CU:       ; %bb.0: ; %entry
230; GFX11-CU-NEXT:    s_endpgm
231;
232; GFX12-WGP-LABEL: singlethread_seq_cst_fence:
233; GFX12-WGP:       ; %bb.0: ; %entry
234; GFX12-WGP-NEXT:    s_endpgm
235;
236; GFX12-CU-LABEL: singlethread_seq_cst_fence:
237; GFX12-CU:       ; %bb.0: ; %entry
238; GFX12-CU-NEXT:    s_endpgm
239entry:
240  fence syncscope("singlethread") seq_cst
241  ret void
242}
243
244define amdgpu_kernel void @singlethread_one_as_acquire_fence() {
245; GFX6-LABEL: singlethread_one_as_acquire_fence:
246; GFX6:       ; %bb.0: ; %entry
247; GFX6-NEXT:    s_endpgm
248;
249; GFX7-LABEL: singlethread_one_as_acquire_fence:
250; GFX7:       ; %bb.0: ; %entry
251; GFX7-NEXT:    s_endpgm
252;
253; GFX10-WGP-LABEL: singlethread_one_as_acquire_fence:
254; GFX10-WGP:       ; %bb.0: ; %entry
255; GFX10-WGP-NEXT:    s_endpgm
256;
257; GFX10-CU-LABEL: singlethread_one_as_acquire_fence:
258; GFX10-CU:       ; %bb.0: ; %entry
259; GFX10-CU-NEXT:    s_endpgm
260;
261; SKIP-CACHE-INV-LABEL: singlethread_one_as_acquire_fence:
262; SKIP-CACHE-INV:       ; %bb.0: ; %entry
263; SKIP-CACHE-INV-NEXT:    s_endpgm
264;
265; GFX90A-NOTTGSPLIT-LABEL: singlethread_one_as_acquire_fence:
266; GFX90A-NOTTGSPLIT:       ; %bb.0: ; %entry
267; GFX90A-NOTTGSPLIT-NEXT:    s_endpgm
268;
269; GFX90A-TGSPLIT-LABEL: singlethread_one_as_acquire_fence:
270; GFX90A-TGSPLIT:       ; %bb.0: ; %entry
271; GFX90A-TGSPLIT-NEXT:    s_endpgm
272;
273; GFX940-NOTTGSPLIT-LABEL: singlethread_one_as_acquire_fence:
274; GFX940-NOTTGSPLIT:       ; %bb.0: ; %entry
275; GFX940-NOTTGSPLIT-NEXT:    s_endpgm
276;
277; GFX940-TGSPLIT-LABEL: singlethread_one_as_acquire_fence:
278; GFX940-TGSPLIT:       ; %bb.0: ; %entry
279; GFX940-TGSPLIT-NEXT:    s_endpgm
280;
281; GFX11-WGP-LABEL: singlethread_one_as_acquire_fence:
282; GFX11-WGP:       ; %bb.0: ; %entry
283; GFX11-WGP-NEXT:    s_endpgm
284;
285; GFX11-CU-LABEL: singlethread_one_as_acquire_fence:
286; GFX11-CU:       ; %bb.0: ; %entry
287; GFX11-CU-NEXT:    s_endpgm
288;
289; GFX12-WGP-LABEL: singlethread_one_as_acquire_fence:
290; GFX12-WGP:       ; %bb.0: ; %entry
291; GFX12-WGP-NEXT:    s_endpgm
292;
293; GFX12-CU-LABEL: singlethread_one_as_acquire_fence:
294; GFX12-CU:       ; %bb.0: ; %entry
295; GFX12-CU-NEXT:    s_endpgm
296entry:
297  fence syncscope("singlethread-one-as") acquire
298  ret void
299}
300
301define amdgpu_kernel void @singlethread_one_as_release_fence() {
302; GFX6-LABEL: singlethread_one_as_release_fence:
303; GFX6:       ; %bb.0: ; %entry
304; GFX6-NEXT:    s_endpgm
305;
306; GFX7-LABEL: singlethread_one_as_release_fence:
307; GFX7:       ; %bb.0: ; %entry
308; GFX7-NEXT:    s_endpgm
309;
310; GFX10-WGP-LABEL: singlethread_one_as_release_fence:
311; GFX10-WGP:       ; %bb.0: ; %entry
312; GFX10-WGP-NEXT:    s_endpgm
313;
314; GFX10-CU-LABEL: singlethread_one_as_release_fence:
315; GFX10-CU:       ; %bb.0: ; %entry
316; GFX10-CU-NEXT:    s_endpgm
317;
318; SKIP-CACHE-INV-LABEL: singlethread_one_as_release_fence:
319; SKIP-CACHE-INV:       ; %bb.0: ; %entry
320; SKIP-CACHE-INV-NEXT:    s_endpgm
321;
322; GFX90A-NOTTGSPLIT-LABEL: singlethread_one_as_release_fence:
323; GFX90A-NOTTGSPLIT:       ; %bb.0: ; %entry
324; GFX90A-NOTTGSPLIT-NEXT:    s_endpgm
325;
326; GFX90A-TGSPLIT-LABEL: singlethread_one_as_release_fence:
327; GFX90A-TGSPLIT:       ; %bb.0: ; %entry
328; GFX90A-TGSPLIT-NEXT:    s_endpgm
329;
330; GFX940-NOTTGSPLIT-LABEL: singlethread_one_as_release_fence:
331; GFX940-NOTTGSPLIT:       ; %bb.0: ; %entry
332; GFX940-NOTTGSPLIT-NEXT:    s_endpgm
333;
334; GFX940-TGSPLIT-LABEL: singlethread_one_as_release_fence:
335; GFX940-TGSPLIT:       ; %bb.0: ; %entry
336; GFX940-TGSPLIT-NEXT:    s_endpgm
337;
338; GFX11-WGP-LABEL: singlethread_one_as_release_fence:
339; GFX11-WGP:       ; %bb.0: ; %entry
340; GFX11-WGP-NEXT:    s_endpgm
341;
342; GFX11-CU-LABEL: singlethread_one_as_release_fence:
343; GFX11-CU:       ; %bb.0: ; %entry
344; GFX11-CU-NEXT:    s_endpgm
345;
346; GFX12-WGP-LABEL: singlethread_one_as_release_fence:
347; GFX12-WGP:       ; %bb.0: ; %entry
348; GFX12-WGP-NEXT:    s_endpgm
349;
350; GFX12-CU-LABEL: singlethread_one_as_release_fence:
351; GFX12-CU:       ; %bb.0: ; %entry
352; GFX12-CU-NEXT:    s_endpgm
353entry:
354  fence syncscope("singlethread-one-as") release
355  ret void
356}
357
358define amdgpu_kernel void @singlethread_one_as_acq_rel_fence() {
359; GFX6-LABEL: singlethread_one_as_acq_rel_fence:
360; GFX6:       ; %bb.0: ; %entry
361; GFX6-NEXT:    s_endpgm
362;
363; GFX7-LABEL: singlethread_one_as_acq_rel_fence:
364; GFX7:       ; %bb.0: ; %entry
365; GFX7-NEXT:    s_endpgm
366;
367; GFX10-WGP-LABEL: singlethread_one_as_acq_rel_fence:
368; GFX10-WGP:       ; %bb.0: ; %entry
369; GFX10-WGP-NEXT:    s_endpgm
370;
371; GFX10-CU-LABEL: singlethread_one_as_acq_rel_fence:
372; GFX10-CU:       ; %bb.0: ; %entry
373; GFX10-CU-NEXT:    s_endpgm
374;
375; SKIP-CACHE-INV-LABEL: singlethread_one_as_acq_rel_fence:
376; SKIP-CACHE-INV:       ; %bb.0: ; %entry
377; SKIP-CACHE-INV-NEXT:    s_endpgm
378;
379; GFX90A-NOTTGSPLIT-LABEL: singlethread_one_as_acq_rel_fence:
380; GFX90A-NOTTGSPLIT:       ; %bb.0: ; %entry
381; GFX90A-NOTTGSPLIT-NEXT:    s_endpgm
382;
383; GFX90A-TGSPLIT-LABEL: singlethread_one_as_acq_rel_fence:
384; GFX90A-TGSPLIT:       ; %bb.0: ; %entry
385; GFX90A-TGSPLIT-NEXT:    s_endpgm
386;
387; GFX940-NOTTGSPLIT-LABEL: singlethread_one_as_acq_rel_fence:
388; GFX940-NOTTGSPLIT:       ; %bb.0: ; %entry
389; GFX940-NOTTGSPLIT-NEXT:    s_endpgm
390;
391; GFX940-TGSPLIT-LABEL: singlethread_one_as_acq_rel_fence:
392; GFX940-TGSPLIT:       ; %bb.0: ; %entry
393; GFX940-TGSPLIT-NEXT:    s_endpgm
394;
395; GFX11-WGP-LABEL: singlethread_one_as_acq_rel_fence:
396; GFX11-WGP:       ; %bb.0: ; %entry
397; GFX11-WGP-NEXT:    s_endpgm
398;
399; GFX11-CU-LABEL: singlethread_one_as_acq_rel_fence:
400; GFX11-CU:       ; %bb.0: ; %entry
401; GFX11-CU-NEXT:    s_endpgm
402;
403; GFX12-WGP-LABEL: singlethread_one_as_acq_rel_fence:
404; GFX12-WGP:       ; %bb.0: ; %entry
405; GFX12-WGP-NEXT:    s_endpgm
406;
407; GFX12-CU-LABEL: singlethread_one_as_acq_rel_fence:
408; GFX12-CU:       ; %bb.0: ; %entry
409; GFX12-CU-NEXT:    s_endpgm
410entry:
411  fence syncscope("singlethread-one-as") acq_rel
412  ret void
413}
414
415define amdgpu_kernel void @singlethread_one_as_seq_cst_fence() {
416; GFX6-LABEL: singlethread_one_as_seq_cst_fence:
417; GFX6:       ; %bb.0: ; %entry
418; GFX6-NEXT:    s_endpgm
419;
420; GFX7-LABEL: singlethread_one_as_seq_cst_fence:
421; GFX7:       ; %bb.0: ; %entry
422; GFX7-NEXT:    s_endpgm
423;
424; GFX10-WGP-LABEL: singlethread_one_as_seq_cst_fence:
425; GFX10-WGP:       ; %bb.0: ; %entry
426; GFX10-WGP-NEXT:    s_endpgm
427;
428; GFX10-CU-LABEL: singlethread_one_as_seq_cst_fence:
429; GFX10-CU:       ; %bb.0: ; %entry
430; GFX10-CU-NEXT:    s_endpgm
431;
432; SKIP-CACHE-INV-LABEL: singlethread_one_as_seq_cst_fence:
433; SKIP-CACHE-INV:       ; %bb.0: ; %entry
434; SKIP-CACHE-INV-NEXT:    s_endpgm
435;
436; GFX90A-NOTTGSPLIT-LABEL: singlethread_one_as_seq_cst_fence:
437; GFX90A-NOTTGSPLIT:       ; %bb.0: ; %entry
438; GFX90A-NOTTGSPLIT-NEXT:    s_endpgm
439;
440; GFX90A-TGSPLIT-LABEL: singlethread_one_as_seq_cst_fence:
441; GFX90A-TGSPLIT:       ; %bb.0: ; %entry
442; GFX90A-TGSPLIT-NEXT:    s_endpgm
443;
444; GFX940-NOTTGSPLIT-LABEL: singlethread_one_as_seq_cst_fence:
445; GFX940-NOTTGSPLIT:       ; %bb.0: ; %entry
446; GFX940-NOTTGSPLIT-NEXT:    s_endpgm
447;
448; GFX940-TGSPLIT-LABEL: singlethread_one_as_seq_cst_fence:
449; GFX940-TGSPLIT:       ; %bb.0: ; %entry
450; GFX940-TGSPLIT-NEXT:    s_endpgm
451;
452; GFX11-WGP-LABEL: singlethread_one_as_seq_cst_fence:
453; GFX11-WGP:       ; %bb.0: ; %entry
454; GFX11-WGP-NEXT:    s_endpgm
455;
456; GFX11-CU-LABEL: singlethread_one_as_seq_cst_fence:
457; GFX11-CU:       ; %bb.0: ; %entry
458; GFX11-CU-NEXT:    s_endpgm
459;
460; GFX12-WGP-LABEL: singlethread_one_as_seq_cst_fence:
461; GFX12-WGP:       ; %bb.0: ; %entry
462; GFX12-WGP-NEXT:    s_endpgm
463;
464; GFX12-CU-LABEL: singlethread_one_as_seq_cst_fence:
465; GFX12-CU:       ; %bb.0: ; %entry
466; GFX12-CU-NEXT:    s_endpgm
467entry:
468  fence syncscope("singlethread-one-as") seq_cst
469  ret void
470}
471
472define amdgpu_kernel void @wavefront_acquire_fence() {
473; GFX6-LABEL: wavefront_acquire_fence:
474; GFX6:       ; %bb.0: ; %entry
475; GFX6-NEXT:    s_endpgm
476;
477; GFX7-LABEL: wavefront_acquire_fence:
478; GFX7:       ; %bb.0: ; %entry
479; GFX7-NEXT:    s_endpgm
480;
481; GFX10-WGP-LABEL: wavefront_acquire_fence:
482; GFX10-WGP:       ; %bb.0: ; %entry
483; GFX10-WGP-NEXT:    s_endpgm
484;
485; GFX10-CU-LABEL: wavefront_acquire_fence:
486; GFX10-CU:       ; %bb.0: ; %entry
487; GFX10-CU-NEXT:    s_endpgm
488;
489; SKIP-CACHE-INV-LABEL: wavefront_acquire_fence:
490; SKIP-CACHE-INV:       ; %bb.0: ; %entry
491; SKIP-CACHE-INV-NEXT:    s_endpgm
492;
493; GFX90A-NOTTGSPLIT-LABEL: wavefront_acquire_fence:
494; GFX90A-NOTTGSPLIT:       ; %bb.0: ; %entry
495; GFX90A-NOTTGSPLIT-NEXT:    s_endpgm
496;
497; GFX90A-TGSPLIT-LABEL: wavefront_acquire_fence:
498; GFX90A-TGSPLIT:       ; %bb.0: ; %entry
499; GFX90A-TGSPLIT-NEXT:    s_endpgm
500;
501; GFX940-NOTTGSPLIT-LABEL: wavefront_acquire_fence:
502; GFX940-NOTTGSPLIT:       ; %bb.0: ; %entry
503; GFX940-NOTTGSPLIT-NEXT:    s_endpgm
504;
505; GFX940-TGSPLIT-LABEL: wavefront_acquire_fence:
506; GFX940-TGSPLIT:       ; %bb.0: ; %entry
507; GFX940-TGSPLIT-NEXT:    s_endpgm
508;
509; GFX11-WGP-LABEL: wavefront_acquire_fence:
510; GFX11-WGP:       ; %bb.0: ; %entry
511; GFX11-WGP-NEXT:    s_endpgm
512;
513; GFX11-CU-LABEL: wavefront_acquire_fence:
514; GFX11-CU:       ; %bb.0: ; %entry
515; GFX11-CU-NEXT:    s_endpgm
516;
517; GFX12-WGP-LABEL: wavefront_acquire_fence:
518; GFX12-WGP:       ; %bb.0: ; %entry
519; GFX12-WGP-NEXT:    s_endpgm
520;
521; GFX12-CU-LABEL: wavefront_acquire_fence:
522; GFX12-CU:       ; %bb.0: ; %entry
523; GFX12-CU-NEXT:    s_endpgm
524entry:
525  fence syncscope("wavefront") acquire
526  ret void
527}
528
529define amdgpu_kernel void @wavefront_release_fence() {
530; GFX6-LABEL: wavefront_release_fence:
531; GFX6:       ; %bb.0: ; %entry
532; GFX6-NEXT:    s_endpgm
533;
534; GFX7-LABEL: wavefront_release_fence:
535; GFX7:       ; %bb.0: ; %entry
536; GFX7-NEXT:    s_endpgm
537;
538; GFX10-WGP-LABEL: wavefront_release_fence:
539; GFX10-WGP:       ; %bb.0: ; %entry
540; GFX10-WGP-NEXT:    s_endpgm
541;
542; GFX10-CU-LABEL: wavefront_release_fence:
543; GFX10-CU:       ; %bb.0: ; %entry
544; GFX10-CU-NEXT:    s_endpgm
545;
546; SKIP-CACHE-INV-LABEL: wavefront_release_fence:
547; SKIP-CACHE-INV:       ; %bb.0: ; %entry
548; SKIP-CACHE-INV-NEXT:    s_endpgm
549;
550; GFX90A-NOTTGSPLIT-LABEL: wavefront_release_fence:
551; GFX90A-NOTTGSPLIT:       ; %bb.0: ; %entry
552; GFX90A-NOTTGSPLIT-NEXT:    s_endpgm
553;
554; GFX90A-TGSPLIT-LABEL: wavefront_release_fence:
555; GFX90A-TGSPLIT:       ; %bb.0: ; %entry
556; GFX90A-TGSPLIT-NEXT:    s_endpgm
557;
558; GFX940-NOTTGSPLIT-LABEL: wavefront_release_fence:
559; GFX940-NOTTGSPLIT:       ; %bb.0: ; %entry
560; GFX940-NOTTGSPLIT-NEXT:    s_endpgm
561;
562; GFX940-TGSPLIT-LABEL: wavefront_release_fence:
563; GFX940-TGSPLIT:       ; %bb.0: ; %entry
564; GFX940-TGSPLIT-NEXT:    s_endpgm
565;
566; GFX11-WGP-LABEL: wavefront_release_fence:
567; GFX11-WGP:       ; %bb.0: ; %entry
568; GFX11-WGP-NEXT:    s_endpgm
569;
570; GFX11-CU-LABEL: wavefront_release_fence:
571; GFX11-CU:       ; %bb.0: ; %entry
572; GFX11-CU-NEXT:    s_endpgm
573;
574; GFX12-WGP-LABEL: wavefront_release_fence:
575; GFX12-WGP:       ; %bb.0: ; %entry
576; GFX12-WGP-NEXT:    s_endpgm
577;
578; GFX12-CU-LABEL: wavefront_release_fence:
579; GFX12-CU:       ; %bb.0: ; %entry
580; GFX12-CU-NEXT:    s_endpgm
581entry:
582  fence syncscope("wavefront") release
583  ret void
584}
585
586define amdgpu_kernel void @wavefront_acq_rel_fence() {
587; GFX6-LABEL: wavefront_acq_rel_fence:
588; GFX6:       ; %bb.0: ; %entry
589; GFX6-NEXT:    s_endpgm
590;
591; GFX7-LABEL: wavefront_acq_rel_fence:
592; GFX7:       ; %bb.0: ; %entry
593; GFX7-NEXT:    s_endpgm
594;
595; GFX10-WGP-LABEL: wavefront_acq_rel_fence:
596; GFX10-WGP:       ; %bb.0: ; %entry
597; GFX10-WGP-NEXT:    s_endpgm
598;
599; GFX10-CU-LABEL: wavefront_acq_rel_fence:
600; GFX10-CU:       ; %bb.0: ; %entry
601; GFX10-CU-NEXT:    s_endpgm
602;
603; SKIP-CACHE-INV-LABEL: wavefront_acq_rel_fence:
604; SKIP-CACHE-INV:       ; %bb.0: ; %entry
605; SKIP-CACHE-INV-NEXT:    s_endpgm
606;
607; GFX90A-NOTTGSPLIT-LABEL: wavefront_acq_rel_fence:
608; GFX90A-NOTTGSPLIT:       ; %bb.0: ; %entry
609; GFX90A-NOTTGSPLIT-NEXT:    s_endpgm
610;
611; GFX90A-TGSPLIT-LABEL: wavefront_acq_rel_fence:
612; GFX90A-TGSPLIT:       ; %bb.0: ; %entry
613; GFX90A-TGSPLIT-NEXT:    s_endpgm
614;
615; GFX940-NOTTGSPLIT-LABEL: wavefront_acq_rel_fence:
616; GFX940-NOTTGSPLIT:       ; %bb.0: ; %entry
617; GFX940-NOTTGSPLIT-NEXT:    s_endpgm
618;
619; GFX940-TGSPLIT-LABEL: wavefront_acq_rel_fence:
620; GFX940-TGSPLIT:       ; %bb.0: ; %entry
621; GFX940-TGSPLIT-NEXT:    s_endpgm
622;
623; GFX11-WGP-LABEL: wavefront_acq_rel_fence:
624; GFX11-WGP:       ; %bb.0: ; %entry
625; GFX11-WGP-NEXT:    s_endpgm
626;
627; GFX11-CU-LABEL: wavefront_acq_rel_fence:
628; GFX11-CU:       ; %bb.0: ; %entry
629; GFX11-CU-NEXT:    s_endpgm
630;
631; GFX12-WGP-LABEL: wavefront_acq_rel_fence:
632; GFX12-WGP:       ; %bb.0: ; %entry
633; GFX12-WGP-NEXT:    s_endpgm
634;
635; GFX12-CU-LABEL: wavefront_acq_rel_fence:
636; GFX12-CU:       ; %bb.0: ; %entry
637; GFX12-CU-NEXT:    s_endpgm
638entry:
639  fence syncscope("wavefront") acq_rel
640  ret void
641}
642
643define amdgpu_kernel void @wavefront_seq_cst_fence() {
644; GFX6-LABEL: wavefront_seq_cst_fence:
645; GFX6:       ; %bb.0: ; %entry
646; GFX6-NEXT:    s_endpgm
647;
648; GFX7-LABEL: wavefront_seq_cst_fence:
649; GFX7:       ; %bb.0: ; %entry
650; GFX7-NEXT:    s_endpgm
651;
652; GFX10-WGP-LABEL: wavefront_seq_cst_fence:
653; GFX10-WGP:       ; %bb.0: ; %entry
654; GFX10-WGP-NEXT:    s_endpgm
655;
656; GFX10-CU-LABEL: wavefront_seq_cst_fence:
657; GFX10-CU:       ; %bb.0: ; %entry
658; GFX10-CU-NEXT:    s_endpgm
659;
660; SKIP-CACHE-INV-LABEL: wavefront_seq_cst_fence:
661; SKIP-CACHE-INV:       ; %bb.0: ; %entry
662; SKIP-CACHE-INV-NEXT:    s_endpgm
663;
664; GFX90A-NOTTGSPLIT-LABEL: wavefront_seq_cst_fence:
665; GFX90A-NOTTGSPLIT:       ; %bb.0: ; %entry
666; GFX90A-NOTTGSPLIT-NEXT:    s_endpgm
667;
668; GFX90A-TGSPLIT-LABEL: wavefront_seq_cst_fence:
669; GFX90A-TGSPLIT:       ; %bb.0: ; %entry
670; GFX90A-TGSPLIT-NEXT:    s_endpgm
671;
672; GFX940-NOTTGSPLIT-LABEL: wavefront_seq_cst_fence:
673; GFX940-NOTTGSPLIT:       ; %bb.0: ; %entry
674; GFX940-NOTTGSPLIT-NEXT:    s_endpgm
675;
676; GFX940-TGSPLIT-LABEL: wavefront_seq_cst_fence:
677; GFX940-TGSPLIT:       ; %bb.0: ; %entry
678; GFX940-TGSPLIT-NEXT:    s_endpgm
679;
680; GFX11-WGP-LABEL: wavefront_seq_cst_fence:
681; GFX11-WGP:       ; %bb.0: ; %entry
682; GFX11-WGP-NEXT:    s_endpgm
683;
684; GFX11-CU-LABEL: wavefront_seq_cst_fence:
685; GFX11-CU:       ; %bb.0: ; %entry
686; GFX11-CU-NEXT:    s_endpgm
687;
688; GFX12-WGP-LABEL: wavefront_seq_cst_fence:
689; GFX12-WGP:       ; %bb.0: ; %entry
690; GFX12-WGP-NEXT:    s_endpgm
691;
692; GFX12-CU-LABEL: wavefront_seq_cst_fence:
693; GFX12-CU:       ; %bb.0: ; %entry
694; GFX12-CU-NEXT:    s_endpgm
695entry:
696  fence syncscope("wavefront") seq_cst
697  ret void
698}
699
700define amdgpu_kernel void @wavefront_one_as_acquire_fence() {
701; GFX6-LABEL: wavefront_one_as_acquire_fence:
702; GFX6:       ; %bb.0: ; %entry
703; GFX6-NEXT:    s_endpgm
704;
705; GFX7-LABEL: wavefront_one_as_acquire_fence:
706; GFX7:       ; %bb.0: ; %entry
707; GFX7-NEXT:    s_endpgm
708;
709; GFX10-WGP-LABEL: wavefront_one_as_acquire_fence:
710; GFX10-WGP:       ; %bb.0: ; %entry
711; GFX10-WGP-NEXT:    s_endpgm
712;
713; GFX10-CU-LABEL: wavefront_one_as_acquire_fence:
714; GFX10-CU:       ; %bb.0: ; %entry
715; GFX10-CU-NEXT:    s_endpgm
716;
717; SKIP-CACHE-INV-LABEL: wavefront_one_as_acquire_fence:
718; SKIP-CACHE-INV:       ; %bb.0: ; %entry
719; SKIP-CACHE-INV-NEXT:    s_endpgm
720;
721; GFX90A-NOTTGSPLIT-LABEL: wavefront_one_as_acquire_fence:
722; GFX90A-NOTTGSPLIT:       ; %bb.0: ; %entry
723; GFX90A-NOTTGSPLIT-NEXT:    s_endpgm
724;
725; GFX90A-TGSPLIT-LABEL: wavefront_one_as_acquire_fence:
726; GFX90A-TGSPLIT:       ; %bb.0: ; %entry
727; GFX90A-TGSPLIT-NEXT:    s_endpgm
728;
729; GFX940-NOTTGSPLIT-LABEL: wavefront_one_as_acquire_fence:
730; GFX940-NOTTGSPLIT:       ; %bb.0: ; %entry
731; GFX940-NOTTGSPLIT-NEXT:    s_endpgm
732;
733; GFX940-TGSPLIT-LABEL: wavefront_one_as_acquire_fence:
734; GFX940-TGSPLIT:       ; %bb.0: ; %entry
735; GFX940-TGSPLIT-NEXT:    s_endpgm
736;
737; GFX11-WGP-LABEL: wavefront_one_as_acquire_fence:
738; GFX11-WGP:       ; %bb.0: ; %entry
739; GFX11-WGP-NEXT:    s_endpgm
740;
741; GFX11-CU-LABEL: wavefront_one_as_acquire_fence:
742; GFX11-CU:       ; %bb.0: ; %entry
743; GFX11-CU-NEXT:    s_endpgm
744;
745; GFX12-WGP-LABEL: wavefront_one_as_acquire_fence:
746; GFX12-WGP:       ; %bb.0: ; %entry
747; GFX12-WGP-NEXT:    s_endpgm
748;
749; GFX12-CU-LABEL: wavefront_one_as_acquire_fence:
750; GFX12-CU:       ; %bb.0: ; %entry
751; GFX12-CU-NEXT:    s_endpgm
752entry:
753  fence syncscope("wavefront-one-as") acquire
754  ret void
755}
756
757define amdgpu_kernel void @wavefront_one_as_release_fence() {
758; GFX6-LABEL: wavefront_one_as_release_fence:
759; GFX6:       ; %bb.0: ; %entry
760; GFX6-NEXT:    s_endpgm
761;
762; GFX7-LABEL: wavefront_one_as_release_fence:
763; GFX7:       ; %bb.0: ; %entry
764; GFX7-NEXT:    s_endpgm
765;
766; GFX10-WGP-LABEL: wavefront_one_as_release_fence:
767; GFX10-WGP:       ; %bb.0: ; %entry
768; GFX10-WGP-NEXT:    s_endpgm
769;
770; GFX10-CU-LABEL: wavefront_one_as_release_fence:
771; GFX10-CU:       ; %bb.0: ; %entry
772; GFX10-CU-NEXT:    s_endpgm
773;
774; SKIP-CACHE-INV-LABEL: wavefront_one_as_release_fence:
775; SKIP-CACHE-INV:       ; %bb.0: ; %entry
776; SKIP-CACHE-INV-NEXT:    s_endpgm
777;
778; GFX90A-NOTTGSPLIT-LABEL: wavefront_one_as_release_fence:
779; GFX90A-NOTTGSPLIT:       ; %bb.0: ; %entry
780; GFX90A-NOTTGSPLIT-NEXT:    s_endpgm
781;
782; GFX90A-TGSPLIT-LABEL: wavefront_one_as_release_fence:
783; GFX90A-TGSPLIT:       ; %bb.0: ; %entry
784; GFX90A-TGSPLIT-NEXT:    s_endpgm
785;
786; GFX940-NOTTGSPLIT-LABEL: wavefront_one_as_release_fence:
787; GFX940-NOTTGSPLIT:       ; %bb.0: ; %entry
788; GFX940-NOTTGSPLIT-NEXT:    s_endpgm
789;
790; GFX940-TGSPLIT-LABEL: wavefront_one_as_release_fence:
791; GFX940-TGSPLIT:       ; %bb.0: ; %entry
792; GFX940-TGSPLIT-NEXT:    s_endpgm
793;
794; GFX11-WGP-LABEL: wavefront_one_as_release_fence:
795; GFX11-WGP:       ; %bb.0: ; %entry
796; GFX11-WGP-NEXT:    s_endpgm
797;
798; GFX11-CU-LABEL: wavefront_one_as_release_fence:
799; GFX11-CU:       ; %bb.0: ; %entry
800; GFX11-CU-NEXT:    s_endpgm
801;
802; GFX12-WGP-LABEL: wavefront_one_as_release_fence:
803; GFX12-WGP:       ; %bb.0: ; %entry
804; GFX12-WGP-NEXT:    s_endpgm
805;
806; GFX12-CU-LABEL: wavefront_one_as_release_fence:
807; GFX12-CU:       ; %bb.0: ; %entry
808; GFX12-CU-NEXT:    s_endpgm
809entry:
810  fence syncscope("wavefront-one-as") release
811  ret void
812}
813
814define amdgpu_kernel void @wavefront_one_as_acq_rel_fence() {
815; GFX6-LABEL: wavefront_one_as_acq_rel_fence:
816; GFX6:       ; %bb.0: ; %entry
817; GFX6-NEXT:    s_endpgm
818;
819; GFX7-LABEL: wavefront_one_as_acq_rel_fence:
820; GFX7:       ; %bb.0: ; %entry
821; GFX7-NEXT:    s_endpgm
822;
823; GFX10-WGP-LABEL: wavefront_one_as_acq_rel_fence:
824; GFX10-WGP:       ; %bb.0: ; %entry
825; GFX10-WGP-NEXT:    s_endpgm
826;
827; GFX10-CU-LABEL: wavefront_one_as_acq_rel_fence:
828; GFX10-CU:       ; %bb.0: ; %entry
829; GFX10-CU-NEXT:    s_endpgm
830;
831; SKIP-CACHE-INV-LABEL: wavefront_one_as_acq_rel_fence:
832; SKIP-CACHE-INV:       ; %bb.0: ; %entry
833; SKIP-CACHE-INV-NEXT:    s_endpgm
834;
835; GFX90A-NOTTGSPLIT-LABEL: wavefront_one_as_acq_rel_fence:
836; GFX90A-NOTTGSPLIT:       ; %bb.0: ; %entry
837; GFX90A-NOTTGSPLIT-NEXT:    s_endpgm
838;
839; GFX90A-TGSPLIT-LABEL: wavefront_one_as_acq_rel_fence:
840; GFX90A-TGSPLIT:       ; %bb.0: ; %entry
841; GFX90A-TGSPLIT-NEXT:    s_endpgm
842;
843; GFX940-NOTTGSPLIT-LABEL: wavefront_one_as_acq_rel_fence:
844; GFX940-NOTTGSPLIT:       ; %bb.0: ; %entry
845; GFX940-NOTTGSPLIT-NEXT:    s_endpgm
846;
847; GFX940-TGSPLIT-LABEL: wavefront_one_as_acq_rel_fence:
848; GFX940-TGSPLIT:       ; %bb.0: ; %entry
849; GFX940-TGSPLIT-NEXT:    s_endpgm
850;
851; GFX11-WGP-LABEL: wavefront_one_as_acq_rel_fence:
852; GFX11-WGP:       ; %bb.0: ; %entry
853; GFX11-WGP-NEXT:    s_endpgm
854;
855; GFX11-CU-LABEL: wavefront_one_as_acq_rel_fence:
856; GFX11-CU:       ; %bb.0: ; %entry
857; GFX11-CU-NEXT:    s_endpgm
858;
859; GFX12-WGP-LABEL: wavefront_one_as_acq_rel_fence:
860; GFX12-WGP:       ; %bb.0: ; %entry
861; GFX12-WGP-NEXT:    s_endpgm
862;
863; GFX12-CU-LABEL: wavefront_one_as_acq_rel_fence:
864; GFX12-CU:       ; %bb.0: ; %entry
865; GFX12-CU-NEXT:    s_endpgm
866entry:
867  fence syncscope("wavefront-one-as") acq_rel
868  ret void
869}
870
871define amdgpu_kernel void @wavefront_one_as_seq_cst_fence() {
872; GFX6-LABEL: wavefront_one_as_seq_cst_fence:
873; GFX6:       ; %bb.0: ; %entry
874; GFX6-NEXT:    s_endpgm
875;
876; GFX7-LABEL: wavefront_one_as_seq_cst_fence:
877; GFX7:       ; %bb.0: ; %entry
878; GFX7-NEXT:    s_endpgm
879;
880; GFX10-WGP-LABEL: wavefront_one_as_seq_cst_fence:
881; GFX10-WGP:       ; %bb.0: ; %entry
882; GFX10-WGP-NEXT:    s_endpgm
883;
884; GFX10-CU-LABEL: wavefront_one_as_seq_cst_fence:
885; GFX10-CU:       ; %bb.0: ; %entry
886; GFX10-CU-NEXT:    s_endpgm
887;
888; SKIP-CACHE-INV-LABEL: wavefront_one_as_seq_cst_fence:
889; SKIP-CACHE-INV:       ; %bb.0: ; %entry
890; SKIP-CACHE-INV-NEXT:    s_endpgm
891;
892; GFX90A-NOTTGSPLIT-LABEL: wavefront_one_as_seq_cst_fence:
893; GFX90A-NOTTGSPLIT:       ; %bb.0: ; %entry
894; GFX90A-NOTTGSPLIT-NEXT:    s_endpgm
895;
896; GFX90A-TGSPLIT-LABEL: wavefront_one_as_seq_cst_fence:
897; GFX90A-TGSPLIT:       ; %bb.0: ; %entry
898; GFX90A-TGSPLIT-NEXT:    s_endpgm
899;
900; GFX940-NOTTGSPLIT-LABEL: wavefront_one_as_seq_cst_fence:
901; GFX940-NOTTGSPLIT:       ; %bb.0: ; %entry
902; GFX940-NOTTGSPLIT-NEXT:    s_endpgm
903;
904; GFX940-TGSPLIT-LABEL: wavefront_one_as_seq_cst_fence:
905; GFX940-TGSPLIT:       ; %bb.0: ; %entry
906; GFX940-TGSPLIT-NEXT:    s_endpgm
907;
908; GFX11-WGP-LABEL: wavefront_one_as_seq_cst_fence:
909; GFX11-WGP:       ; %bb.0: ; %entry
910; GFX11-WGP-NEXT:    s_endpgm
911;
912; GFX11-CU-LABEL: wavefront_one_as_seq_cst_fence:
913; GFX11-CU:       ; %bb.0: ; %entry
914; GFX11-CU-NEXT:    s_endpgm
915;
916; GFX12-WGP-LABEL: wavefront_one_as_seq_cst_fence:
917; GFX12-WGP:       ; %bb.0: ; %entry
918; GFX12-WGP-NEXT:    s_endpgm
919;
920; GFX12-CU-LABEL: wavefront_one_as_seq_cst_fence:
921; GFX12-CU:       ; %bb.0: ; %entry
922; GFX12-CU-NEXT:    s_endpgm
923entry:
924  fence syncscope("wavefront-one-as") seq_cst
925  ret void
926}
927
928define amdgpu_kernel void @workgroup_acquire_fence() {
929; GFX6-LABEL: workgroup_acquire_fence:
930; GFX6:       ; %bb.0: ; %entry
931; GFX6-NEXT:    s_waitcnt lgkmcnt(0)
932; GFX6-NEXT:    s_endpgm
933;
934; GFX7-LABEL: workgroup_acquire_fence:
935; GFX7:       ; %bb.0: ; %entry
936; GFX7-NEXT:    s_waitcnt lgkmcnt(0)
937; GFX7-NEXT:    s_endpgm
938;
939; GFX10-WGP-LABEL: workgroup_acquire_fence:
940; GFX10-WGP:       ; %bb.0: ; %entry
941; GFX10-WGP-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
942; GFX10-WGP-NEXT:    s_waitcnt_vscnt null, 0x0
943; GFX10-WGP-NEXT:    buffer_gl0_inv
944; GFX10-WGP-NEXT:    s_endpgm
945;
946; GFX10-CU-LABEL: workgroup_acquire_fence:
947; GFX10-CU:       ; %bb.0: ; %entry
948; GFX10-CU-NEXT:    s_waitcnt lgkmcnt(0)
949; GFX10-CU-NEXT:    s_endpgm
950;
951; SKIP-CACHE-INV-LABEL: workgroup_acquire_fence:
952; SKIP-CACHE-INV:       ; %bb.0: ; %entry
953; SKIP-CACHE-INV-NEXT:    s_waitcnt lgkmcnt(0)
954; SKIP-CACHE-INV-NEXT:    s_endpgm
955;
956; GFX90A-NOTTGSPLIT-LABEL: workgroup_acquire_fence:
957; GFX90A-NOTTGSPLIT:       ; %bb.0: ; %entry
958; GFX90A-NOTTGSPLIT-NEXT:    s_waitcnt lgkmcnt(0)
959; GFX90A-NOTTGSPLIT-NEXT:    s_endpgm
960;
961; GFX90A-TGSPLIT-LABEL: workgroup_acquire_fence:
962; GFX90A-TGSPLIT:       ; %bb.0: ; %entry
963; GFX90A-TGSPLIT-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
964; GFX90A-TGSPLIT-NEXT:    buffer_wbinvl1_vol
965; GFX90A-TGSPLIT-NEXT:    s_endpgm
966;
967; GFX940-NOTTGSPLIT-LABEL: workgroup_acquire_fence:
968; GFX940-NOTTGSPLIT:       ; %bb.0: ; %entry
969; GFX940-NOTTGSPLIT-NEXT:    s_waitcnt lgkmcnt(0)
970; GFX940-NOTTGSPLIT-NEXT:    s_endpgm
971;
972; GFX940-TGSPLIT-LABEL: workgroup_acquire_fence:
973; GFX940-TGSPLIT:       ; %bb.0: ; %entry
974; GFX940-TGSPLIT-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
975; GFX940-TGSPLIT-NEXT:    buffer_inv sc0
976; GFX940-TGSPLIT-NEXT:    s_endpgm
977;
978; GFX11-WGP-LABEL: workgroup_acquire_fence:
979; GFX11-WGP:       ; %bb.0: ; %entry
980; GFX11-WGP-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
981; GFX11-WGP-NEXT:    s_waitcnt_vscnt null, 0x0
982; GFX11-WGP-NEXT:    buffer_gl0_inv
983; GFX11-WGP-NEXT:    s_endpgm
984;
985; GFX11-CU-LABEL: workgroup_acquire_fence:
986; GFX11-CU:       ; %bb.0: ; %entry
987; GFX11-CU-NEXT:    s_waitcnt lgkmcnt(0)
988; GFX11-CU-NEXT:    s_endpgm
989;
990; GFX12-WGP-LABEL: workgroup_acquire_fence:
991; GFX12-WGP:       ; %bb.0: ; %entry
992; GFX12-WGP-NEXT:    s_wait_storecnt 0x0
993; GFX12-WGP-NEXT:    s_wait_loadcnt_dscnt 0x0
994; GFX12-WGP-NEXT:    global_inv scope:SCOPE_SE
995; GFX12-WGP-NEXT:    s_endpgm
996;
997; GFX12-CU-LABEL: workgroup_acquire_fence:
998; GFX12-CU:       ; %bb.0: ; %entry
999; GFX12-CU-NEXT:    s_wait_dscnt 0x0
1000; GFX12-CU-NEXT:    s_endpgm
1001entry:
1002  fence syncscope("workgroup") acquire
1003  ret void
1004}
1005
1006define amdgpu_kernel void @workgroup_release_fence() {
1007; GFX6-LABEL: workgroup_release_fence:
1008; GFX6:       ; %bb.0: ; %entry
1009; GFX6-NEXT:    s_waitcnt lgkmcnt(0)
1010; GFX6-NEXT:    s_endpgm
1011;
1012; GFX7-LABEL: workgroup_release_fence:
1013; GFX7:       ; %bb.0: ; %entry
1014; GFX7-NEXT:    s_waitcnt lgkmcnt(0)
1015; GFX7-NEXT:    s_endpgm
1016;
1017; GFX10-WGP-LABEL: workgroup_release_fence:
1018; GFX10-WGP:       ; %bb.0: ; %entry
1019; GFX10-WGP-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1020; GFX10-WGP-NEXT:    s_waitcnt_vscnt null, 0x0
1021; GFX10-WGP-NEXT:    s_endpgm
1022;
1023; GFX10-CU-LABEL: workgroup_release_fence:
1024; GFX10-CU:       ; %bb.0: ; %entry
1025; GFX10-CU-NEXT:    s_waitcnt lgkmcnt(0)
1026; GFX10-CU-NEXT:    s_endpgm
1027;
1028; SKIP-CACHE-INV-LABEL: workgroup_release_fence:
1029; SKIP-CACHE-INV:       ; %bb.0: ; %entry
1030; SKIP-CACHE-INV-NEXT:    s_waitcnt lgkmcnt(0)
1031; SKIP-CACHE-INV-NEXT:    s_endpgm
1032;
1033; GFX90A-NOTTGSPLIT-LABEL: workgroup_release_fence:
1034; GFX90A-NOTTGSPLIT:       ; %bb.0: ; %entry
1035; GFX90A-NOTTGSPLIT-NEXT:    s_waitcnt lgkmcnt(0)
1036; GFX90A-NOTTGSPLIT-NEXT:    s_endpgm
1037;
1038; GFX90A-TGSPLIT-LABEL: workgroup_release_fence:
1039; GFX90A-TGSPLIT:       ; %bb.0: ; %entry
1040; GFX90A-TGSPLIT-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1041; GFX90A-TGSPLIT-NEXT:    s_endpgm
1042;
1043; GFX940-NOTTGSPLIT-LABEL: workgroup_release_fence:
1044; GFX940-NOTTGSPLIT:       ; %bb.0: ; %entry
1045; GFX940-NOTTGSPLIT-NEXT:    s_waitcnt lgkmcnt(0)
1046; GFX940-NOTTGSPLIT-NEXT:    s_endpgm
1047;
1048; GFX940-TGSPLIT-LABEL: workgroup_release_fence:
1049; GFX940-TGSPLIT:       ; %bb.0: ; %entry
1050; GFX940-TGSPLIT-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1051; GFX940-TGSPLIT-NEXT:    s_endpgm
1052;
1053; GFX11-WGP-LABEL: workgroup_release_fence:
1054; GFX11-WGP:       ; %bb.0: ; %entry
1055; GFX11-WGP-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1056; GFX11-WGP-NEXT:    s_waitcnt_vscnt null, 0x0
1057; GFX11-WGP-NEXT:    s_endpgm
1058;
1059; GFX11-CU-LABEL: workgroup_release_fence:
1060; GFX11-CU:       ; %bb.0: ; %entry
1061; GFX11-CU-NEXT:    s_waitcnt lgkmcnt(0)
1062; GFX11-CU-NEXT:    s_endpgm
1063;
1064; GFX12-WGP-LABEL: workgroup_release_fence:
1065; GFX12-WGP:       ; %bb.0: ; %entry
1066; GFX12-WGP-NEXT:    s_wait_bvhcnt 0x0
1067; GFX12-WGP-NEXT:    s_wait_samplecnt 0x0
1068; GFX12-WGP-NEXT:    s_wait_storecnt 0x0
1069; GFX12-WGP-NEXT:    s_wait_loadcnt_dscnt 0x0
1070; GFX12-WGP-NEXT:    s_endpgm
1071;
1072; GFX12-CU-LABEL: workgroup_release_fence:
1073; GFX12-CU:       ; %bb.0: ; %entry
1074; GFX12-CU-NEXT:    s_wait_dscnt 0x0
1075; GFX12-CU-NEXT:    s_endpgm
1076entry:
1077  fence syncscope("workgroup") release
1078  ret void
1079}
1080
1081define amdgpu_kernel void @workgroup_acq_rel_fence() {
1082; GFX6-LABEL: workgroup_acq_rel_fence:
1083; GFX6:       ; %bb.0: ; %entry
1084; GFX6-NEXT:    s_waitcnt lgkmcnt(0)
1085; GFX6-NEXT:    s_endpgm
1086;
1087; GFX7-LABEL: workgroup_acq_rel_fence:
1088; GFX7:       ; %bb.0: ; %entry
1089; GFX7-NEXT:    s_waitcnt lgkmcnt(0)
1090; GFX7-NEXT:    s_endpgm
1091;
1092; GFX10-WGP-LABEL: workgroup_acq_rel_fence:
1093; GFX10-WGP:       ; %bb.0: ; %entry
1094; GFX10-WGP-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1095; GFX10-WGP-NEXT:    s_waitcnt_vscnt null, 0x0
1096; GFX10-WGP-NEXT:    buffer_gl0_inv
1097; GFX10-WGP-NEXT:    s_endpgm
1098;
1099; GFX10-CU-LABEL: workgroup_acq_rel_fence:
1100; GFX10-CU:       ; %bb.0: ; %entry
1101; GFX10-CU-NEXT:    s_waitcnt lgkmcnt(0)
1102; GFX10-CU-NEXT:    s_endpgm
1103;
1104; SKIP-CACHE-INV-LABEL: workgroup_acq_rel_fence:
1105; SKIP-CACHE-INV:       ; %bb.0: ; %entry
1106; SKIP-CACHE-INV-NEXT:    s_waitcnt lgkmcnt(0)
1107; SKIP-CACHE-INV-NEXT:    s_endpgm
1108;
1109; GFX90A-NOTTGSPLIT-LABEL: workgroup_acq_rel_fence:
1110; GFX90A-NOTTGSPLIT:       ; %bb.0: ; %entry
1111; GFX90A-NOTTGSPLIT-NEXT:    s_waitcnt lgkmcnt(0)
1112; GFX90A-NOTTGSPLIT-NEXT:    s_endpgm
1113;
1114; GFX90A-TGSPLIT-LABEL: workgroup_acq_rel_fence:
1115; GFX90A-TGSPLIT:       ; %bb.0: ; %entry
1116; GFX90A-TGSPLIT-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1117; GFX90A-TGSPLIT-NEXT:    buffer_wbinvl1_vol
1118; GFX90A-TGSPLIT-NEXT:    s_endpgm
1119;
1120; GFX940-NOTTGSPLIT-LABEL: workgroup_acq_rel_fence:
1121; GFX940-NOTTGSPLIT:       ; %bb.0: ; %entry
1122; GFX940-NOTTGSPLIT-NEXT:    s_waitcnt lgkmcnt(0)
1123; GFX940-NOTTGSPLIT-NEXT:    s_endpgm
1124;
1125; GFX940-TGSPLIT-LABEL: workgroup_acq_rel_fence:
1126; GFX940-TGSPLIT:       ; %bb.0: ; %entry
1127; GFX940-TGSPLIT-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1128; GFX940-TGSPLIT-NEXT:    buffer_inv sc0
1129; GFX940-TGSPLIT-NEXT:    s_endpgm
1130;
1131; GFX11-WGP-LABEL: workgroup_acq_rel_fence:
1132; GFX11-WGP:       ; %bb.0: ; %entry
1133; GFX11-WGP-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1134; GFX11-WGP-NEXT:    s_waitcnt_vscnt null, 0x0
1135; GFX11-WGP-NEXT:    buffer_gl0_inv
1136; GFX11-WGP-NEXT:    s_endpgm
1137;
1138; GFX11-CU-LABEL: workgroup_acq_rel_fence:
1139; GFX11-CU:       ; %bb.0: ; %entry
1140; GFX11-CU-NEXT:    s_waitcnt lgkmcnt(0)
1141; GFX11-CU-NEXT:    s_endpgm
1142;
1143; GFX12-WGP-LABEL: workgroup_acq_rel_fence:
1144; GFX12-WGP:       ; %bb.0: ; %entry
1145; GFX12-WGP-NEXT:    s_wait_bvhcnt 0x0
1146; GFX12-WGP-NEXT:    s_wait_samplecnt 0x0
1147; GFX12-WGP-NEXT:    s_wait_storecnt 0x0
1148; GFX12-WGP-NEXT:    s_wait_loadcnt_dscnt 0x0
1149; GFX12-WGP-NEXT:    global_inv scope:SCOPE_SE
1150; GFX12-WGP-NEXT:    s_endpgm
1151;
1152; GFX12-CU-LABEL: workgroup_acq_rel_fence:
1153; GFX12-CU:       ; %bb.0: ; %entry
1154; GFX12-CU-NEXT:    s_wait_dscnt 0x0
1155; GFX12-CU-NEXT:    s_endpgm
1156entry:
1157  fence syncscope("workgroup") acq_rel
1158  ret void
1159}
1160
1161define amdgpu_kernel void @workgroup_seq_cst_fence() {
1162; GFX6-LABEL: workgroup_seq_cst_fence:
1163; GFX6:       ; %bb.0: ; %entry
1164; GFX6-NEXT:    s_waitcnt lgkmcnt(0)
1165; GFX6-NEXT:    s_endpgm
1166;
1167; GFX7-LABEL: workgroup_seq_cst_fence:
1168; GFX7:       ; %bb.0: ; %entry
1169; GFX7-NEXT:    s_waitcnt lgkmcnt(0)
1170; GFX7-NEXT:    s_endpgm
1171;
1172; GFX10-WGP-LABEL: workgroup_seq_cst_fence:
1173; GFX10-WGP:       ; %bb.0: ; %entry
1174; GFX10-WGP-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1175; GFX10-WGP-NEXT:    s_waitcnt_vscnt null, 0x0
1176; GFX10-WGP-NEXT:    buffer_gl0_inv
1177; GFX10-WGP-NEXT:    s_endpgm
1178;
1179; GFX10-CU-LABEL: workgroup_seq_cst_fence:
1180; GFX10-CU:       ; %bb.0: ; %entry
1181; GFX10-CU-NEXT:    s_waitcnt lgkmcnt(0)
1182; GFX10-CU-NEXT:    s_endpgm
1183;
1184; SKIP-CACHE-INV-LABEL: workgroup_seq_cst_fence:
1185; SKIP-CACHE-INV:       ; %bb.0: ; %entry
1186; SKIP-CACHE-INV-NEXT:    s_waitcnt lgkmcnt(0)
1187; SKIP-CACHE-INV-NEXT:    s_endpgm
1188;
1189; GFX90A-NOTTGSPLIT-LABEL: workgroup_seq_cst_fence:
1190; GFX90A-NOTTGSPLIT:       ; %bb.0: ; %entry
1191; GFX90A-NOTTGSPLIT-NEXT:    s_waitcnt lgkmcnt(0)
1192; GFX90A-NOTTGSPLIT-NEXT:    s_endpgm
1193;
1194; GFX90A-TGSPLIT-LABEL: workgroup_seq_cst_fence:
1195; GFX90A-TGSPLIT:       ; %bb.0: ; %entry
1196; GFX90A-TGSPLIT-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1197; GFX90A-TGSPLIT-NEXT:    buffer_wbinvl1_vol
1198; GFX90A-TGSPLIT-NEXT:    s_endpgm
1199;
1200; GFX940-NOTTGSPLIT-LABEL: workgroup_seq_cst_fence:
1201; GFX940-NOTTGSPLIT:       ; %bb.0: ; %entry
1202; GFX940-NOTTGSPLIT-NEXT:    s_waitcnt lgkmcnt(0)
1203; GFX940-NOTTGSPLIT-NEXT:    s_endpgm
1204;
1205; GFX940-TGSPLIT-LABEL: workgroup_seq_cst_fence:
1206; GFX940-TGSPLIT:       ; %bb.0: ; %entry
1207; GFX940-TGSPLIT-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1208; GFX940-TGSPLIT-NEXT:    buffer_inv sc0
1209; GFX940-TGSPLIT-NEXT:    s_endpgm
1210;
1211; GFX11-WGP-LABEL: workgroup_seq_cst_fence:
1212; GFX11-WGP:       ; %bb.0: ; %entry
1213; GFX11-WGP-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1214; GFX11-WGP-NEXT:    s_waitcnt_vscnt null, 0x0
1215; GFX11-WGP-NEXT:    buffer_gl0_inv
1216; GFX11-WGP-NEXT:    s_endpgm
1217;
1218; GFX11-CU-LABEL: workgroup_seq_cst_fence:
1219; GFX11-CU:       ; %bb.0: ; %entry
1220; GFX11-CU-NEXT:    s_waitcnt lgkmcnt(0)
1221; GFX11-CU-NEXT:    s_endpgm
1222;
1223; GFX12-WGP-LABEL: workgroup_seq_cst_fence:
1224; GFX12-WGP:       ; %bb.0: ; %entry
1225; GFX12-WGP-NEXT:    s_wait_bvhcnt 0x0
1226; GFX12-WGP-NEXT:    s_wait_samplecnt 0x0
1227; GFX12-WGP-NEXT:    s_wait_storecnt 0x0
1228; GFX12-WGP-NEXT:    s_wait_loadcnt_dscnt 0x0
1229; GFX12-WGP-NEXT:    global_inv scope:SCOPE_SE
1230; GFX12-WGP-NEXT:    s_endpgm
1231;
1232; GFX12-CU-LABEL: workgroup_seq_cst_fence:
1233; GFX12-CU:       ; %bb.0: ; %entry
1234; GFX12-CU-NEXT:    s_wait_dscnt 0x0
1235; GFX12-CU-NEXT:    s_endpgm
1236entry:
1237  fence syncscope("workgroup") seq_cst
1238  ret void
1239}
1240
1241define amdgpu_kernel void @workgroup_one_as_acquire_fence() {
1242; GFX6-LABEL: workgroup_one_as_acquire_fence:
1243; GFX6:       ; %bb.0: ; %entry
1244; GFX6-NEXT:    s_endpgm
1245;
1246; GFX7-LABEL: workgroup_one_as_acquire_fence:
1247; GFX7:       ; %bb.0: ; %entry
1248; GFX7-NEXT:    s_endpgm
1249;
1250; GFX10-WGP-LABEL: workgroup_one_as_acquire_fence:
1251; GFX10-WGP:       ; %bb.0: ; %entry
1252; GFX10-WGP-NEXT:    s_waitcnt vmcnt(0)
1253; GFX10-WGP-NEXT:    s_waitcnt_vscnt null, 0x0
1254; GFX10-WGP-NEXT:    buffer_gl0_inv
1255; GFX10-WGP-NEXT:    s_endpgm
1256;
1257; GFX10-CU-LABEL: workgroup_one_as_acquire_fence:
1258; GFX10-CU:       ; %bb.0: ; %entry
1259; GFX10-CU-NEXT:    s_endpgm
1260;
1261; SKIP-CACHE-INV-LABEL: workgroup_one_as_acquire_fence:
1262; SKIP-CACHE-INV:       ; %bb.0: ; %entry
1263; SKIP-CACHE-INV-NEXT:    s_endpgm
1264;
1265; GFX90A-NOTTGSPLIT-LABEL: workgroup_one_as_acquire_fence:
1266; GFX90A-NOTTGSPLIT:       ; %bb.0: ; %entry
1267; GFX90A-NOTTGSPLIT-NEXT:    s_endpgm
1268;
1269; GFX90A-TGSPLIT-LABEL: workgroup_one_as_acquire_fence:
1270; GFX90A-TGSPLIT:       ; %bb.0: ; %entry
1271; GFX90A-TGSPLIT-NEXT:    s_waitcnt vmcnt(0)
1272; GFX90A-TGSPLIT-NEXT:    buffer_wbinvl1_vol
1273; GFX90A-TGSPLIT-NEXT:    s_endpgm
1274;
1275; GFX940-NOTTGSPLIT-LABEL: workgroup_one_as_acquire_fence:
1276; GFX940-NOTTGSPLIT:       ; %bb.0: ; %entry
1277; GFX940-NOTTGSPLIT-NEXT:    s_endpgm
1278;
1279; GFX940-TGSPLIT-LABEL: workgroup_one_as_acquire_fence:
1280; GFX940-TGSPLIT:       ; %bb.0: ; %entry
1281; GFX940-TGSPLIT-NEXT:    s_waitcnt vmcnt(0)
1282; GFX940-TGSPLIT-NEXT:    buffer_inv sc0
1283; GFX940-TGSPLIT-NEXT:    s_endpgm
1284;
1285; GFX11-WGP-LABEL: workgroup_one_as_acquire_fence:
1286; GFX11-WGP:       ; %bb.0: ; %entry
1287; GFX11-WGP-NEXT:    s_waitcnt vmcnt(0)
1288; GFX11-WGP-NEXT:    s_waitcnt_vscnt null, 0x0
1289; GFX11-WGP-NEXT:    buffer_gl0_inv
1290; GFX11-WGP-NEXT:    s_endpgm
1291;
1292; GFX11-CU-LABEL: workgroup_one_as_acquire_fence:
1293; GFX11-CU:       ; %bb.0: ; %entry
1294; GFX11-CU-NEXT:    s_endpgm
1295;
1296; GFX12-WGP-LABEL: workgroup_one_as_acquire_fence:
1297; GFX12-WGP:       ; %bb.0: ; %entry
1298; GFX12-WGP-NEXT:    s_wait_loadcnt 0x0
1299; GFX12-WGP-NEXT:    s_wait_storecnt 0x0
1300; GFX12-WGP-NEXT:    global_inv scope:SCOPE_SE
1301; GFX12-WGP-NEXT:    s_endpgm
1302;
1303; GFX12-CU-LABEL: workgroup_one_as_acquire_fence:
1304; GFX12-CU:       ; %bb.0: ; %entry
1305; GFX12-CU-NEXT:    s_endpgm
1306entry:
1307  fence syncscope("workgroup-one-as") acquire
1308  ret void
1309}
1310
1311define amdgpu_kernel void @workgroup_one_as_release_fence() {
1312; GFX6-LABEL: workgroup_one_as_release_fence:
1313; GFX6:       ; %bb.0: ; %entry
1314; GFX6-NEXT:    s_endpgm
1315;
1316; GFX7-LABEL: workgroup_one_as_release_fence:
1317; GFX7:       ; %bb.0: ; %entry
1318; GFX7-NEXT:    s_endpgm
1319;
1320; GFX10-WGP-LABEL: workgroup_one_as_release_fence:
1321; GFX10-WGP:       ; %bb.0: ; %entry
1322; GFX10-WGP-NEXT:    s_waitcnt vmcnt(0)
1323; GFX10-WGP-NEXT:    s_waitcnt_vscnt null, 0x0
1324; GFX10-WGP-NEXT:    s_endpgm
1325;
1326; GFX10-CU-LABEL: workgroup_one_as_release_fence:
1327; GFX10-CU:       ; %bb.0: ; %entry
1328; GFX10-CU-NEXT:    s_endpgm
1329;
1330; SKIP-CACHE-INV-LABEL: workgroup_one_as_release_fence:
1331; SKIP-CACHE-INV:       ; %bb.0: ; %entry
1332; SKIP-CACHE-INV-NEXT:    s_endpgm
1333;
1334; GFX90A-NOTTGSPLIT-LABEL: workgroup_one_as_release_fence:
1335; GFX90A-NOTTGSPLIT:       ; %bb.0: ; %entry
1336; GFX90A-NOTTGSPLIT-NEXT:    s_endpgm
1337;
1338; GFX90A-TGSPLIT-LABEL: workgroup_one_as_release_fence:
1339; GFX90A-TGSPLIT:       ; %bb.0: ; %entry
1340; GFX90A-TGSPLIT-NEXT:    s_waitcnt vmcnt(0)
1341; GFX90A-TGSPLIT-NEXT:    s_endpgm
1342;
1343; GFX940-NOTTGSPLIT-LABEL: workgroup_one_as_release_fence:
1344; GFX940-NOTTGSPLIT:       ; %bb.0: ; %entry
1345; GFX940-NOTTGSPLIT-NEXT:    s_endpgm
1346;
1347; GFX940-TGSPLIT-LABEL: workgroup_one_as_release_fence:
1348; GFX940-TGSPLIT:       ; %bb.0: ; %entry
1349; GFX940-TGSPLIT-NEXT:    s_waitcnt vmcnt(0)
1350; GFX940-TGSPLIT-NEXT:    s_endpgm
1351;
1352; GFX11-WGP-LABEL: workgroup_one_as_release_fence:
1353; GFX11-WGP:       ; %bb.0: ; %entry
1354; GFX11-WGP-NEXT:    s_waitcnt vmcnt(0)
1355; GFX11-WGP-NEXT:    s_waitcnt_vscnt null, 0x0
1356; GFX11-WGP-NEXT:    s_endpgm
1357;
1358; GFX11-CU-LABEL: workgroup_one_as_release_fence:
1359; GFX11-CU:       ; %bb.0: ; %entry
1360; GFX11-CU-NEXT:    s_endpgm
1361;
1362; GFX12-WGP-LABEL: workgroup_one_as_release_fence:
1363; GFX12-WGP:       ; %bb.0: ; %entry
1364; GFX12-WGP-NEXT:    s_wait_bvhcnt 0x0
1365; GFX12-WGP-NEXT:    s_wait_samplecnt 0x0
1366; GFX12-WGP-NEXT:    s_wait_loadcnt 0x0
1367; GFX12-WGP-NEXT:    s_wait_storecnt 0x0
1368; GFX12-WGP-NEXT:    s_endpgm
1369;
1370; GFX12-CU-LABEL: workgroup_one_as_release_fence:
1371; GFX12-CU:       ; %bb.0: ; %entry
1372; GFX12-CU-NEXT:    s_endpgm
1373entry:
1374  fence syncscope("workgroup-one-as") release
1375  ret void
1376}
1377
1378define amdgpu_kernel void @workgroup_one_as_acq_rel_fence() {
1379; GFX6-LABEL: workgroup_one_as_acq_rel_fence:
1380; GFX6:       ; %bb.0: ; %entry
1381; GFX6-NEXT:    s_endpgm
1382;
1383; GFX7-LABEL: workgroup_one_as_acq_rel_fence:
1384; GFX7:       ; %bb.0: ; %entry
1385; GFX7-NEXT:    s_endpgm
1386;
1387; GFX10-WGP-LABEL: workgroup_one_as_acq_rel_fence:
1388; GFX10-WGP:       ; %bb.0: ; %entry
1389; GFX10-WGP-NEXT:    s_waitcnt vmcnt(0)
1390; GFX10-WGP-NEXT:    s_waitcnt_vscnt null, 0x0
1391; GFX10-WGP-NEXT:    buffer_gl0_inv
1392; GFX10-WGP-NEXT:    s_endpgm
1393;
1394; GFX10-CU-LABEL: workgroup_one_as_acq_rel_fence:
1395; GFX10-CU:       ; %bb.0: ; %entry
1396; GFX10-CU-NEXT:    s_endpgm
1397;
1398; SKIP-CACHE-INV-LABEL: workgroup_one_as_acq_rel_fence:
1399; SKIP-CACHE-INV:       ; %bb.0: ; %entry
1400; SKIP-CACHE-INV-NEXT:    s_endpgm
1401;
1402; GFX90A-NOTTGSPLIT-LABEL: workgroup_one_as_acq_rel_fence:
1403; GFX90A-NOTTGSPLIT:       ; %bb.0: ; %entry
1404; GFX90A-NOTTGSPLIT-NEXT:    s_endpgm
1405;
1406; GFX90A-TGSPLIT-LABEL: workgroup_one_as_acq_rel_fence:
1407; GFX90A-TGSPLIT:       ; %bb.0: ; %entry
1408; GFX90A-TGSPLIT-NEXT:    s_waitcnt vmcnt(0)
1409; GFX90A-TGSPLIT-NEXT:    buffer_wbinvl1_vol
1410; GFX90A-TGSPLIT-NEXT:    s_endpgm
1411;
1412; GFX940-NOTTGSPLIT-LABEL: workgroup_one_as_acq_rel_fence:
1413; GFX940-NOTTGSPLIT:       ; %bb.0: ; %entry
1414; GFX940-NOTTGSPLIT-NEXT:    s_endpgm
1415;
1416; GFX940-TGSPLIT-LABEL: workgroup_one_as_acq_rel_fence:
1417; GFX940-TGSPLIT:       ; %bb.0: ; %entry
1418; GFX940-TGSPLIT-NEXT:    s_waitcnt vmcnt(0)
1419; GFX940-TGSPLIT-NEXT:    buffer_inv sc0
1420; GFX940-TGSPLIT-NEXT:    s_endpgm
1421;
1422; GFX11-WGP-LABEL: workgroup_one_as_acq_rel_fence:
1423; GFX11-WGP:       ; %bb.0: ; %entry
1424; GFX11-WGP-NEXT:    s_waitcnt vmcnt(0)
1425; GFX11-WGP-NEXT:    s_waitcnt_vscnt null, 0x0
1426; GFX11-WGP-NEXT:    buffer_gl0_inv
1427; GFX11-WGP-NEXT:    s_endpgm
1428;
1429; GFX11-CU-LABEL: workgroup_one_as_acq_rel_fence:
1430; GFX11-CU:       ; %bb.0: ; %entry
1431; GFX11-CU-NEXT:    s_endpgm
1432;
1433; GFX12-WGP-LABEL: workgroup_one_as_acq_rel_fence:
1434; GFX12-WGP:       ; %bb.0: ; %entry
1435; GFX12-WGP-NEXT:    s_wait_bvhcnt 0x0
1436; GFX12-WGP-NEXT:    s_wait_samplecnt 0x0
1437; GFX12-WGP-NEXT:    s_wait_loadcnt 0x0
1438; GFX12-WGP-NEXT:    s_wait_storecnt 0x0
1439; GFX12-WGP-NEXT:    global_inv scope:SCOPE_SE
1440; GFX12-WGP-NEXT:    s_endpgm
1441;
1442; GFX12-CU-LABEL: workgroup_one_as_acq_rel_fence:
1443; GFX12-CU:       ; %bb.0: ; %entry
1444; GFX12-CU-NEXT:    s_endpgm
1445entry:
1446  fence syncscope("workgroup-one-as") acq_rel
1447  ret void
1448}
1449
1450define amdgpu_kernel void @workgroup_one_as_seq_cst_fence() {
1451; GFX6-LABEL: workgroup_one_as_seq_cst_fence:
1452; GFX6:       ; %bb.0: ; %entry
1453; GFX6-NEXT:    s_endpgm
1454;
1455; GFX7-LABEL: workgroup_one_as_seq_cst_fence:
1456; GFX7:       ; %bb.0: ; %entry
1457; GFX7-NEXT:    s_endpgm
1458;
1459; GFX10-WGP-LABEL: workgroup_one_as_seq_cst_fence:
1460; GFX10-WGP:       ; %bb.0: ; %entry
1461; GFX10-WGP-NEXT:    s_waitcnt vmcnt(0)
1462; GFX10-WGP-NEXT:    s_waitcnt_vscnt null, 0x0
1463; GFX10-WGP-NEXT:    buffer_gl0_inv
1464; GFX10-WGP-NEXT:    s_endpgm
1465;
1466; GFX10-CU-LABEL: workgroup_one_as_seq_cst_fence:
1467; GFX10-CU:       ; %bb.0: ; %entry
1468; GFX10-CU-NEXT:    s_endpgm
1469;
1470; SKIP-CACHE-INV-LABEL: workgroup_one_as_seq_cst_fence:
1471; SKIP-CACHE-INV:       ; %bb.0: ; %entry
1472; SKIP-CACHE-INV-NEXT:    s_endpgm
1473;
1474; GFX90A-NOTTGSPLIT-LABEL: workgroup_one_as_seq_cst_fence:
1475; GFX90A-NOTTGSPLIT:       ; %bb.0: ; %entry
1476; GFX90A-NOTTGSPLIT-NEXT:    s_endpgm
1477;
1478; GFX90A-TGSPLIT-LABEL: workgroup_one_as_seq_cst_fence:
1479; GFX90A-TGSPLIT:       ; %bb.0: ; %entry
1480; GFX90A-TGSPLIT-NEXT:    s_waitcnt vmcnt(0)
1481; GFX90A-TGSPLIT-NEXT:    buffer_wbinvl1_vol
1482; GFX90A-TGSPLIT-NEXT:    s_endpgm
1483;
1484; GFX940-NOTTGSPLIT-LABEL: workgroup_one_as_seq_cst_fence:
1485; GFX940-NOTTGSPLIT:       ; %bb.0: ; %entry
1486; GFX940-NOTTGSPLIT-NEXT:    s_endpgm
1487;
1488; GFX940-TGSPLIT-LABEL: workgroup_one_as_seq_cst_fence:
1489; GFX940-TGSPLIT:       ; %bb.0: ; %entry
1490; GFX940-TGSPLIT-NEXT:    s_waitcnt vmcnt(0)
1491; GFX940-TGSPLIT-NEXT:    buffer_inv sc0
1492; GFX940-TGSPLIT-NEXT:    s_endpgm
1493;
1494; GFX11-WGP-LABEL: workgroup_one_as_seq_cst_fence:
1495; GFX11-WGP:       ; %bb.0: ; %entry
1496; GFX11-WGP-NEXT:    s_waitcnt vmcnt(0)
1497; GFX11-WGP-NEXT:    s_waitcnt_vscnt null, 0x0
1498; GFX11-WGP-NEXT:    buffer_gl0_inv
1499; GFX11-WGP-NEXT:    s_endpgm
1500;
1501; GFX11-CU-LABEL: workgroup_one_as_seq_cst_fence:
1502; GFX11-CU:       ; %bb.0: ; %entry
1503; GFX11-CU-NEXT:    s_endpgm
1504;
1505; GFX12-WGP-LABEL: workgroup_one_as_seq_cst_fence:
1506; GFX12-WGP:       ; %bb.0: ; %entry
1507; GFX12-WGP-NEXT:    s_wait_bvhcnt 0x0
1508; GFX12-WGP-NEXT:    s_wait_samplecnt 0x0
1509; GFX12-WGP-NEXT:    s_wait_loadcnt 0x0
1510; GFX12-WGP-NEXT:    s_wait_storecnt 0x0
1511; GFX12-WGP-NEXT:    global_inv scope:SCOPE_SE
1512; GFX12-WGP-NEXT:    s_endpgm
1513;
1514; GFX12-CU-LABEL: workgroup_one_as_seq_cst_fence:
1515; GFX12-CU:       ; %bb.0: ; %entry
1516; GFX12-CU-NEXT:    s_endpgm
1517entry:
1518  fence syncscope("workgroup-one-as") seq_cst
1519  ret void
1520}
1521
1522define amdgpu_kernel void @agent_acquire_fence() {
1523; GFX6-LABEL: agent_acquire_fence:
1524; GFX6:       ; %bb.0: ; %entry
1525; GFX6-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1526; GFX6-NEXT:    buffer_wbinvl1
1527; GFX6-NEXT:    s_endpgm
1528;
1529; GFX7-LABEL: agent_acquire_fence:
1530; GFX7:       ; %bb.0: ; %entry
1531; GFX7-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1532; GFX7-NEXT:    buffer_wbinvl1_vol
1533; GFX7-NEXT:    s_endpgm
1534;
1535; GFX10-WGP-LABEL: agent_acquire_fence:
1536; GFX10-WGP:       ; %bb.0: ; %entry
1537; GFX10-WGP-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1538; GFX10-WGP-NEXT:    s_waitcnt_vscnt null, 0x0
1539; GFX10-WGP-NEXT:    buffer_gl1_inv
1540; GFX10-WGP-NEXT:    buffer_gl0_inv
1541; GFX10-WGP-NEXT:    s_endpgm
1542;
1543; GFX10-CU-LABEL: agent_acquire_fence:
1544; GFX10-CU:       ; %bb.0: ; %entry
1545; GFX10-CU-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1546; GFX10-CU-NEXT:    s_waitcnt_vscnt null, 0x0
1547; GFX10-CU-NEXT:    buffer_gl1_inv
1548; GFX10-CU-NEXT:    buffer_gl0_inv
1549; GFX10-CU-NEXT:    s_endpgm
1550;
1551; SKIP-CACHE-INV-LABEL: agent_acquire_fence:
1552; SKIP-CACHE-INV:       ; %bb.0: ; %entry
1553; SKIP-CACHE-INV-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1554; SKIP-CACHE-INV-NEXT:    s_endpgm
1555;
1556; GFX90A-NOTTGSPLIT-LABEL: agent_acquire_fence:
1557; GFX90A-NOTTGSPLIT:       ; %bb.0: ; %entry
1558; GFX90A-NOTTGSPLIT-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1559; GFX90A-NOTTGSPLIT-NEXT:    buffer_wbinvl1_vol
1560; GFX90A-NOTTGSPLIT-NEXT:    s_endpgm
1561;
1562; GFX90A-TGSPLIT-LABEL: agent_acquire_fence:
1563; GFX90A-TGSPLIT:       ; %bb.0: ; %entry
1564; GFX90A-TGSPLIT-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1565; GFX90A-TGSPLIT-NEXT:    buffer_wbinvl1_vol
1566; GFX90A-TGSPLIT-NEXT:    s_endpgm
1567;
1568; GFX940-NOTTGSPLIT-LABEL: agent_acquire_fence:
1569; GFX940-NOTTGSPLIT:       ; %bb.0: ; %entry
1570; GFX940-NOTTGSPLIT-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1571; GFX940-NOTTGSPLIT-NEXT:    buffer_inv sc1
1572; GFX940-NOTTGSPLIT-NEXT:    s_endpgm
1573;
1574; GFX940-TGSPLIT-LABEL: agent_acquire_fence:
1575; GFX940-TGSPLIT:       ; %bb.0: ; %entry
1576; GFX940-TGSPLIT-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1577; GFX940-TGSPLIT-NEXT:    buffer_inv sc1
1578; GFX940-TGSPLIT-NEXT:    s_endpgm
1579;
1580; GFX11-WGP-LABEL: agent_acquire_fence:
1581; GFX11-WGP:       ; %bb.0: ; %entry
1582; GFX11-WGP-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1583; GFX11-WGP-NEXT:    s_waitcnt_vscnt null, 0x0
1584; GFX11-WGP-NEXT:    buffer_gl1_inv
1585; GFX11-WGP-NEXT:    buffer_gl0_inv
1586; GFX11-WGP-NEXT:    s_endpgm
1587;
1588; GFX11-CU-LABEL: agent_acquire_fence:
1589; GFX11-CU:       ; %bb.0: ; %entry
1590; GFX11-CU-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1591; GFX11-CU-NEXT:    s_waitcnt_vscnt null, 0x0
1592; GFX11-CU-NEXT:    buffer_gl1_inv
1593; GFX11-CU-NEXT:    buffer_gl0_inv
1594; GFX11-CU-NEXT:    s_endpgm
1595;
1596; GFX12-WGP-LABEL: agent_acquire_fence:
1597; GFX12-WGP:       ; %bb.0: ; %entry
1598; GFX12-WGP-NEXT:    s_wait_storecnt 0x0
1599; GFX12-WGP-NEXT:    s_wait_loadcnt_dscnt 0x0
1600; GFX12-WGP-NEXT:    global_inv scope:SCOPE_DEV
1601; GFX12-WGP-NEXT:    s_endpgm
1602;
1603; GFX12-CU-LABEL: agent_acquire_fence:
1604; GFX12-CU:       ; %bb.0: ; %entry
1605; GFX12-CU-NEXT:    s_wait_storecnt 0x0
1606; GFX12-CU-NEXT:    s_wait_loadcnt_dscnt 0x0
1607; GFX12-CU-NEXT:    global_inv scope:SCOPE_DEV
1608; GFX12-CU-NEXT:    s_endpgm
1609entry:
1610  fence syncscope("agent") acquire
1611  ret void
1612}
1613
1614define amdgpu_kernel void @agent_release_fence() {
1615; GFX6-LABEL: agent_release_fence:
1616; GFX6:       ; %bb.0: ; %entry
1617; GFX6-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1618; GFX6-NEXT:    s_endpgm
1619;
1620; GFX7-LABEL: agent_release_fence:
1621; GFX7:       ; %bb.0: ; %entry
1622; GFX7-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1623; GFX7-NEXT:    s_endpgm
1624;
1625; GFX10-WGP-LABEL: agent_release_fence:
1626; GFX10-WGP:       ; %bb.0: ; %entry
1627; GFX10-WGP-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1628; GFX10-WGP-NEXT:    s_waitcnt_vscnt null, 0x0
1629; GFX10-WGP-NEXT:    s_endpgm
1630;
1631; GFX10-CU-LABEL: agent_release_fence:
1632; GFX10-CU:       ; %bb.0: ; %entry
1633; GFX10-CU-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1634; GFX10-CU-NEXT:    s_waitcnt_vscnt null, 0x0
1635; GFX10-CU-NEXT:    s_endpgm
1636;
1637; SKIP-CACHE-INV-LABEL: agent_release_fence:
1638; SKIP-CACHE-INV:       ; %bb.0: ; %entry
1639; SKIP-CACHE-INV-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1640; SKIP-CACHE-INV-NEXT:    s_endpgm
1641;
1642; GFX90A-NOTTGSPLIT-LABEL: agent_release_fence:
1643; GFX90A-NOTTGSPLIT:       ; %bb.0: ; %entry
1644; GFX90A-NOTTGSPLIT-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1645; GFX90A-NOTTGSPLIT-NEXT:    s_endpgm
1646;
1647; GFX90A-TGSPLIT-LABEL: agent_release_fence:
1648; GFX90A-TGSPLIT:       ; %bb.0: ; %entry
1649; GFX90A-TGSPLIT-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1650; GFX90A-TGSPLIT-NEXT:    s_endpgm
1651;
1652; GFX940-NOTTGSPLIT-LABEL: agent_release_fence:
1653; GFX940-NOTTGSPLIT:       ; %bb.0: ; %entry
1654; GFX940-NOTTGSPLIT-NEXT:    buffer_wbl2 sc1
1655; GFX940-NOTTGSPLIT-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1656; GFX940-NOTTGSPLIT-NEXT:    s_endpgm
1657;
1658; GFX940-TGSPLIT-LABEL: agent_release_fence:
1659; GFX940-TGSPLIT:       ; %bb.0: ; %entry
1660; GFX940-TGSPLIT-NEXT:    buffer_wbl2 sc1
1661; GFX940-TGSPLIT-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1662; GFX940-TGSPLIT-NEXT:    s_endpgm
1663;
1664; GFX11-WGP-LABEL: agent_release_fence:
1665; GFX11-WGP:       ; %bb.0: ; %entry
1666; GFX11-WGP-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1667; GFX11-WGP-NEXT:    s_waitcnt_vscnt null, 0x0
1668; GFX11-WGP-NEXT:    s_endpgm
1669;
1670; GFX11-CU-LABEL: agent_release_fence:
1671; GFX11-CU:       ; %bb.0: ; %entry
1672; GFX11-CU-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1673; GFX11-CU-NEXT:    s_waitcnt_vscnt null, 0x0
1674; GFX11-CU-NEXT:    s_endpgm
1675;
1676; GFX12-WGP-LABEL: agent_release_fence:
1677; GFX12-WGP:       ; %bb.0: ; %entry
1678; GFX12-WGP-NEXT:    s_wait_bvhcnt 0x0
1679; GFX12-WGP-NEXT:    s_wait_samplecnt 0x0
1680; GFX12-WGP-NEXT:    s_wait_storecnt 0x0
1681; GFX12-WGP-NEXT:    s_wait_loadcnt_dscnt 0x0
1682; GFX12-WGP-NEXT:    s_endpgm
1683;
1684; GFX12-CU-LABEL: agent_release_fence:
1685; GFX12-CU:       ; %bb.0: ; %entry
1686; GFX12-CU-NEXT:    s_wait_bvhcnt 0x0
1687; GFX12-CU-NEXT:    s_wait_samplecnt 0x0
1688; GFX12-CU-NEXT:    s_wait_storecnt 0x0
1689; GFX12-CU-NEXT:    s_wait_loadcnt_dscnt 0x0
1690; GFX12-CU-NEXT:    s_endpgm
1691entry:
1692  fence syncscope("agent") release
1693  ret void
1694}
1695
1696define amdgpu_kernel void @agent_acq_rel_fence() {
1697; GFX6-LABEL: agent_acq_rel_fence:
1698; GFX6:       ; %bb.0: ; %entry
1699; GFX6-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1700; GFX6-NEXT:    buffer_wbinvl1
1701; GFX6-NEXT:    s_endpgm
1702;
1703; GFX7-LABEL: agent_acq_rel_fence:
1704; GFX7:       ; %bb.0: ; %entry
1705; GFX7-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1706; GFX7-NEXT:    buffer_wbinvl1_vol
1707; GFX7-NEXT:    s_endpgm
1708;
1709; GFX10-WGP-LABEL: agent_acq_rel_fence:
1710; GFX10-WGP:       ; %bb.0: ; %entry
1711; GFX10-WGP-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1712; GFX10-WGP-NEXT:    s_waitcnt_vscnt null, 0x0
1713; GFX10-WGP-NEXT:    buffer_gl1_inv
1714; GFX10-WGP-NEXT:    buffer_gl0_inv
1715; GFX10-WGP-NEXT:    s_endpgm
1716;
1717; GFX10-CU-LABEL: agent_acq_rel_fence:
1718; GFX10-CU:       ; %bb.0: ; %entry
1719; GFX10-CU-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1720; GFX10-CU-NEXT:    s_waitcnt_vscnt null, 0x0
1721; GFX10-CU-NEXT:    buffer_gl1_inv
1722; GFX10-CU-NEXT:    buffer_gl0_inv
1723; GFX10-CU-NEXT:    s_endpgm
1724;
1725; SKIP-CACHE-INV-LABEL: agent_acq_rel_fence:
1726; SKIP-CACHE-INV:       ; %bb.0: ; %entry
1727; SKIP-CACHE-INV-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1728; SKIP-CACHE-INV-NEXT:    s_endpgm
1729;
1730; GFX90A-NOTTGSPLIT-LABEL: agent_acq_rel_fence:
1731; GFX90A-NOTTGSPLIT:       ; %bb.0: ; %entry
1732; GFX90A-NOTTGSPLIT-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1733; GFX90A-NOTTGSPLIT-NEXT:    buffer_wbinvl1_vol
1734; GFX90A-NOTTGSPLIT-NEXT:    s_endpgm
1735;
1736; GFX90A-TGSPLIT-LABEL: agent_acq_rel_fence:
1737; GFX90A-TGSPLIT:       ; %bb.0: ; %entry
1738; GFX90A-TGSPLIT-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1739; GFX90A-TGSPLIT-NEXT:    buffer_wbinvl1_vol
1740; GFX90A-TGSPLIT-NEXT:    s_endpgm
1741;
1742; GFX940-NOTTGSPLIT-LABEL: agent_acq_rel_fence:
1743; GFX940-NOTTGSPLIT:       ; %bb.0: ; %entry
1744; GFX940-NOTTGSPLIT-NEXT:    buffer_wbl2 sc1
1745; GFX940-NOTTGSPLIT-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1746; GFX940-NOTTGSPLIT-NEXT:    buffer_inv sc1
1747; GFX940-NOTTGSPLIT-NEXT:    s_endpgm
1748;
1749; GFX940-TGSPLIT-LABEL: agent_acq_rel_fence:
1750; GFX940-TGSPLIT:       ; %bb.0: ; %entry
1751; GFX940-TGSPLIT-NEXT:    buffer_wbl2 sc1
1752; GFX940-TGSPLIT-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1753; GFX940-TGSPLIT-NEXT:    buffer_inv sc1
1754; GFX940-TGSPLIT-NEXT:    s_endpgm
1755;
1756; GFX11-WGP-LABEL: agent_acq_rel_fence:
1757; GFX11-WGP:       ; %bb.0: ; %entry
1758; GFX11-WGP-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1759; GFX11-WGP-NEXT:    s_waitcnt_vscnt null, 0x0
1760; GFX11-WGP-NEXT:    buffer_gl1_inv
1761; GFX11-WGP-NEXT:    buffer_gl0_inv
1762; GFX11-WGP-NEXT:    s_endpgm
1763;
1764; GFX11-CU-LABEL: agent_acq_rel_fence:
1765; GFX11-CU:       ; %bb.0: ; %entry
1766; GFX11-CU-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1767; GFX11-CU-NEXT:    s_waitcnt_vscnt null, 0x0
1768; GFX11-CU-NEXT:    buffer_gl1_inv
1769; GFX11-CU-NEXT:    buffer_gl0_inv
1770; GFX11-CU-NEXT:    s_endpgm
1771;
1772; GFX12-WGP-LABEL: agent_acq_rel_fence:
1773; GFX12-WGP:       ; %bb.0: ; %entry
1774; GFX12-WGP-NEXT:    s_wait_bvhcnt 0x0
1775; GFX12-WGP-NEXT:    s_wait_samplecnt 0x0
1776; GFX12-WGP-NEXT:    s_wait_storecnt 0x0
1777; GFX12-WGP-NEXT:    s_wait_loadcnt_dscnt 0x0
1778; GFX12-WGP-NEXT:    global_inv scope:SCOPE_DEV
1779; GFX12-WGP-NEXT:    s_endpgm
1780;
1781; GFX12-CU-LABEL: agent_acq_rel_fence:
1782; GFX12-CU:       ; %bb.0: ; %entry
1783; GFX12-CU-NEXT:    s_wait_bvhcnt 0x0
1784; GFX12-CU-NEXT:    s_wait_samplecnt 0x0
1785; GFX12-CU-NEXT:    s_wait_storecnt 0x0
1786; GFX12-CU-NEXT:    s_wait_loadcnt_dscnt 0x0
1787; GFX12-CU-NEXT:    global_inv scope:SCOPE_DEV
1788; GFX12-CU-NEXT:    s_endpgm
1789entry:
1790  fence syncscope("agent") acq_rel
1791  ret void
1792}
1793
1794define amdgpu_kernel void @agent_seq_cst_fence() {
1795; GFX6-LABEL: agent_seq_cst_fence:
1796; GFX6:       ; %bb.0: ; %entry
1797; GFX6-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1798; GFX6-NEXT:    buffer_wbinvl1
1799; GFX6-NEXT:    s_endpgm
1800;
1801; GFX7-LABEL: agent_seq_cst_fence:
1802; GFX7:       ; %bb.0: ; %entry
1803; GFX7-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1804; GFX7-NEXT:    buffer_wbinvl1_vol
1805; GFX7-NEXT:    s_endpgm
1806;
1807; GFX10-WGP-LABEL: agent_seq_cst_fence:
1808; GFX10-WGP:       ; %bb.0: ; %entry
1809; GFX10-WGP-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1810; GFX10-WGP-NEXT:    s_waitcnt_vscnt null, 0x0
1811; GFX10-WGP-NEXT:    buffer_gl1_inv
1812; GFX10-WGP-NEXT:    buffer_gl0_inv
1813; GFX10-WGP-NEXT:    s_endpgm
1814;
1815; GFX10-CU-LABEL: agent_seq_cst_fence:
1816; GFX10-CU:       ; %bb.0: ; %entry
1817; GFX10-CU-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1818; GFX10-CU-NEXT:    s_waitcnt_vscnt null, 0x0
1819; GFX10-CU-NEXT:    buffer_gl1_inv
1820; GFX10-CU-NEXT:    buffer_gl0_inv
1821; GFX10-CU-NEXT:    s_endpgm
1822;
1823; SKIP-CACHE-INV-LABEL: agent_seq_cst_fence:
1824; SKIP-CACHE-INV:       ; %bb.0: ; %entry
1825; SKIP-CACHE-INV-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1826; SKIP-CACHE-INV-NEXT:    s_endpgm
1827;
1828; GFX90A-NOTTGSPLIT-LABEL: agent_seq_cst_fence:
1829; GFX90A-NOTTGSPLIT:       ; %bb.0: ; %entry
1830; GFX90A-NOTTGSPLIT-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1831; GFX90A-NOTTGSPLIT-NEXT:    buffer_wbinvl1_vol
1832; GFX90A-NOTTGSPLIT-NEXT:    s_endpgm
1833;
1834; GFX90A-TGSPLIT-LABEL: agent_seq_cst_fence:
1835; GFX90A-TGSPLIT:       ; %bb.0: ; %entry
1836; GFX90A-TGSPLIT-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1837; GFX90A-TGSPLIT-NEXT:    buffer_wbinvl1_vol
1838; GFX90A-TGSPLIT-NEXT:    s_endpgm
1839;
1840; GFX940-NOTTGSPLIT-LABEL: agent_seq_cst_fence:
1841; GFX940-NOTTGSPLIT:       ; %bb.0: ; %entry
1842; GFX940-NOTTGSPLIT-NEXT:    buffer_wbl2 sc1
1843; GFX940-NOTTGSPLIT-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1844; GFX940-NOTTGSPLIT-NEXT:    buffer_inv sc1
1845; GFX940-NOTTGSPLIT-NEXT:    s_endpgm
1846;
1847; GFX940-TGSPLIT-LABEL: agent_seq_cst_fence:
1848; GFX940-TGSPLIT:       ; %bb.0: ; %entry
1849; GFX940-TGSPLIT-NEXT:    buffer_wbl2 sc1
1850; GFX940-TGSPLIT-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1851; GFX940-TGSPLIT-NEXT:    buffer_inv sc1
1852; GFX940-TGSPLIT-NEXT:    s_endpgm
1853;
1854; GFX11-WGP-LABEL: agent_seq_cst_fence:
1855; GFX11-WGP:       ; %bb.0: ; %entry
1856; GFX11-WGP-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1857; GFX11-WGP-NEXT:    s_waitcnt_vscnt null, 0x0
1858; GFX11-WGP-NEXT:    buffer_gl1_inv
1859; GFX11-WGP-NEXT:    buffer_gl0_inv
1860; GFX11-WGP-NEXT:    s_endpgm
1861;
1862; GFX11-CU-LABEL: agent_seq_cst_fence:
1863; GFX11-CU:       ; %bb.0: ; %entry
1864; GFX11-CU-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
1865; GFX11-CU-NEXT:    s_waitcnt_vscnt null, 0x0
1866; GFX11-CU-NEXT:    buffer_gl1_inv
1867; GFX11-CU-NEXT:    buffer_gl0_inv
1868; GFX11-CU-NEXT:    s_endpgm
1869;
1870; GFX12-WGP-LABEL: agent_seq_cst_fence:
1871; GFX12-WGP:       ; %bb.0: ; %entry
1872; GFX12-WGP-NEXT:    s_wait_bvhcnt 0x0
1873; GFX12-WGP-NEXT:    s_wait_samplecnt 0x0
1874; GFX12-WGP-NEXT:    s_wait_storecnt 0x0
1875; GFX12-WGP-NEXT:    s_wait_loadcnt_dscnt 0x0
1876; GFX12-WGP-NEXT:    global_inv scope:SCOPE_DEV
1877; GFX12-WGP-NEXT:    s_endpgm
1878;
1879; GFX12-CU-LABEL: agent_seq_cst_fence:
1880; GFX12-CU:       ; %bb.0: ; %entry
1881; GFX12-CU-NEXT:    s_wait_bvhcnt 0x0
1882; GFX12-CU-NEXT:    s_wait_samplecnt 0x0
1883; GFX12-CU-NEXT:    s_wait_storecnt 0x0
1884; GFX12-CU-NEXT:    s_wait_loadcnt_dscnt 0x0
1885; GFX12-CU-NEXT:    global_inv scope:SCOPE_DEV
1886; GFX12-CU-NEXT:    s_endpgm
1887entry:
1888  fence syncscope("agent") seq_cst
1889  ret void
1890}
1891
1892define amdgpu_kernel void @agent_one_as_acquire_fence() {
1893; GFX6-LABEL: agent_one_as_acquire_fence:
1894; GFX6:       ; %bb.0: ; %entry
1895; GFX6-NEXT:    s_waitcnt vmcnt(0)
1896; GFX6-NEXT:    buffer_wbinvl1
1897; GFX6-NEXT:    s_endpgm
1898;
1899; GFX7-LABEL: agent_one_as_acquire_fence:
1900; GFX7:       ; %bb.0: ; %entry
1901; GFX7-NEXT:    s_waitcnt vmcnt(0)
1902; GFX7-NEXT:    buffer_wbinvl1_vol
1903; GFX7-NEXT:    s_endpgm
1904;
1905; GFX10-WGP-LABEL: agent_one_as_acquire_fence:
1906; GFX10-WGP:       ; %bb.0: ; %entry
1907; GFX10-WGP-NEXT:    s_waitcnt vmcnt(0)
1908; GFX10-WGP-NEXT:    s_waitcnt_vscnt null, 0x0
1909; GFX10-WGP-NEXT:    buffer_gl1_inv
1910; GFX10-WGP-NEXT:    buffer_gl0_inv
1911; GFX10-WGP-NEXT:    s_endpgm
1912;
1913; GFX10-CU-LABEL: agent_one_as_acquire_fence:
1914; GFX10-CU:       ; %bb.0: ; %entry
1915; GFX10-CU-NEXT:    s_waitcnt vmcnt(0)
1916; GFX10-CU-NEXT:    s_waitcnt_vscnt null, 0x0
1917; GFX10-CU-NEXT:    buffer_gl1_inv
1918; GFX10-CU-NEXT:    buffer_gl0_inv
1919; GFX10-CU-NEXT:    s_endpgm
1920;
1921; SKIP-CACHE-INV-LABEL: agent_one_as_acquire_fence:
1922; SKIP-CACHE-INV:       ; %bb.0: ; %entry
1923; SKIP-CACHE-INV-NEXT:    s_waitcnt vmcnt(0)
1924; SKIP-CACHE-INV-NEXT:    s_endpgm
1925;
1926; GFX90A-NOTTGSPLIT-LABEL: agent_one_as_acquire_fence:
1927; GFX90A-NOTTGSPLIT:       ; %bb.0: ; %entry
1928; GFX90A-NOTTGSPLIT-NEXT:    s_waitcnt vmcnt(0)
1929; GFX90A-NOTTGSPLIT-NEXT:    buffer_wbinvl1_vol
1930; GFX90A-NOTTGSPLIT-NEXT:    s_endpgm
1931;
1932; GFX90A-TGSPLIT-LABEL: agent_one_as_acquire_fence:
1933; GFX90A-TGSPLIT:       ; %bb.0: ; %entry
1934; GFX90A-TGSPLIT-NEXT:    s_waitcnt vmcnt(0)
1935; GFX90A-TGSPLIT-NEXT:    buffer_wbinvl1_vol
1936; GFX90A-TGSPLIT-NEXT:    s_endpgm
1937;
1938; GFX940-NOTTGSPLIT-LABEL: agent_one_as_acquire_fence:
1939; GFX940-NOTTGSPLIT:       ; %bb.0: ; %entry
1940; GFX940-NOTTGSPLIT-NEXT:    s_waitcnt vmcnt(0)
1941; GFX940-NOTTGSPLIT-NEXT:    buffer_inv sc1
1942; GFX940-NOTTGSPLIT-NEXT:    s_endpgm
1943;
1944; GFX940-TGSPLIT-LABEL: agent_one_as_acquire_fence:
1945; GFX940-TGSPLIT:       ; %bb.0: ; %entry
1946; GFX940-TGSPLIT-NEXT:    s_waitcnt vmcnt(0)
1947; GFX940-TGSPLIT-NEXT:    buffer_inv sc1
1948; GFX940-TGSPLIT-NEXT:    s_endpgm
1949;
1950; GFX11-WGP-LABEL: agent_one_as_acquire_fence:
1951; GFX11-WGP:       ; %bb.0: ; %entry
1952; GFX11-WGP-NEXT:    s_waitcnt vmcnt(0)
1953; GFX11-WGP-NEXT:    s_waitcnt_vscnt null, 0x0
1954; GFX11-WGP-NEXT:    buffer_gl1_inv
1955; GFX11-WGP-NEXT:    buffer_gl0_inv
1956; GFX11-WGP-NEXT:    s_endpgm
1957;
1958; GFX11-CU-LABEL: agent_one_as_acquire_fence:
1959; GFX11-CU:       ; %bb.0: ; %entry
1960; GFX11-CU-NEXT:    s_waitcnt vmcnt(0)
1961; GFX11-CU-NEXT:    s_waitcnt_vscnt null, 0x0
1962; GFX11-CU-NEXT:    buffer_gl1_inv
1963; GFX11-CU-NEXT:    buffer_gl0_inv
1964; GFX11-CU-NEXT:    s_endpgm
1965;
1966; GFX12-WGP-LABEL: agent_one_as_acquire_fence:
1967; GFX12-WGP:       ; %bb.0: ; %entry
1968; GFX12-WGP-NEXT:    s_wait_loadcnt 0x0
1969; GFX12-WGP-NEXT:    s_wait_storecnt 0x0
1970; GFX12-WGP-NEXT:    global_inv scope:SCOPE_DEV
1971; GFX12-WGP-NEXT:    s_endpgm
1972;
1973; GFX12-CU-LABEL: agent_one_as_acquire_fence:
1974; GFX12-CU:       ; %bb.0: ; %entry
1975; GFX12-CU-NEXT:    s_wait_loadcnt 0x0
1976; GFX12-CU-NEXT:    s_wait_storecnt 0x0
1977; GFX12-CU-NEXT:    global_inv scope:SCOPE_DEV
1978; GFX12-CU-NEXT:    s_endpgm
1979entry:
1980  fence syncscope("agent-one-as") acquire
1981  ret void
1982}
1983
1984define amdgpu_kernel void @agent_one_as_release_fence() {
1985; GFX6-LABEL: agent_one_as_release_fence:
1986; GFX6:       ; %bb.0: ; %entry
1987; GFX6-NEXT:    s_waitcnt vmcnt(0)
1988; GFX6-NEXT:    s_endpgm
1989;
1990; GFX7-LABEL: agent_one_as_release_fence:
1991; GFX7:       ; %bb.0: ; %entry
1992; GFX7-NEXT:    s_waitcnt vmcnt(0)
1993; GFX7-NEXT:    s_endpgm
1994;
1995; GFX10-WGP-LABEL: agent_one_as_release_fence:
1996; GFX10-WGP:       ; %bb.0: ; %entry
1997; GFX10-WGP-NEXT:    s_waitcnt vmcnt(0)
1998; GFX10-WGP-NEXT:    s_waitcnt_vscnt null, 0x0
1999; GFX10-WGP-NEXT:    s_endpgm
2000;
2001; GFX10-CU-LABEL: agent_one_as_release_fence:
2002; GFX10-CU:       ; %bb.0: ; %entry
2003; GFX10-CU-NEXT:    s_waitcnt vmcnt(0)
2004; GFX10-CU-NEXT:    s_waitcnt_vscnt null, 0x0
2005; GFX10-CU-NEXT:    s_endpgm
2006;
2007; SKIP-CACHE-INV-LABEL: agent_one_as_release_fence:
2008; SKIP-CACHE-INV:       ; %bb.0: ; %entry
2009; SKIP-CACHE-INV-NEXT:    s_waitcnt vmcnt(0)
2010; SKIP-CACHE-INV-NEXT:    s_endpgm
2011;
2012; GFX90A-NOTTGSPLIT-LABEL: agent_one_as_release_fence:
2013; GFX90A-NOTTGSPLIT:       ; %bb.0: ; %entry
2014; GFX90A-NOTTGSPLIT-NEXT:    s_waitcnt vmcnt(0)
2015; GFX90A-NOTTGSPLIT-NEXT:    s_endpgm
2016;
2017; GFX90A-TGSPLIT-LABEL: agent_one_as_release_fence:
2018; GFX90A-TGSPLIT:       ; %bb.0: ; %entry
2019; GFX90A-TGSPLIT-NEXT:    s_waitcnt vmcnt(0)
2020; GFX90A-TGSPLIT-NEXT:    s_endpgm
2021;
2022; GFX940-NOTTGSPLIT-LABEL: agent_one_as_release_fence:
2023; GFX940-NOTTGSPLIT:       ; %bb.0: ; %entry
2024; GFX940-NOTTGSPLIT-NEXT:    buffer_wbl2 sc1
2025; GFX940-NOTTGSPLIT-NEXT:    s_waitcnt vmcnt(0)
2026; GFX940-NOTTGSPLIT-NEXT:    s_endpgm
2027;
2028; GFX940-TGSPLIT-LABEL: agent_one_as_release_fence:
2029; GFX940-TGSPLIT:       ; %bb.0: ; %entry
2030; GFX940-TGSPLIT-NEXT:    buffer_wbl2 sc1
2031; GFX940-TGSPLIT-NEXT:    s_waitcnt vmcnt(0)
2032; GFX940-TGSPLIT-NEXT:    s_endpgm
2033;
2034; GFX11-WGP-LABEL: agent_one_as_release_fence:
2035; GFX11-WGP:       ; %bb.0: ; %entry
2036; GFX11-WGP-NEXT:    s_waitcnt vmcnt(0)
2037; GFX11-WGP-NEXT:    s_waitcnt_vscnt null, 0x0
2038; GFX11-WGP-NEXT:    s_endpgm
2039;
2040; GFX11-CU-LABEL: agent_one_as_release_fence:
2041; GFX11-CU:       ; %bb.0: ; %entry
2042; GFX11-CU-NEXT:    s_waitcnt vmcnt(0)
2043; GFX11-CU-NEXT:    s_waitcnt_vscnt null, 0x0
2044; GFX11-CU-NEXT:    s_endpgm
2045;
2046; GFX12-WGP-LABEL: agent_one_as_release_fence:
2047; GFX12-WGP:       ; %bb.0: ; %entry
2048; GFX12-WGP-NEXT:    s_wait_bvhcnt 0x0
2049; GFX12-WGP-NEXT:    s_wait_samplecnt 0x0
2050; GFX12-WGP-NEXT:    s_wait_loadcnt 0x0
2051; GFX12-WGP-NEXT:    s_wait_storecnt 0x0
2052; GFX12-WGP-NEXT:    s_endpgm
2053;
2054; GFX12-CU-LABEL: agent_one_as_release_fence:
2055; GFX12-CU:       ; %bb.0: ; %entry
2056; GFX12-CU-NEXT:    s_wait_bvhcnt 0x0
2057; GFX12-CU-NEXT:    s_wait_samplecnt 0x0
2058; GFX12-CU-NEXT:    s_wait_loadcnt 0x0
2059; GFX12-CU-NEXT:    s_wait_storecnt 0x0
2060; GFX12-CU-NEXT:    s_endpgm
2061entry:
2062  fence syncscope("agent-one-as") release
2063  ret void
2064}
2065
2066define amdgpu_kernel void @agent_one_as_acq_rel_fence() {
2067; GFX6-LABEL: agent_one_as_acq_rel_fence:
2068; GFX6:       ; %bb.0: ; %entry
2069; GFX6-NEXT:    s_waitcnt vmcnt(0)
2070; GFX6-NEXT:    buffer_wbinvl1
2071; GFX6-NEXT:    s_endpgm
2072;
2073; GFX7-LABEL: agent_one_as_acq_rel_fence:
2074; GFX7:       ; %bb.0: ; %entry
2075; GFX7-NEXT:    s_waitcnt vmcnt(0)
2076; GFX7-NEXT:    buffer_wbinvl1_vol
2077; GFX7-NEXT:    s_endpgm
2078;
2079; GFX10-WGP-LABEL: agent_one_as_acq_rel_fence:
2080; GFX10-WGP:       ; %bb.0: ; %entry
2081; GFX10-WGP-NEXT:    s_waitcnt vmcnt(0)
2082; GFX10-WGP-NEXT:    s_waitcnt_vscnt null, 0x0
2083; GFX10-WGP-NEXT:    buffer_gl1_inv
2084; GFX10-WGP-NEXT:    buffer_gl0_inv
2085; GFX10-WGP-NEXT:    s_endpgm
2086;
2087; GFX10-CU-LABEL: agent_one_as_acq_rel_fence:
2088; GFX10-CU:       ; %bb.0: ; %entry
2089; GFX10-CU-NEXT:    s_waitcnt vmcnt(0)
2090; GFX10-CU-NEXT:    s_waitcnt_vscnt null, 0x0
2091; GFX10-CU-NEXT:    buffer_gl1_inv
2092; GFX10-CU-NEXT:    buffer_gl0_inv
2093; GFX10-CU-NEXT:    s_endpgm
2094;
2095; SKIP-CACHE-INV-LABEL: agent_one_as_acq_rel_fence:
2096; SKIP-CACHE-INV:       ; %bb.0: ; %entry
2097; SKIP-CACHE-INV-NEXT:    s_waitcnt vmcnt(0)
2098; SKIP-CACHE-INV-NEXT:    s_endpgm
2099;
2100; GFX90A-NOTTGSPLIT-LABEL: agent_one_as_acq_rel_fence:
2101; GFX90A-NOTTGSPLIT:       ; %bb.0: ; %entry
2102; GFX90A-NOTTGSPLIT-NEXT:    s_waitcnt vmcnt(0)
2103; GFX90A-NOTTGSPLIT-NEXT:    buffer_wbinvl1_vol
2104; GFX90A-NOTTGSPLIT-NEXT:    s_endpgm
2105;
2106; GFX90A-TGSPLIT-LABEL: agent_one_as_acq_rel_fence:
2107; GFX90A-TGSPLIT:       ; %bb.0: ; %entry
2108; GFX90A-TGSPLIT-NEXT:    s_waitcnt vmcnt(0)
2109; GFX90A-TGSPLIT-NEXT:    buffer_wbinvl1_vol
2110; GFX90A-TGSPLIT-NEXT:    s_endpgm
2111;
2112; GFX940-NOTTGSPLIT-LABEL: agent_one_as_acq_rel_fence:
2113; GFX940-NOTTGSPLIT:       ; %bb.0: ; %entry
2114; GFX940-NOTTGSPLIT-NEXT:    buffer_wbl2 sc1
2115; GFX940-NOTTGSPLIT-NEXT:    s_waitcnt vmcnt(0)
2116; GFX940-NOTTGSPLIT-NEXT:    buffer_inv sc1
2117; GFX940-NOTTGSPLIT-NEXT:    s_endpgm
2118;
2119; GFX940-TGSPLIT-LABEL: agent_one_as_acq_rel_fence:
2120; GFX940-TGSPLIT:       ; %bb.0: ; %entry
2121; GFX940-TGSPLIT-NEXT:    buffer_wbl2 sc1
2122; GFX940-TGSPLIT-NEXT:    s_waitcnt vmcnt(0)
2123; GFX940-TGSPLIT-NEXT:    buffer_inv sc1
2124; GFX940-TGSPLIT-NEXT:    s_endpgm
2125;
2126; GFX11-WGP-LABEL: agent_one_as_acq_rel_fence:
2127; GFX11-WGP:       ; %bb.0: ; %entry
2128; GFX11-WGP-NEXT:    s_waitcnt vmcnt(0)
2129; GFX11-WGP-NEXT:    s_waitcnt_vscnt null, 0x0
2130; GFX11-WGP-NEXT:    buffer_gl1_inv
2131; GFX11-WGP-NEXT:    buffer_gl0_inv
2132; GFX11-WGP-NEXT:    s_endpgm
2133;
2134; GFX11-CU-LABEL: agent_one_as_acq_rel_fence:
2135; GFX11-CU:       ; %bb.0: ; %entry
2136; GFX11-CU-NEXT:    s_waitcnt vmcnt(0)
2137; GFX11-CU-NEXT:    s_waitcnt_vscnt null, 0x0
2138; GFX11-CU-NEXT:    buffer_gl1_inv
2139; GFX11-CU-NEXT:    buffer_gl0_inv
2140; GFX11-CU-NEXT:    s_endpgm
2141;
2142; GFX12-WGP-LABEL: agent_one_as_acq_rel_fence:
2143; GFX12-WGP:       ; %bb.0: ; %entry
2144; GFX12-WGP-NEXT:    s_wait_bvhcnt 0x0
2145; GFX12-WGP-NEXT:    s_wait_samplecnt 0x0
2146; GFX12-WGP-NEXT:    s_wait_loadcnt 0x0
2147; GFX12-WGP-NEXT:    s_wait_storecnt 0x0
2148; GFX12-WGP-NEXT:    global_inv scope:SCOPE_DEV
2149; GFX12-WGP-NEXT:    s_endpgm
2150;
2151; GFX12-CU-LABEL: agent_one_as_acq_rel_fence:
2152; GFX12-CU:       ; %bb.0: ; %entry
2153; GFX12-CU-NEXT:    s_wait_bvhcnt 0x0
2154; GFX12-CU-NEXT:    s_wait_samplecnt 0x0
2155; GFX12-CU-NEXT:    s_wait_loadcnt 0x0
2156; GFX12-CU-NEXT:    s_wait_storecnt 0x0
2157; GFX12-CU-NEXT:    global_inv scope:SCOPE_DEV
2158; GFX12-CU-NEXT:    s_endpgm
2159entry:
2160  fence syncscope("agent-one-as") acq_rel
2161  ret void
2162}
2163
2164define amdgpu_kernel void @agent_one_as_seq_cst_fence() {
2165; GFX6-LABEL: agent_one_as_seq_cst_fence:
2166; GFX6:       ; %bb.0: ; %entry
2167; GFX6-NEXT:    s_waitcnt vmcnt(0)
2168; GFX6-NEXT:    buffer_wbinvl1
2169; GFX6-NEXT:    s_endpgm
2170;
2171; GFX7-LABEL: agent_one_as_seq_cst_fence:
2172; GFX7:       ; %bb.0: ; %entry
2173; GFX7-NEXT:    s_waitcnt vmcnt(0)
2174; GFX7-NEXT:    buffer_wbinvl1_vol
2175; GFX7-NEXT:    s_endpgm
2176;
2177; GFX10-WGP-LABEL: agent_one_as_seq_cst_fence:
2178; GFX10-WGP:       ; %bb.0: ; %entry
2179; GFX10-WGP-NEXT:    s_waitcnt vmcnt(0)
2180; GFX10-WGP-NEXT:    s_waitcnt_vscnt null, 0x0
2181; GFX10-WGP-NEXT:    buffer_gl1_inv
2182; GFX10-WGP-NEXT:    buffer_gl0_inv
2183; GFX10-WGP-NEXT:    s_endpgm
2184;
2185; GFX10-CU-LABEL: agent_one_as_seq_cst_fence:
2186; GFX10-CU:       ; %bb.0: ; %entry
2187; GFX10-CU-NEXT:    s_waitcnt vmcnt(0)
2188; GFX10-CU-NEXT:    s_waitcnt_vscnt null, 0x0
2189; GFX10-CU-NEXT:    buffer_gl1_inv
2190; GFX10-CU-NEXT:    buffer_gl0_inv
2191; GFX10-CU-NEXT:    s_endpgm
2192;
2193; SKIP-CACHE-INV-LABEL: agent_one_as_seq_cst_fence:
2194; SKIP-CACHE-INV:       ; %bb.0: ; %entry
2195; SKIP-CACHE-INV-NEXT:    s_waitcnt vmcnt(0)
2196; SKIP-CACHE-INV-NEXT:    s_endpgm
2197;
2198; GFX90A-NOTTGSPLIT-LABEL: agent_one_as_seq_cst_fence:
2199; GFX90A-NOTTGSPLIT:       ; %bb.0: ; %entry
2200; GFX90A-NOTTGSPLIT-NEXT:    s_waitcnt vmcnt(0)
2201; GFX90A-NOTTGSPLIT-NEXT:    buffer_wbinvl1_vol
2202; GFX90A-NOTTGSPLIT-NEXT:    s_endpgm
2203;
2204; GFX90A-TGSPLIT-LABEL: agent_one_as_seq_cst_fence:
2205; GFX90A-TGSPLIT:       ; %bb.0: ; %entry
2206; GFX90A-TGSPLIT-NEXT:    s_waitcnt vmcnt(0)
2207; GFX90A-TGSPLIT-NEXT:    buffer_wbinvl1_vol
2208; GFX90A-TGSPLIT-NEXT:    s_endpgm
2209;
2210; GFX940-NOTTGSPLIT-LABEL: agent_one_as_seq_cst_fence:
2211; GFX940-NOTTGSPLIT:       ; %bb.0: ; %entry
2212; GFX940-NOTTGSPLIT-NEXT:    buffer_wbl2 sc1
2213; GFX940-NOTTGSPLIT-NEXT:    s_waitcnt vmcnt(0)
2214; GFX940-NOTTGSPLIT-NEXT:    buffer_inv sc1
2215; GFX940-NOTTGSPLIT-NEXT:    s_endpgm
2216;
2217; GFX940-TGSPLIT-LABEL: agent_one_as_seq_cst_fence:
2218; GFX940-TGSPLIT:       ; %bb.0: ; %entry
2219; GFX940-TGSPLIT-NEXT:    buffer_wbl2 sc1
2220; GFX940-TGSPLIT-NEXT:    s_waitcnt vmcnt(0)
2221; GFX940-TGSPLIT-NEXT:    buffer_inv sc1
2222; GFX940-TGSPLIT-NEXT:    s_endpgm
2223;
2224; GFX11-WGP-LABEL: agent_one_as_seq_cst_fence:
2225; GFX11-WGP:       ; %bb.0: ; %entry
2226; GFX11-WGP-NEXT:    s_waitcnt vmcnt(0)
2227; GFX11-WGP-NEXT:    s_waitcnt_vscnt null, 0x0
2228; GFX11-WGP-NEXT:    buffer_gl1_inv
2229; GFX11-WGP-NEXT:    buffer_gl0_inv
2230; GFX11-WGP-NEXT:    s_endpgm
2231;
2232; GFX11-CU-LABEL: agent_one_as_seq_cst_fence:
2233; GFX11-CU:       ; %bb.0: ; %entry
2234; GFX11-CU-NEXT:    s_waitcnt vmcnt(0)
2235; GFX11-CU-NEXT:    s_waitcnt_vscnt null, 0x0
2236; GFX11-CU-NEXT:    buffer_gl1_inv
2237; GFX11-CU-NEXT:    buffer_gl0_inv
2238; GFX11-CU-NEXT:    s_endpgm
2239;
2240; GFX12-WGP-LABEL: agent_one_as_seq_cst_fence:
2241; GFX12-WGP:       ; %bb.0: ; %entry
2242; GFX12-WGP-NEXT:    s_wait_bvhcnt 0x0
2243; GFX12-WGP-NEXT:    s_wait_samplecnt 0x0
2244; GFX12-WGP-NEXT:    s_wait_loadcnt 0x0
2245; GFX12-WGP-NEXT:    s_wait_storecnt 0x0
2246; GFX12-WGP-NEXT:    global_inv scope:SCOPE_DEV
2247; GFX12-WGP-NEXT:    s_endpgm
2248;
2249; GFX12-CU-LABEL: agent_one_as_seq_cst_fence:
2250; GFX12-CU:       ; %bb.0: ; %entry
2251; GFX12-CU-NEXT:    s_wait_bvhcnt 0x0
2252; GFX12-CU-NEXT:    s_wait_samplecnt 0x0
2253; GFX12-CU-NEXT:    s_wait_loadcnt 0x0
2254; GFX12-CU-NEXT:    s_wait_storecnt 0x0
2255; GFX12-CU-NEXT:    global_inv scope:SCOPE_DEV
2256; GFX12-CU-NEXT:    s_endpgm
2257entry:
2258  fence syncscope("agent-one-as") seq_cst
2259  ret void
2260}
2261
2262define amdgpu_kernel void @system_acquire_fence() {
2263; GFX6-LABEL: system_acquire_fence:
2264; GFX6:       ; %bb.0: ; %entry
2265; GFX6-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
2266; GFX6-NEXT:    buffer_wbinvl1
2267; GFX6-NEXT:    s_endpgm
2268;
2269; GFX7-LABEL: system_acquire_fence:
2270; GFX7:       ; %bb.0: ; %entry
2271; GFX7-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
2272; GFX7-NEXT:    buffer_wbinvl1_vol
2273; GFX7-NEXT:    s_endpgm
2274;
2275; GFX10-WGP-LABEL: system_acquire_fence:
2276; GFX10-WGP:       ; %bb.0: ; %entry
2277; GFX10-WGP-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
2278; GFX10-WGP-NEXT:    s_waitcnt_vscnt null, 0x0
2279; GFX10-WGP-NEXT:    buffer_gl1_inv
2280; GFX10-WGP-NEXT:    buffer_gl0_inv
2281; GFX10-WGP-NEXT:    s_endpgm
2282;
2283; GFX10-CU-LABEL: system_acquire_fence:
2284; GFX10-CU:       ; %bb.0: ; %entry
2285; GFX10-CU-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
2286; GFX10-CU-NEXT:    s_waitcnt_vscnt null, 0x0
2287; GFX10-CU-NEXT:    buffer_gl1_inv
2288; GFX10-CU-NEXT:    buffer_gl0_inv
2289; GFX10-CU-NEXT:    s_endpgm
2290;
2291; SKIP-CACHE-INV-LABEL: system_acquire_fence:
2292; SKIP-CACHE-INV:       ; %bb.0: ; %entry
2293; SKIP-CACHE-INV-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
2294; SKIP-CACHE-INV-NEXT:    s_endpgm
2295;
2296; GFX90A-NOTTGSPLIT-LABEL: system_acquire_fence:
2297; GFX90A-NOTTGSPLIT:       ; %bb.0: ; %entry
2298; GFX90A-NOTTGSPLIT-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
2299; GFX90A-NOTTGSPLIT-NEXT:    buffer_invl2
2300; GFX90A-NOTTGSPLIT-NEXT:    buffer_wbinvl1_vol
2301; GFX90A-NOTTGSPLIT-NEXT:    s_endpgm
2302;
2303; GFX90A-TGSPLIT-LABEL: system_acquire_fence:
2304; GFX90A-TGSPLIT:       ; %bb.0: ; %entry
2305; GFX90A-TGSPLIT-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
2306; GFX90A-TGSPLIT-NEXT:    buffer_invl2
2307; GFX90A-TGSPLIT-NEXT:    buffer_wbinvl1_vol
2308; GFX90A-TGSPLIT-NEXT:    s_endpgm
2309;
2310; GFX940-NOTTGSPLIT-LABEL: system_acquire_fence:
2311; GFX940-NOTTGSPLIT:       ; %bb.0: ; %entry
2312; GFX940-NOTTGSPLIT-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
2313; GFX940-NOTTGSPLIT-NEXT:    buffer_inv sc0 sc1
2314; GFX940-NOTTGSPLIT-NEXT:    s_endpgm
2315;
2316; GFX940-TGSPLIT-LABEL: system_acquire_fence:
2317; GFX940-TGSPLIT:       ; %bb.0: ; %entry
2318; GFX940-TGSPLIT-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
2319; GFX940-TGSPLIT-NEXT:    buffer_inv sc0 sc1
2320; GFX940-TGSPLIT-NEXT:    s_endpgm
2321;
2322; GFX11-WGP-LABEL: system_acquire_fence:
2323; GFX11-WGP:       ; %bb.0: ; %entry
2324; GFX11-WGP-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
2325; GFX11-WGP-NEXT:    s_waitcnt_vscnt null, 0x0
2326; GFX11-WGP-NEXT:    buffer_gl1_inv
2327; GFX11-WGP-NEXT:    buffer_gl0_inv
2328; GFX11-WGP-NEXT:    s_endpgm
2329;
2330; GFX11-CU-LABEL: system_acquire_fence:
2331; GFX11-CU:       ; %bb.0: ; %entry
2332; GFX11-CU-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
2333; GFX11-CU-NEXT:    s_waitcnt_vscnt null, 0x0
2334; GFX11-CU-NEXT:    buffer_gl1_inv
2335; GFX11-CU-NEXT:    buffer_gl0_inv
2336; GFX11-CU-NEXT:    s_endpgm
2337;
2338; GFX12-WGP-LABEL: system_acquire_fence:
2339; GFX12-WGP:       ; %bb.0: ; %entry
2340; GFX12-WGP-NEXT:    s_wait_storecnt 0x0
2341; GFX12-WGP-NEXT:    s_wait_loadcnt_dscnt 0x0
2342; GFX12-WGP-NEXT:    global_inv scope:SCOPE_SYS
2343; GFX12-WGP-NEXT:    s_endpgm
2344;
2345; GFX12-CU-LABEL: system_acquire_fence:
2346; GFX12-CU:       ; %bb.0: ; %entry
2347; GFX12-CU-NEXT:    s_wait_storecnt 0x0
2348; GFX12-CU-NEXT:    s_wait_loadcnt_dscnt 0x0
2349; GFX12-CU-NEXT:    global_inv scope:SCOPE_SYS
2350; GFX12-CU-NEXT:    s_endpgm
2351entry:
2352  fence acquire
2353  ret void
2354}
2355
2356define amdgpu_kernel void @system_release_fence() {
2357; GFX6-LABEL: system_release_fence:
2358; GFX6:       ; %bb.0: ; %entry
2359; GFX6-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
2360; GFX6-NEXT:    s_endpgm
2361;
2362; GFX7-LABEL: system_release_fence:
2363; GFX7:       ; %bb.0: ; %entry
2364; GFX7-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
2365; GFX7-NEXT:    s_endpgm
2366;
2367; GFX10-WGP-LABEL: system_release_fence:
2368; GFX10-WGP:       ; %bb.0: ; %entry
2369; GFX10-WGP-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
2370; GFX10-WGP-NEXT:    s_waitcnt_vscnt null, 0x0
2371; GFX10-WGP-NEXT:    s_endpgm
2372;
2373; GFX10-CU-LABEL: system_release_fence:
2374; GFX10-CU:       ; %bb.0: ; %entry
2375; GFX10-CU-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
2376; GFX10-CU-NEXT:    s_waitcnt_vscnt null, 0x0
2377; GFX10-CU-NEXT:    s_endpgm
2378;
2379; SKIP-CACHE-INV-LABEL: system_release_fence:
2380; SKIP-CACHE-INV:       ; %bb.0: ; %entry
2381; SKIP-CACHE-INV-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
2382; SKIP-CACHE-INV-NEXT:    s_endpgm
2383;
2384; GFX90A-NOTTGSPLIT-LABEL: system_release_fence:
2385; GFX90A-NOTTGSPLIT:       ; %bb.0: ; %entry
2386; GFX90A-NOTTGSPLIT-NEXT:    buffer_wbl2
2387; GFX90A-NOTTGSPLIT-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
2388; GFX90A-NOTTGSPLIT-NEXT:    s_endpgm
2389;
2390; GFX90A-TGSPLIT-LABEL: system_release_fence:
2391; GFX90A-TGSPLIT:       ; %bb.0: ; %entry
2392; GFX90A-TGSPLIT-NEXT:    buffer_wbl2
2393; GFX90A-TGSPLIT-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
2394; GFX90A-TGSPLIT-NEXT:    s_endpgm
2395;
2396; GFX940-NOTTGSPLIT-LABEL: system_release_fence:
2397; GFX940-NOTTGSPLIT:       ; %bb.0: ; %entry
2398; GFX940-NOTTGSPLIT-NEXT:    buffer_wbl2 sc0 sc1
2399; GFX940-NOTTGSPLIT-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
2400; GFX940-NOTTGSPLIT-NEXT:    s_endpgm
2401;
2402; GFX940-TGSPLIT-LABEL: system_release_fence:
2403; GFX940-TGSPLIT:       ; %bb.0: ; %entry
2404; GFX940-TGSPLIT-NEXT:    buffer_wbl2 sc0 sc1
2405; GFX940-TGSPLIT-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
2406; GFX940-TGSPLIT-NEXT:    s_endpgm
2407;
2408; GFX11-WGP-LABEL: system_release_fence:
2409; GFX11-WGP:       ; %bb.0: ; %entry
2410; GFX11-WGP-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
2411; GFX11-WGP-NEXT:    s_waitcnt_vscnt null, 0x0
2412; GFX11-WGP-NEXT:    s_endpgm
2413;
2414; GFX11-CU-LABEL: system_release_fence:
2415; GFX11-CU:       ; %bb.0: ; %entry
2416; GFX11-CU-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
2417; GFX11-CU-NEXT:    s_waitcnt_vscnt null, 0x0
2418; GFX11-CU-NEXT:    s_endpgm
2419;
2420; GFX12-WGP-LABEL: system_release_fence:
2421; GFX12-WGP:       ; %bb.0: ; %entry
2422; GFX12-WGP-NEXT:    global_wb scope:SCOPE_SYS
2423; GFX12-WGP-NEXT:    s_wait_bvhcnt 0x0
2424; GFX12-WGP-NEXT:    s_wait_samplecnt 0x0
2425; GFX12-WGP-NEXT:    s_wait_storecnt 0x0
2426; GFX12-WGP-NEXT:    s_wait_loadcnt_dscnt 0x0
2427; GFX12-WGP-NEXT:    s_endpgm
2428;
2429; GFX12-CU-LABEL: system_release_fence:
2430; GFX12-CU:       ; %bb.0: ; %entry
2431; GFX12-CU-NEXT:    global_wb scope:SCOPE_SYS
2432; GFX12-CU-NEXT:    s_wait_bvhcnt 0x0
2433; GFX12-CU-NEXT:    s_wait_samplecnt 0x0
2434; GFX12-CU-NEXT:    s_wait_storecnt 0x0
2435; GFX12-CU-NEXT:    s_wait_loadcnt_dscnt 0x0
2436; GFX12-CU-NEXT:    s_endpgm
2437entry:
2438  fence release
2439  ret void
2440}
2441
2442define amdgpu_kernel void @system_acq_rel_fence() {
2443; GFX6-LABEL: system_acq_rel_fence:
2444; GFX6:       ; %bb.0: ; %entry
2445; GFX6-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
2446; GFX6-NEXT:    buffer_wbinvl1
2447; GFX6-NEXT:    s_endpgm
2448;
2449; GFX7-LABEL: system_acq_rel_fence:
2450; GFX7:       ; %bb.0: ; %entry
2451; GFX7-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
2452; GFX7-NEXT:    buffer_wbinvl1_vol
2453; GFX7-NEXT:    s_endpgm
2454;
2455; GFX10-WGP-LABEL: system_acq_rel_fence:
2456; GFX10-WGP:       ; %bb.0: ; %entry
2457; GFX10-WGP-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
2458; GFX10-WGP-NEXT:    s_waitcnt_vscnt null, 0x0
2459; GFX10-WGP-NEXT:    buffer_gl1_inv
2460; GFX10-WGP-NEXT:    buffer_gl0_inv
2461; GFX10-WGP-NEXT:    s_endpgm
2462;
2463; GFX10-CU-LABEL: system_acq_rel_fence:
2464; GFX10-CU:       ; %bb.0: ; %entry
2465; GFX10-CU-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
2466; GFX10-CU-NEXT:    s_waitcnt_vscnt null, 0x0
2467; GFX10-CU-NEXT:    buffer_gl1_inv
2468; GFX10-CU-NEXT:    buffer_gl0_inv
2469; GFX10-CU-NEXT:    s_endpgm
2470;
2471; SKIP-CACHE-INV-LABEL: system_acq_rel_fence:
2472; SKIP-CACHE-INV:       ; %bb.0: ; %entry
2473; SKIP-CACHE-INV-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
2474; SKIP-CACHE-INV-NEXT:    s_endpgm
2475;
2476; GFX90A-NOTTGSPLIT-LABEL: system_acq_rel_fence:
2477; GFX90A-NOTTGSPLIT:       ; %bb.0: ; %entry
2478; GFX90A-NOTTGSPLIT-NEXT:    buffer_wbl2
2479; GFX90A-NOTTGSPLIT-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
2480; GFX90A-NOTTGSPLIT-NEXT:    buffer_invl2
2481; GFX90A-NOTTGSPLIT-NEXT:    buffer_wbinvl1_vol
2482; GFX90A-NOTTGSPLIT-NEXT:    s_endpgm
2483;
2484; GFX90A-TGSPLIT-LABEL: system_acq_rel_fence:
2485; GFX90A-TGSPLIT:       ; %bb.0: ; %entry
2486; GFX90A-TGSPLIT-NEXT:    buffer_wbl2
2487; GFX90A-TGSPLIT-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
2488; GFX90A-TGSPLIT-NEXT:    buffer_invl2
2489; GFX90A-TGSPLIT-NEXT:    buffer_wbinvl1_vol
2490; GFX90A-TGSPLIT-NEXT:    s_endpgm
2491;
2492; GFX940-NOTTGSPLIT-LABEL: system_acq_rel_fence:
2493; GFX940-NOTTGSPLIT:       ; %bb.0: ; %entry
2494; GFX940-NOTTGSPLIT-NEXT:    buffer_wbl2 sc0 sc1
2495; GFX940-NOTTGSPLIT-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
2496; GFX940-NOTTGSPLIT-NEXT:    buffer_inv sc0 sc1
2497; GFX940-NOTTGSPLIT-NEXT:    s_endpgm
2498;
2499; GFX940-TGSPLIT-LABEL: system_acq_rel_fence:
2500; GFX940-TGSPLIT:       ; %bb.0: ; %entry
2501; GFX940-TGSPLIT-NEXT:    buffer_wbl2 sc0 sc1
2502; GFX940-TGSPLIT-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
2503; GFX940-TGSPLIT-NEXT:    buffer_inv sc0 sc1
2504; GFX940-TGSPLIT-NEXT:    s_endpgm
2505;
2506; GFX11-WGP-LABEL: system_acq_rel_fence:
2507; GFX11-WGP:       ; %bb.0: ; %entry
2508; GFX11-WGP-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
2509; GFX11-WGP-NEXT:    s_waitcnt_vscnt null, 0x0
2510; GFX11-WGP-NEXT:    buffer_gl1_inv
2511; GFX11-WGP-NEXT:    buffer_gl0_inv
2512; GFX11-WGP-NEXT:    s_endpgm
2513;
2514; GFX11-CU-LABEL: system_acq_rel_fence:
2515; GFX11-CU:       ; %bb.0: ; %entry
2516; GFX11-CU-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
2517; GFX11-CU-NEXT:    s_waitcnt_vscnt null, 0x0
2518; GFX11-CU-NEXT:    buffer_gl1_inv
2519; GFX11-CU-NEXT:    buffer_gl0_inv
2520; GFX11-CU-NEXT:    s_endpgm
2521;
2522; GFX12-WGP-LABEL: system_acq_rel_fence:
2523; GFX12-WGP:       ; %bb.0: ; %entry
2524; GFX12-WGP-NEXT:    global_wb scope:SCOPE_SYS
2525; GFX12-WGP-NEXT:    s_wait_bvhcnt 0x0
2526; GFX12-WGP-NEXT:    s_wait_samplecnt 0x0
2527; GFX12-WGP-NEXT:    s_wait_storecnt 0x0
2528; GFX12-WGP-NEXT:    s_wait_loadcnt_dscnt 0x0
2529; GFX12-WGP-NEXT:    global_inv scope:SCOPE_SYS
2530; GFX12-WGP-NEXT:    s_endpgm
2531;
2532; GFX12-CU-LABEL: system_acq_rel_fence:
2533; GFX12-CU:       ; %bb.0: ; %entry
2534; GFX12-CU-NEXT:    global_wb scope:SCOPE_SYS
2535; GFX12-CU-NEXT:    s_wait_bvhcnt 0x0
2536; GFX12-CU-NEXT:    s_wait_samplecnt 0x0
2537; GFX12-CU-NEXT:    s_wait_storecnt 0x0
2538; GFX12-CU-NEXT:    s_wait_loadcnt_dscnt 0x0
2539; GFX12-CU-NEXT:    global_inv scope:SCOPE_SYS
2540; GFX12-CU-NEXT:    s_endpgm
2541entry:
2542  fence acq_rel
2543  ret void
2544}
2545
2546define amdgpu_kernel void @system_seq_cst_fence() {
2547; GFX6-LABEL: system_seq_cst_fence:
2548; GFX6:       ; %bb.0: ; %entry
2549; GFX6-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
2550; GFX6-NEXT:    buffer_wbinvl1
2551; GFX6-NEXT:    s_endpgm
2552;
2553; GFX7-LABEL: system_seq_cst_fence:
2554; GFX7:       ; %bb.0: ; %entry
2555; GFX7-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
2556; GFX7-NEXT:    buffer_wbinvl1_vol
2557; GFX7-NEXT:    s_endpgm
2558;
2559; GFX10-WGP-LABEL: system_seq_cst_fence:
2560; GFX10-WGP:       ; %bb.0: ; %entry
2561; GFX10-WGP-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
2562; GFX10-WGP-NEXT:    s_waitcnt_vscnt null, 0x0
2563; GFX10-WGP-NEXT:    buffer_gl1_inv
2564; GFX10-WGP-NEXT:    buffer_gl0_inv
2565; GFX10-WGP-NEXT:    s_endpgm
2566;
2567; GFX10-CU-LABEL: system_seq_cst_fence:
2568; GFX10-CU:       ; %bb.0: ; %entry
2569; GFX10-CU-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
2570; GFX10-CU-NEXT:    s_waitcnt_vscnt null, 0x0
2571; GFX10-CU-NEXT:    buffer_gl1_inv
2572; GFX10-CU-NEXT:    buffer_gl0_inv
2573; GFX10-CU-NEXT:    s_endpgm
2574;
2575; SKIP-CACHE-INV-LABEL: system_seq_cst_fence:
2576; SKIP-CACHE-INV:       ; %bb.0: ; %entry
2577; SKIP-CACHE-INV-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
2578; SKIP-CACHE-INV-NEXT:    s_endpgm
2579;
2580; GFX90A-NOTTGSPLIT-LABEL: system_seq_cst_fence:
2581; GFX90A-NOTTGSPLIT:       ; %bb.0: ; %entry
2582; GFX90A-NOTTGSPLIT-NEXT:    buffer_wbl2
2583; GFX90A-NOTTGSPLIT-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
2584; GFX90A-NOTTGSPLIT-NEXT:    buffer_invl2
2585; GFX90A-NOTTGSPLIT-NEXT:    buffer_wbinvl1_vol
2586; GFX90A-NOTTGSPLIT-NEXT:    s_endpgm
2587;
2588; GFX90A-TGSPLIT-LABEL: system_seq_cst_fence:
2589; GFX90A-TGSPLIT:       ; %bb.0: ; %entry
2590; GFX90A-TGSPLIT-NEXT:    buffer_wbl2
2591; GFX90A-TGSPLIT-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
2592; GFX90A-TGSPLIT-NEXT:    buffer_invl2
2593; GFX90A-TGSPLIT-NEXT:    buffer_wbinvl1_vol
2594; GFX90A-TGSPLIT-NEXT:    s_endpgm
2595;
2596; GFX940-NOTTGSPLIT-LABEL: system_seq_cst_fence:
2597; GFX940-NOTTGSPLIT:       ; %bb.0: ; %entry
2598; GFX940-NOTTGSPLIT-NEXT:    buffer_wbl2 sc0 sc1
2599; GFX940-NOTTGSPLIT-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
2600; GFX940-NOTTGSPLIT-NEXT:    buffer_inv sc0 sc1
2601; GFX940-NOTTGSPLIT-NEXT:    s_endpgm
2602;
2603; GFX940-TGSPLIT-LABEL: system_seq_cst_fence:
2604; GFX940-TGSPLIT:       ; %bb.0: ; %entry
2605; GFX940-TGSPLIT-NEXT:    buffer_wbl2 sc0 sc1
2606; GFX940-TGSPLIT-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
2607; GFX940-TGSPLIT-NEXT:    buffer_inv sc0 sc1
2608; GFX940-TGSPLIT-NEXT:    s_endpgm
2609;
2610; GFX11-WGP-LABEL: system_seq_cst_fence:
2611; GFX11-WGP:       ; %bb.0: ; %entry
2612; GFX11-WGP-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
2613; GFX11-WGP-NEXT:    s_waitcnt_vscnt null, 0x0
2614; GFX11-WGP-NEXT:    buffer_gl1_inv
2615; GFX11-WGP-NEXT:    buffer_gl0_inv
2616; GFX11-WGP-NEXT:    s_endpgm
2617;
2618; GFX11-CU-LABEL: system_seq_cst_fence:
2619; GFX11-CU:       ; %bb.0: ; %entry
2620; GFX11-CU-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
2621; GFX11-CU-NEXT:    s_waitcnt_vscnt null, 0x0
2622; GFX11-CU-NEXT:    buffer_gl1_inv
2623; GFX11-CU-NEXT:    buffer_gl0_inv
2624; GFX11-CU-NEXT:    s_endpgm
2625;
2626; GFX12-WGP-LABEL: system_seq_cst_fence:
2627; GFX12-WGP:       ; %bb.0: ; %entry
2628; GFX12-WGP-NEXT:    global_wb scope:SCOPE_SYS
2629; GFX12-WGP-NEXT:    s_wait_bvhcnt 0x0
2630; GFX12-WGP-NEXT:    s_wait_samplecnt 0x0
2631; GFX12-WGP-NEXT:    s_wait_storecnt 0x0
2632; GFX12-WGP-NEXT:    s_wait_loadcnt_dscnt 0x0
2633; GFX12-WGP-NEXT:    global_inv scope:SCOPE_SYS
2634; GFX12-WGP-NEXT:    s_endpgm
2635;
2636; GFX12-CU-LABEL: system_seq_cst_fence:
2637; GFX12-CU:       ; %bb.0: ; %entry
2638; GFX12-CU-NEXT:    global_wb scope:SCOPE_SYS
2639; GFX12-CU-NEXT:    s_wait_bvhcnt 0x0
2640; GFX12-CU-NEXT:    s_wait_samplecnt 0x0
2641; GFX12-CU-NEXT:    s_wait_storecnt 0x0
2642; GFX12-CU-NEXT:    s_wait_loadcnt_dscnt 0x0
2643; GFX12-CU-NEXT:    global_inv scope:SCOPE_SYS
2644; GFX12-CU-NEXT:    s_endpgm
2645entry:
2646  fence seq_cst
2647  ret void
2648}
2649
2650define amdgpu_kernel void @system_one_as_acquire_fence() {
2651; GFX6-LABEL: system_one_as_acquire_fence:
2652; GFX6:       ; %bb.0: ; %entry
2653; GFX6-NEXT:    s_waitcnt vmcnt(0)
2654; GFX6-NEXT:    buffer_wbinvl1
2655; GFX6-NEXT:    s_endpgm
2656;
2657; GFX7-LABEL: system_one_as_acquire_fence:
2658; GFX7:       ; %bb.0: ; %entry
2659; GFX7-NEXT:    s_waitcnt vmcnt(0)
2660; GFX7-NEXT:    buffer_wbinvl1_vol
2661; GFX7-NEXT:    s_endpgm
2662;
2663; GFX10-WGP-LABEL: system_one_as_acquire_fence:
2664; GFX10-WGP:       ; %bb.0: ; %entry
2665; GFX10-WGP-NEXT:    s_waitcnt vmcnt(0)
2666; GFX10-WGP-NEXT:    s_waitcnt_vscnt null, 0x0
2667; GFX10-WGP-NEXT:    buffer_gl1_inv
2668; GFX10-WGP-NEXT:    buffer_gl0_inv
2669; GFX10-WGP-NEXT:    s_endpgm
2670;
2671; GFX10-CU-LABEL: system_one_as_acquire_fence:
2672; GFX10-CU:       ; %bb.0: ; %entry
2673; GFX10-CU-NEXT:    s_waitcnt vmcnt(0)
2674; GFX10-CU-NEXT:    s_waitcnt_vscnt null, 0x0
2675; GFX10-CU-NEXT:    buffer_gl1_inv
2676; GFX10-CU-NEXT:    buffer_gl0_inv
2677; GFX10-CU-NEXT:    s_endpgm
2678;
2679; SKIP-CACHE-INV-LABEL: system_one_as_acquire_fence:
2680; SKIP-CACHE-INV:       ; %bb.0: ; %entry
2681; SKIP-CACHE-INV-NEXT:    s_waitcnt vmcnt(0)
2682; SKIP-CACHE-INV-NEXT:    s_endpgm
2683;
2684; GFX90A-NOTTGSPLIT-LABEL: system_one_as_acquire_fence:
2685; GFX90A-NOTTGSPLIT:       ; %bb.0: ; %entry
2686; GFX90A-NOTTGSPLIT-NEXT:    s_waitcnt vmcnt(0)
2687; GFX90A-NOTTGSPLIT-NEXT:    buffer_invl2
2688; GFX90A-NOTTGSPLIT-NEXT:    buffer_wbinvl1_vol
2689; GFX90A-NOTTGSPLIT-NEXT:    s_endpgm
2690;
2691; GFX90A-TGSPLIT-LABEL: system_one_as_acquire_fence:
2692; GFX90A-TGSPLIT:       ; %bb.0: ; %entry
2693; GFX90A-TGSPLIT-NEXT:    s_waitcnt vmcnt(0)
2694; GFX90A-TGSPLIT-NEXT:    buffer_invl2
2695; GFX90A-TGSPLIT-NEXT:    buffer_wbinvl1_vol
2696; GFX90A-TGSPLIT-NEXT:    s_endpgm
2697;
2698; GFX940-NOTTGSPLIT-LABEL: system_one_as_acquire_fence:
2699; GFX940-NOTTGSPLIT:       ; %bb.0: ; %entry
2700; GFX940-NOTTGSPLIT-NEXT:    s_waitcnt vmcnt(0)
2701; GFX940-NOTTGSPLIT-NEXT:    buffer_inv sc0 sc1
2702; GFX940-NOTTGSPLIT-NEXT:    s_endpgm
2703;
2704; GFX940-TGSPLIT-LABEL: system_one_as_acquire_fence:
2705; GFX940-TGSPLIT:       ; %bb.0: ; %entry
2706; GFX940-TGSPLIT-NEXT:    s_waitcnt vmcnt(0)
2707; GFX940-TGSPLIT-NEXT:    buffer_inv sc0 sc1
2708; GFX940-TGSPLIT-NEXT:    s_endpgm
2709;
2710; GFX11-WGP-LABEL: system_one_as_acquire_fence:
2711; GFX11-WGP:       ; %bb.0: ; %entry
2712; GFX11-WGP-NEXT:    s_waitcnt vmcnt(0)
2713; GFX11-WGP-NEXT:    s_waitcnt_vscnt null, 0x0
2714; GFX11-WGP-NEXT:    buffer_gl1_inv
2715; GFX11-WGP-NEXT:    buffer_gl0_inv
2716; GFX11-WGP-NEXT:    s_endpgm
2717;
2718; GFX11-CU-LABEL: system_one_as_acquire_fence:
2719; GFX11-CU:       ; %bb.0: ; %entry
2720; GFX11-CU-NEXT:    s_waitcnt vmcnt(0)
2721; GFX11-CU-NEXT:    s_waitcnt_vscnt null, 0x0
2722; GFX11-CU-NEXT:    buffer_gl1_inv
2723; GFX11-CU-NEXT:    buffer_gl0_inv
2724; GFX11-CU-NEXT:    s_endpgm
2725;
2726; GFX12-WGP-LABEL: system_one_as_acquire_fence:
2727; GFX12-WGP:       ; %bb.0: ; %entry
2728; GFX12-WGP-NEXT:    s_wait_loadcnt 0x0
2729; GFX12-WGP-NEXT:    s_wait_storecnt 0x0
2730; GFX12-WGP-NEXT:    global_inv scope:SCOPE_SYS
2731; GFX12-WGP-NEXT:    s_endpgm
2732;
2733; GFX12-CU-LABEL: system_one_as_acquire_fence:
2734; GFX12-CU:       ; %bb.0: ; %entry
2735; GFX12-CU-NEXT:    s_wait_loadcnt 0x0
2736; GFX12-CU-NEXT:    s_wait_storecnt 0x0
2737; GFX12-CU-NEXT:    global_inv scope:SCOPE_SYS
2738; GFX12-CU-NEXT:    s_endpgm
2739entry:
2740  fence syncscope("one-as") acquire
2741  ret void
2742}
2743
2744define amdgpu_kernel void @system_one_as_release_fence() {
2745; GFX6-LABEL: system_one_as_release_fence:
2746; GFX6:       ; %bb.0: ; %entry
2747; GFX6-NEXT:    s_waitcnt vmcnt(0)
2748; GFX6-NEXT:    s_endpgm
2749;
2750; GFX7-LABEL: system_one_as_release_fence:
2751; GFX7:       ; %bb.0: ; %entry
2752; GFX7-NEXT:    s_waitcnt vmcnt(0)
2753; GFX7-NEXT:    s_endpgm
2754;
2755; GFX10-WGP-LABEL: system_one_as_release_fence:
2756; GFX10-WGP:       ; %bb.0: ; %entry
2757; GFX10-WGP-NEXT:    s_waitcnt vmcnt(0)
2758; GFX10-WGP-NEXT:    s_waitcnt_vscnt null, 0x0
2759; GFX10-WGP-NEXT:    s_endpgm
2760;
2761; GFX10-CU-LABEL: system_one_as_release_fence:
2762; GFX10-CU:       ; %bb.0: ; %entry
2763; GFX10-CU-NEXT:    s_waitcnt vmcnt(0)
2764; GFX10-CU-NEXT:    s_waitcnt_vscnt null, 0x0
2765; GFX10-CU-NEXT:    s_endpgm
2766;
2767; SKIP-CACHE-INV-LABEL: system_one_as_release_fence:
2768; SKIP-CACHE-INV:       ; %bb.0: ; %entry
2769; SKIP-CACHE-INV-NEXT:    s_waitcnt vmcnt(0)
2770; SKIP-CACHE-INV-NEXT:    s_endpgm
2771;
2772; GFX90A-NOTTGSPLIT-LABEL: system_one_as_release_fence:
2773; GFX90A-NOTTGSPLIT:       ; %bb.0: ; %entry
2774; GFX90A-NOTTGSPLIT-NEXT:    buffer_wbl2
2775; GFX90A-NOTTGSPLIT-NEXT:    s_waitcnt vmcnt(0)
2776; GFX90A-NOTTGSPLIT-NEXT:    s_endpgm
2777;
2778; GFX90A-TGSPLIT-LABEL: system_one_as_release_fence:
2779; GFX90A-TGSPLIT:       ; %bb.0: ; %entry
2780; GFX90A-TGSPLIT-NEXT:    buffer_wbl2
2781; GFX90A-TGSPLIT-NEXT:    s_waitcnt vmcnt(0)
2782; GFX90A-TGSPLIT-NEXT:    s_endpgm
2783;
2784; GFX940-NOTTGSPLIT-LABEL: system_one_as_release_fence:
2785; GFX940-NOTTGSPLIT:       ; %bb.0: ; %entry
2786; GFX940-NOTTGSPLIT-NEXT:    buffer_wbl2 sc0 sc1
2787; GFX940-NOTTGSPLIT-NEXT:    s_waitcnt vmcnt(0)
2788; GFX940-NOTTGSPLIT-NEXT:    s_endpgm
2789;
2790; GFX940-TGSPLIT-LABEL: system_one_as_release_fence:
2791; GFX940-TGSPLIT:       ; %bb.0: ; %entry
2792; GFX940-TGSPLIT-NEXT:    buffer_wbl2 sc0 sc1
2793; GFX940-TGSPLIT-NEXT:    s_waitcnt vmcnt(0)
2794; GFX940-TGSPLIT-NEXT:    s_endpgm
2795;
2796; GFX11-WGP-LABEL: system_one_as_release_fence:
2797; GFX11-WGP:       ; %bb.0: ; %entry
2798; GFX11-WGP-NEXT:    s_waitcnt vmcnt(0)
2799; GFX11-WGP-NEXT:    s_waitcnt_vscnt null, 0x0
2800; GFX11-WGP-NEXT:    s_endpgm
2801;
2802; GFX11-CU-LABEL: system_one_as_release_fence:
2803; GFX11-CU:       ; %bb.0: ; %entry
2804; GFX11-CU-NEXT:    s_waitcnt vmcnt(0)
2805; GFX11-CU-NEXT:    s_waitcnt_vscnt null, 0x0
2806; GFX11-CU-NEXT:    s_endpgm
2807;
2808; GFX12-WGP-LABEL: system_one_as_release_fence:
2809; GFX12-WGP:       ; %bb.0: ; %entry
2810; GFX12-WGP-NEXT:    global_wb scope:SCOPE_SYS
2811; GFX12-WGP-NEXT:    s_wait_bvhcnt 0x0
2812; GFX12-WGP-NEXT:    s_wait_samplecnt 0x0
2813; GFX12-WGP-NEXT:    s_wait_loadcnt 0x0
2814; GFX12-WGP-NEXT:    s_wait_storecnt 0x0
2815; GFX12-WGP-NEXT:    s_endpgm
2816;
2817; GFX12-CU-LABEL: system_one_as_release_fence:
2818; GFX12-CU:       ; %bb.0: ; %entry
2819; GFX12-CU-NEXT:    global_wb scope:SCOPE_SYS
2820; GFX12-CU-NEXT:    s_wait_bvhcnt 0x0
2821; GFX12-CU-NEXT:    s_wait_samplecnt 0x0
2822; GFX12-CU-NEXT:    s_wait_loadcnt 0x0
2823; GFX12-CU-NEXT:    s_wait_storecnt 0x0
2824; GFX12-CU-NEXT:    s_endpgm
2825entry:
2826  fence syncscope("one-as") release
2827  ret void
2828}
2829
2830define amdgpu_kernel void @system_one_as_acq_rel_fence() {
2831; GFX6-LABEL: system_one_as_acq_rel_fence:
2832; GFX6:       ; %bb.0: ; %entry
2833; GFX6-NEXT:    s_waitcnt vmcnt(0)
2834; GFX6-NEXT:    buffer_wbinvl1
2835; GFX6-NEXT:    s_endpgm
2836;
2837; GFX7-LABEL: system_one_as_acq_rel_fence:
2838; GFX7:       ; %bb.0: ; %entry
2839; GFX7-NEXT:    s_waitcnt vmcnt(0)
2840; GFX7-NEXT:    buffer_wbinvl1_vol
2841; GFX7-NEXT:    s_endpgm
2842;
2843; GFX10-WGP-LABEL: system_one_as_acq_rel_fence:
2844; GFX10-WGP:       ; %bb.0: ; %entry
2845; GFX10-WGP-NEXT:    s_waitcnt vmcnt(0)
2846; GFX10-WGP-NEXT:    s_waitcnt_vscnt null, 0x0
2847; GFX10-WGP-NEXT:    buffer_gl1_inv
2848; GFX10-WGP-NEXT:    buffer_gl0_inv
2849; GFX10-WGP-NEXT:    s_endpgm
2850;
2851; GFX10-CU-LABEL: system_one_as_acq_rel_fence:
2852; GFX10-CU:       ; %bb.0: ; %entry
2853; GFX10-CU-NEXT:    s_waitcnt vmcnt(0)
2854; GFX10-CU-NEXT:    s_waitcnt_vscnt null, 0x0
2855; GFX10-CU-NEXT:    buffer_gl1_inv
2856; GFX10-CU-NEXT:    buffer_gl0_inv
2857; GFX10-CU-NEXT:    s_endpgm
2858;
2859; SKIP-CACHE-INV-LABEL: system_one_as_acq_rel_fence:
2860; SKIP-CACHE-INV:       ; %bb.0: ; %entry
2861; SKIP-CACHE-INV-NEXT:    s_waitcnt vmcnt(0)
2862; SKIP-CACHE-INV-NEXT:    s_endpgm
2863;
2864; GFX90A-NOTTGSPLIT-LABEL: system_one_as_acq_rel_fence:
2865; GFX90A-NOTTGSPLIT:       ; %bb.0: ; %entry
2866; GFX90A-NOTTGSPLIT-NEXT:    buffer_wbl2
2867; GFX90A-NOTTGSPLIT-NEXT:    s_waitcnt vmcnt(0)
2868; GFX90A-NOTTGSPLIT-NEXT:    buffer_invl2
2869; GFX90A-NOTTGSPLIT-NEXT:    buffer_wbinvl1_vol
2870; GFX90A-NOTTGSPLIT-NEXT:    s_endpgm
2871;
2872; GFX90A-TGSPLIT-LABEL: system_one_as_acq_rel_fence:
2873; GFX90A-TGSPLIT:       ; %bb.0: ; %entry
2874; GFX90A-TGSPLIT-NEXT:    buffer_wbl2
2875; GFX90A-TGSPLIT-NEXT:    s_waitcnt vmcnt(0)
2876; GFX90A-TGSPLIT-NEXT:    buffer_invl2
2877; GFX90A-TGSPLIT-NEXT:    buffer_wbinvl1_vol
2878; GFX90A-TGSPLIT-NEXT:    s_endpgm
2879;
2880; GFX940-NOTTGSPLIT-LABEL: system_one_as_acq_rel_fence:
2881; GFX940-NOTTGSPLIT:       ; %bb.0: ; %entry
2882; GFX940-NOTTGSPLIT-NEXT:    buffer_wbl2 sc0 sc1
2883; GFX940-NOTTGSPLIT-NEXT:    s_waitcnt vmcnt(0)
2884; GFX940-NOTTGSPLIT-NEXT:    buffer_inv sc0 sc1
2885; GFX940-NOTTGSPLIT-NEXT:    s_endpgm
2886;
2887; GFX940-TGSPLIT-LABEL: system_one_as_acq_rel_fence:
2888; GFX940-TGSPLIT:       ; %bb.0: ; %entry
2889; GFX940-TGSPLIT-NEXT:    buffer_wbl2 sc0 sc1
2890; GFX940-TGSPLIT-NEXT:    s_waitcnt vmcnt(0)
2891; GFX940-TGSPLIT-NEXT:    buffer_inv sc0 sc1
2892; GFX940-TGSPLIT-NEXT:    s_endpgm
2893;
2894; GFX11-WGP-LABEL: system_one_as_acq_rel_fence:
2895; GFX11-WGP:       ; %bb.0: ; %entry
2896; GFX11-WGP-NEXT:    s_waitcnt vmcnt(0)
2897; GFX11-WGP-NEXT:    s_waitcnt_vscnt null, 0x0
2898; GFX11-WGP-NEXT:    buffer_gl1_inv
2899; GFX11-WGP-NEXT:    buffer_gl0_inv
2900; GFX11-WGP-NEXT:    s_endpgm
2901;
2902; GFX11-CU-LABEL: system_one_as_acq_rel_fence:
2903; GFX11-CU:       ; %bb.0: ; %entry
2904; GFX11-CU-NEXT:    s_waitcnt vmcnt(0)
2905; GFX11-CU-NEXT:    s_waitcnt_vscnt null, 0x0
2906; GFX11-CU-NEXT:    buffer_gl1_inv
2907; GFX11-CU-NEXT:    buffer_gl0_inv
2908; GFX11-CU-NEXT:    s_endpgm
2909;
2910; GFX12-WGP-LABEL: system_one_as_acq_rel_fence:
2911; GFX12-WGP:       ; %bb.0: ; %entry
2912; GFX12-WGP-NEXT:    global_wb scope:SCOPE_SYS
2913; GFX12-WGP-NEXT:    s_wait_bvhcnt 0x0
2914; GFX12-WGP-NEXT:    s_wait_samplecnt 0x0
2915; GFX12-WGP-NEXT:    s_wait_loadcnt 0x0
2916; GFX12-WGP-NEXT:    s_wait_storecnt 0x0
2917; GFX12-WGP-NEXT:    global_inv scope:SCOPE_SYS
2918; GFX12-WGP-NEXT:    s_endpgm
2919;
2920; GFX12-CU-LABEL: system_one_as_acq_rel_fence:
2921; GFX12-CU:       ; %bb.0: ; %entry
2922; GFX12-CU-NEXT:    global_wb scope:SCOPE_SYS
2923; GFX12-CU-NEXT:    s_wait_bvhcnt 0x0
2924; GFX12-CU-NEXT:    s_wait_samplecnt 0x0
2925; GFX12-CU-NEXT:    s_wait_loadcnt 0x0
2926; GFX12-CU-NEXT:    s_wait_storecnt 0x0
2927; GFX12-CU-NEXT:    global_inv scope:SCOPE_SYS
2928; GFX12-CU-NEXT:    s_endpgm
2929entry:
2930  fence syncscope("one-as") acq_rel
2931  ret void
2932}
2933
2934define amdgpu_kernel void @system_one_as_seq_cst_fence() {
2935; GFX6-LABEL: system_one_as_seq_cst_fence:
2936; GFX6:       ; %bb.0: ; %entry
2937; GFX6-NEXT:    s_waitcnt vmcnt(0)
2938; GFX6-NEXT:    buffer_wbinvl1
2939; GFX6-NEXT:    s_endpgm
2940;
2941; GFX7-LABEL: system_one_as_seq_cst_fence:
2942; GFX7:       ; %bb.0: ; %entry
2943; GFX7-NEXT:    s_waitcnt vmcnt(0)
2944; GFX7-NEXT:    buffer_wbinvl1_vol
2945; GFX7-NEXT:    s_endpgm
2946;
2947; GFX10-WGP-LABEL: system_one_as_seq_cst_fence:
2948; GFX10-WGP:       ; %bb.0: ; %entry
2949; GFX10-WGP-NEXT:    s_waitcnt vmcnt(0)
2950; GFX10-WGP-NEXT:    s_waitcnt_vscnt null, 0x0
2951; GFX10-WGP-NEXT:    buffer_gl1_inv
2952; GFX10-WGP-NEXT:    buffer_gl0_inv
2953; GFX10-WGP-NEXT:    s_endpgm
2954;
2955; GFX10-CU-LABEL: system_one_as_seq_cst_fence:
2956; GFX10-CU:       ; %bb.0: ; %entry
2957; GFX10-CU-NEXT:    s_waitcnt vmcnt(0)
2958; GFX10-CU-NEXT:    s_waitcnt_vscnt null, 0x0
2959; GFX10-CU-NEXT:    buffer_gl1_inv
2960; GFX10-CU-NEXT:    buffer_gl0_inv
2961; GFX10-CU-NEXT:    s_endpgm
2962;
2963; SKIP-CACHE-INV-LABEL: system_one_as_seq_cst_fence:
2964; SKIP-CACHE-INV:       ; %bb.0: ; %entry
2965; SKIP-CACHE-INV-NEXT:    s_waitcnt vmcnt(0)
2966; SKIP-CACHE-INV-NEXT:    s_endpgm
2967;
2968; GFX90A-NOTTGSPLIT-LABEL: system_one_as_seq_cst_fence:
2969; GFX90A-NOTTGSPLIT:       ; %bb.0: ; %entry
2970; GFX90A-NOTTGSPLIT-NEXT:    buffer_wbl2
2971; GFX90A-NOTTGSPLIT-NEXT:    s_waitcnt vmcnt(0)
2972; GFX90A-NOTTGSPLIT-NEXT:    buffer_invl2
2973; GFX90A-NOTTGSPLIT-NEXT:    buffer_wbinvl1_vol
2974; GFX90A-NOTTGSPLIT-NEXT:    s_endpgm
2975;
2976; GFX90A-TGSPLIT-LABEL: system_one_as_seq_cst_fence:
2977; GFX90A-TGSPLIT:       ; %bb.0: ; %entry
2978; GFX90A-TGSPLIT-NEXT:    buffer_wbl2
2979; GFX90A-TGSPLIT-NEXT:    s_waitcnt vmcnt(0)
2980; GFX90A-TGSPLIT-NEXT:    buffer_invl2
2981; GFX90A-TGSPLIT-NEXT:    buffer_wbinvl1_vol
2982; GFX90A-TGSPLIT-NEXT:    s_endpgm
2983;
2984; GFX940-NOTTGSPLIT-LABEL: system_one_as_seq_cst_fence:
2985; GFX940-NOTTGSPLIT:       ; %bb.0: ; %entry
2986; GFX940-NOTTGSPLIT-NEXT:    buffer_wbl2 sc0 sc1
2987; GFX940-NOTTGSPLIT-NEXT:    s_waitcnt vmcnt(0)
2988; GFX940-NOTTGSPLIT-NEXT:    buffer_inv sc0 sc1
2989; GFX940-NOTTGSPLIT-NEXT:    s_endpgm
2990;
2991; GFX940-TGSPLIT-LABEL: system_one_as_seq_cst_fence:
2992; GFX940-TGSPLIT:       ; %bb.0: ; %entry
2993; GFX940-TGSPLIT-NEXT:    buffer_wbl2 sc0 sc1
2994; GFX940-TGSPLIT-NEXT:    s_waitcnt vmcnt(0)
2995; GFX940-TGSPLIT-NEXT:    buffer_inv sc0 sc1
2996; GFX940-TGSPLIT-NEXT:    s_endpgm
2997;
2998; GFX11-WGP-LABEL: system_one_as_seq_cst_fence:
2999; GFX11-WGP:       ; %bb.0: ; %entry
3000; GFX11-WGP-NEXT:    s_waitcnt vmcnt(0)
3001; GFX11-WGP-NEXT:    s_waitcnt_vscnt null, 0x0
3002; GFX11-WGP-NEXT:    buffer_gl1_inv
3003; GFX11-WGP-NEXT:    buffer_gl0_inv
3004; GFX11-WGP-NEXT:    s_endpgm
3005;
3006; GFX11-CU-LABEL: system_one_as_seq_cst_fence:
3007; GFX11-CU:       ; %bb.0: ; %entry
3008; GFX11-CU-NEXT:    s_waitcnt vmcnt(0)
3009; GFX11-CU-NEXT:    s_waitcnt_vscnt null, 0x0
3010; GFX11-CU-NEXT:    buffer_gl1_inv
3011; GFX11-CU-NEXT:    buffer_gl0_inv
3012; GFX11-CU-NEXT:    s_endpgm
3013;
3014; GFX12-WGP-LABEL: system_one_as_seq_cst_fence:
3015; GFX12-WGP:       ; %bb.0: ; %entry
3016; GFX12-WGP-NEXT:    global_wb scope:SCOPE_SYS
3017; GFX12-WGP-NEXT:    s_wait_bvhcnt 0x0
3018; GFX12-WGP-NEXT:    s_wait_samplecnt 0x0
3019; GFX12-WGP-NEXT:    s_wait_loadcnt 0x0
3020; GFX12-WGP-NEXT:    s_wait_storecnt 0x0
3021; GFX12-WGP-NEXT:    global_inv scope:SCOPE_SYS
3022; GFX12-WGP-NEXT:    s_endpgm
3023;
3024; GFX12-CU-LABEL: system_one_as_seq_cst_fence:
3025; GFX12-CU:       ; %bb.0: ; %entry
3026; GFX12-CU-NEXT:    global_wb scope:SCOPE_SYS
3027; GFX12-CU-NEXT:    s_wait_bvhcnt 0x0
3028; GFX12-CU-NEXT:    s_wait_samplecnt 0x0
3029; GFX12-CU-NEXT:    s_wait_loadcnt 0x0
3030; GFX12-CU-NEXT:    s_wait_storecnt 0x0
3031; GFX12-CU-NEXT:    global_inv scope:SCOPE_SYS
3032; GFX12-CU-NEXT:    s_endpgm
3033entry:
3034  fence syncscope("one-as") seq_cst
3035  ret void
3036}
3037