blob: 179cb3f625d9853c69ea48e6ead5e2f8cedd47a0 [file] [log] [blame]
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +00001; RUN: llc -mtriple=amdgcn-amd- -mcpu=gfx803 -verify-machineinstrs < %s | FileCheck --check-prefixes=GCN,GFX8,GFX89 %s
2; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx803 -verify-machineinstrs < %s | FileCheck --check-prefixes=GCN,GFX8,GFX89 %s
Ron Liebermanf48e43b2018-11-30 18:29:17 +00003; RUN: llc -mtriple=amdgcn-amd- -mcpu=gfx900 -verify-machineinstrs -amdgpu-enable-global-sgpr-addr < %s | FileCheck --check-prefixes=GCN,GFX9,GFX89 %s
4; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -verify-machineinstrs -amdgpu-enable-global-sgpr-addr < %s | FileCheck --check-prefixes=GCN,GFX9,GFX89 %s
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +00005
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +00006declare i32 @llvm.amdgcn.workitem.id.x()
7
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +00008; GCN-LABEL: {{^}}system_unordered:
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +00009; GCN-NOT: s_waitcnt vmcnt(0){{$}}
10; GCN: flat_load_dword [[RET:v[0-9]+]], v[{{[0-9]+}}:{{[0-9]+}}]{{$}}
11; GCN-NOT: s_waitcnt vmcnt(0){{$}}
Tony Tyea5a7c332018-06-07 22:28:32 +000012; GFX89-NOT: buffer_wbinvl1_vol
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +000013; GCN: flat_store_dword v{{\[[0-9]+:[0-9]+\]}}, [[RET]]
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +000014define amdgpu_kernel void @system_unordered(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +000015 i32* %in, i32* %out) {
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +000016entry:
Yaxun Liu2a22c5d2018-02-02 16:07:16 +000017 %val = load atomic i32, i32* %in unordered, align 4
18 store i32 %val, i32* %out
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +000019 ret void
20}
21
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +000022; GCN-LABEL: {{^}}system_monotonic:
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +000023; GCN-NOT: s_waitcnt vmcnt(0){{$}}
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +000024; GFX89: flat_load_dword [[RET:v[0-9]+]], v[{{[0-9]+}}:{{[0-9]+}}] glc{{$}}
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +000025; GCN-NOT: s_waitcnt vmcnt(0){{$}}
Tony Tyea5a7c332018-06-07 22:28:32 +000026; GFX89-NOT: buffer_wbinvl1_vol
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +000027; GCN: flat_store_dword v{{\[[0-9]+:[0-9]+\]}}, [[RET]]
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +000028define amdgpu_kernel void @system_monotonic(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +000029 i32* %in, i32* %out) {
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +000030entry:
Yaxun Liu2a22c5d2018-02-02 16:07:16 +000031 %val = load atomic i32, i32* %in monotonic, align 4
32 store i32 %val, i32* %out
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +000033 ret void
34}
35
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +000036; GCN-LABEL: {{^}}system_acquire:
37; GCN-NOT: s_waitcnt vmcnt(0){{$}}
38; GCN: flat_load_dword [[RET:v[0-9]+]], v[{{[0-9]+}}:{{[0-9]+}}] glc{{$}}
39; GCN-NEXT: s_waitcnt vmcnt(0){{$}}
40; GFX89-NEXT: buffer_wbinvl1_vol
41; GCN: flat_store_dword v{{\[[0-9]+:[0-9]+\]}}, [[RET]]
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +000042define amdgpu_kernel void @system_acquire(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +000043 i32* %in, i32* %out) {
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +000044entry:
Yaxun Liu2a22c5d2018-02-02 16:07:16 +000045 %val = load atomic i32, i32* %in acquire, align 4
46 store i32 %val, i32* %out
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +000047 ret void
48}
49
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +000050; GCN-LABEL: {{^}}system_seq_cst:
51; GCN: s_waitcnt vmcnt(0){{$}}
52; GCN-NEXT: flat_load_dword [[RET:v[0-9]+]], v[{{[0-9]+}}:{{[0-9]+}}] glc{{$}}
53; GCN-NEXT: s_waitcnt vmcnt(0){{$}}
54; GFX89-NEXT: buffer_wbinvl1_vol
55; GCN: flat_store_dword v{{\[[0-9]+:[0-9]+\]}}, [[RET]]
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +000056define amdgpu_kernel void @system_seq_cst(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +000057 i32* %in, i32* %out) {
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +000058entry:
Yaxun Liu2a22c5d2018-02-02 16:07:16 +000059 %val = load atomic i32, i32* %in seq_cst, align 4
60 store i32 %val, i32* %out
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +000061 ret void
62}
63
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +000064; GCN-LABEL: {{^}}singlethread_unordered:
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +000065; GCN-NOT: s_waitcnt vmcnt(0){{$}}
66; GCN: flat_load_dword [[RET:v[0-9]+]], v[{{[0-9]+}}:{{[0-9]+}}]{{$}}
67; GCN-NOT: s_waitcnt vmcnt(0){{$}}
Tony Tyea5a7c332018-06-07 22:28:32 +000068; GFX89-NOT: buffer_wbinvl1_vol
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +000069; GCN: flat_store_dword v{{\[[0-9]+:[0-9]+\]}}, [[RET]]
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +000070define amdgpu_kernel void @singlethread_unordered(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +000071 i32* %in, i32* %out) {
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +000072entry:
Yaxun Liu2a22c5d2018-02-02 16:07:16 +000073 %val = load atomic i32, i32* %in syncscope("singlethread") unordered, align 4
74 store i32 %val, i32* %out
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +000075 ret void
76}
77
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +000078; GCN-LABEL: {{^}}singlethread_monotonic:
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +000079; GCN-NOT: s_waitcnt vmcnt(0){{$}}
80; GCN: flat_load_dword [[RET:v[0-9]+]], v[{{[0-9]+}}:{{[0-9]+}}]{{$}}
81; GCN-NOT: s_waitcnt vmcnt(0){{$}}
Tony Tyea5a7c332018-06-07 22:28:32 +000082; GFX89-NOT: buffer_wbinvl1_vol
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +000083; GCN: flat_store_dword v{{\[[0-9]+:[0-9]+\]}}, [[RET]]
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +000084define amdgpu_kernel void @singlethread_monotonic(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +000085 i32* %in, i32* %out) {
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +000086entry:
Yaxun Liu2a22c5d2018-02-02 16:07:16 +000087 %val = load atomic i32, i32* %in syncscope("singlethread") monotonic, align 4
88 store i32 %val, i32* %out
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +000089 ret void
90}
91
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +000092; GCN-LABEL: {{^}}singlethread_acquire:
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +000093; GCN-NOT: s_waitcnt vmcnt(0){{$}}
94; GCN: flat_load_dword [[RET:v[0-9]+]], v[{{[0-9]+}}:{{[0-9]+}}]{{$}}
95; GCN-NOT: s_waitcnt vmcnt(0){{$}}
Tony Tyea5a7c332018-06-07 22:28:32 +000096; GFX89-NOT: buffer_wbinvl1_vol
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +000097; GCN: flat_store_dword v{{\[[0-9]+:[0-9]+\]}}, [[RET]]
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +000098define amdgpu_kernel void @singlethread_acquire(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +000099 i32* %in, i32* %out) {
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000100entry:
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000101 %val = load atomic i32, i32* %in syncscope("singlethread") acquire, align 4
102 store i32 %val, i32* %out
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000103 ret void
104}
105
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +0000106; GCN-LABEL: {{^}}singlethread_seq_cst:
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000107; GCN-NOT: s_waitcnt vmcnt(0){{$}}
108; GCN: flat_load_dword [[RET:v[0-9]+]], v[{{[0-9]+}}:{{[0-9]+}}]{{$}}
109; GCN-NOT: s_waitcnt vmcnt(0){{$}}
Tony Tyea5a7c332018-06-07 22:28:32 +0000110; GFX89-NOT: buffer_wbinvl1_vol
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000111; GCN: flat_store_dword v{{\[[0-9]+:[0-9]+\]}}, [[RET]]
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000112define amdgpu_kernel void @singlethread_seq_cst(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000113 i32* %in, i32* %out) {
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000114entry:
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000115 %val = load atomic i32, i32* %in syncscope("singlethread") seq_cst, align 4
116 store i32 %val, i32* %out
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000117 ret void
118}
119
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +0000120; GCN-LABEL: {{^}}agent_unordered:
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000121; GCN-NOT: s_waitcnt vmcnt(0){{$}}
122; GCN: flat_load_dword [[RET:v[0-9]+]], v[{{[0-9]+}}:{{[0-9]+}}]{{$}}
123; GCN-NOT: s_waitcnt vmcnt(0){{$}}
Tony Tyea5a7c332018-06-07 22:28:32 +0000124; GFX89-NOT: buffer_wbinvl1_vol
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000125; GCN: flat_store_dword v{{\[[0-9]+:[0-9]+\]}}, [[RET]]
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000126define amdgpu_kernel void @agent_unordered(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000127 i32* %in, i32* %out) {
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000128entry:
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000129 %val = load atomic i32, i32* %in syncscope("agent") unordered, align 4
130 store i32 %val, i32* %out
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000131 ret void
132}
133
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +0000134; GCN-LABEL: {{^}}agent_monotonic:
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000135; GCN-NOT: s_waitcnt vmcnt(0){{$}}
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +0000136; GFX89: flat_load_dword [[RET:v[0-9]+]], v[{{[0-9]+}}:{{[0-9]+}}] glc{{$}}
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000137; GCN-NOT: s_waitcnt vmcnt(0){{$}}
Tony Tyea5a7c332018-06-07 22:28:32 +0000138; GFX89-NOT: buffer_wbinvl1_vol
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000139; GCN: flat_store_dword v{{\[[0-9]+:[0-9]+\]}}, [[RET]]
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000140define amdgpu_kernel void @agent_monotonic(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000141 i32* %in, i32* %out) {
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000142entry:
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000143 %val = load atomic i32, i32* %in syncscope("agent") monotonic, align 4
144 store i32 %val, i32* %out
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000145 ret void
146}
147
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +0000148; GCN-LABEL: {{^}}agent_acquire:
149; GCN-NOT: s_waitcnt vmcnt(0){{$}}
150; GCN: flat_load_dword [[RET:v[0-9]+]], v[{{[0-9]+}}:{{[0-9]+}}] glc{{$}}
151; GCN-NEXT: s_waitcnt vmcnt(0){{$}}
152; GFX89-NEXT: buffer_wbinvl1_vol
153; GCN: flat_store_dword v{{\[[0-9]+:[0-9]+\]}}, [[RET]]
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000154define amdgpu_kernel void @agent_acquire(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000155 i32* %in, i32* %out) {
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000156entry:
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000157 %val = load atomic i32, i32* %in syncscope("agent") acquire, align 4
158 store i32 %val, i32* %out
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000159 ret void
160}
161
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +0000162; GCN-LABEL: {{^}}agent_seq_cst:
163; GCN: s_waitcnt vmcnt(0){{$}}
164; GCN-NEXT: flat_load_dword [[RET:v[0-9]+]], v[{{[0-9]+}}:{{[0-9]+}}] glc{{$}}
165; GCN-NEXT: s_waitcnt vmcnt(0){{$}}
166; GFX89-NEXT: buffer_wbinvl1_vol
167; GCN: flat_store_dword v{{\[[0-9]+:[0-9]+\]}}, [[RET]]
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000168define amdgpu_kernel void @agent_seq_cst(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000169 i32* %in, i32* %out) {
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000170entry:
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000171 %val = load atomic i32, i32* %in syncscope("agent") seq_cst, align 4
172 store i32 %val, i32* %out
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000173 ret void
174}
175
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +0000176; GCN-LABEL: {{^}}workgroup_unordered:
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000177; GCN-NOT: s_waitcnt vmcnt(0){{$}}
Tony Tyea5a7c332018-06-07 22:28:32 +0000178; GCN: flat_load_dword [[RET:v[0-9]+]], v[{{[0-9]+}}:{{[0-9]+}}]{{$}}
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000179; GCN-NOT: s_waitcnt vmcnt(0){{$}}
Tony Tyea5a7c332018-06-07 22:28:32 +0000180; GFX89-NOT: buffer_wbinvl1_vol
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000181; GCN: flat_store_dword v{{\[[0-9]+:[0-9]+\]}}, [[RET]]
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000182define amdgpu_kernel void @workgroup_unordered(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000183 i32* %in, i32* %out) {
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000184entry:
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000185 %val = load atomic i32, i32* %in syncscope("workgroup") unordered, align 4
186 store i32 %val, i32* %out
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000187 ret void
188}
189
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +0000190; GCN-LABEL: {{^}}workgroup_monotonic:
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000191; GCN-NOT: s_waitcnt vmcnt(0){{$}}
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +0000192; GFX89: flat_load_dword [[RET:v[0-9]+]], v[{{[0-9]+}}:{{[0-9]+}}]{{$}}
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000193; GCN-NOT: s_waitcnt vmcnt(0){{$}}
Tony Tyea5a7c332018-06-07 22:28:32 +0000194; GFX89-NOT: buffer_wbinvl1_vol
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000195; GCN: flat_store_dword v{{\[[0-9]+:[0-9]+\]}}, [[RET]]
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000196define amdgpu_kernel void @workgroup_monotonic(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000197 i32* %in, i32* %out) {
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000198entry:
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000199 %val = load atomic i32, i32* %in syncscope("workgroup") monotonic, align 4
200 store i32 %val, i32* %out
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000201 ret void
202}
203
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +0000204; GCN-LABEL: {{^}}workgroup_acquire:
205; GCN-NOT: s_waitcnt vmcnt(0){{$}}
206; GFX89: flat_load_dword [[RET:v[0-9]+]], v[{{[0-9]+}}:{{[0-9]+}}]{{$}}
207; GFX89-NOT: s_waitcnt vmcnt(0){{$}}
208; GFX89-NOT: buffer_wbinvl1_vol
209; GCN: flat_store_dword v{{\[[0-9]+:[0-9]+\]}}, [[RET]]
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000210define amdgpu_kernel void @workgroup_acquire(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000211 i32* %in, i32* %out) {
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000212entry:
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000213 %val = load atomic i32, i32* %in syncscope("workgroup") acquire, align 4
214 store i32 %val, i32* %out
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000215 ret void
216}
217
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +0000218; GCN-LABEL: {{^}}workgroup_seq_cst:
219; GFX89-NOT: s_waitcnt vmcnt(0){{$}}
220; GFX89: flat_load_dword [[RET:v[0-9]+]], v[{{[0-9]+}}:{{[0-9]+}}]{{$}}
221; GFX89-NOT: s_waitcnt vmcnt(0){{$}}
222; GFX89-NOT: buffer_wbinvl1_vol
223; GCN: flat_store_dword v{{\[[0-9]+:[0-9]+\]}}, [[RET]]
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000224define amdgpu_kernel void @workgroup_seq_cst(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000225 i32* %in, i32* %out) {
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000226entry:
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000227 %val = load atomic i32, i32* %in syncscope("workgroup") seq_cst, align 4
228 store i32 %val, i32* %out
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000229 ret void
230}
231
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +0000232; GCN-LABEL: {{^}}wavefront_unordered:
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000233; GCN-NOT: s_waitcnt vmcnt(0){{$}}
234; GCN: flat_load_dword [[RET:v[0-9]+]], v[{{[0-9]+}}:{{[0-9]+}}]{{$}}
235; GCN-NOT: s_waitcnt vmcnt(0){{$}}
Tony Tyea5a7c332018-06-07 22:28:32 +0000236; GFX89-NOT: buffer_wbinvl1_vol
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000237; GCN: flat_store_dword v{{\[[0-9]+:[0-9]+\]}}, [[RET]]
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000238define amdgpu_kernel void @wavefront_unordered(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000239 i32* %in, i32* %out) {
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000240entry:
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000241 %val = load atomic i32, i32* %in syncscope("wavefront") unordered, align 4
242 store i32 %val, i32* %out
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000243 ret void
244}
245
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +0000246; GCN-LABEL: {{^}}wavefront_monotonic:
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000247; GCN-NOT: s_waitcnt vmcnt(0){{$}}
248; GCN: flat_load_dword [[RET:v[0-9]+]], v[{{[0-9]+}}:{{[0-9]+}}]{{$}}
249; GCN-NOT: s_waitcnt vmcnt(0){{$}}
Tony Tyea5a7c332018-06-07 22:28:32 +0000250; GFX89-NOT: buffer_wbinvl1_vol
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000251; GCN: flat_store_dword v{{\[[0-9]+:[0-9]+\]}}, [[RET]]
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000252define amdgpu_kernel void @wavefront_monotonic(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000253 i32* %in, i32* %out) {
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000254entry:
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000255 %val = load atomic i32, i32* %in syncscope("wavefront") monotonic, align 4
256 store i32 %val, i32* %out
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000257 ret void
258}
259
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +0000260; GCN-LABEL: {{^}}wavefront_acquire:
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000261; GCN-NOT: s_waitcnt vmcnt(0){{$}}
262; GCN: flat_load_dword [[RET:v[0-9]+]], v[{{[0-9]+}}:{{[0-9]+}}]{{$}}
263; GCN-NOT: s_waitcnt vmcnt(0){{$}}
Tony Tyea5a7c332018-06-07 22:28:32 +0000264; GFX89-NOT: buffer_wbinvl1_vol
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000265; GCN: flat_store_dword v{{\[[0-9]+:[0-9]+\]}}, [[RET]]
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000266define amdgpu_kernel void @wavefront_acquire(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000267 i32* %in, i32* %out) {
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000268entry:
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000269 %val = load atomic i32, i32* %in syncscope("wavefront") acquire, align 4
270 store i32 %val, i32* %out
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000271 ret void
272}
273
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +0000274; GCN-LABEL: {{^}}wavefront_seq_cst:
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000275; GCN-NOT: s_waitcnt vmcnt(0){{$}}
276; GCN: flat_load_dword [[RET:v[0-9]+]], v[{{[0-9]+}}:{{[0-9]+}}]{{$}}
277; GCN-NOT: s_waitcnt vmcnt(0){{$}}
Tony Tyea5a7c332018-06-07 22:28:32 +0000278; GFX89-NOT: buffer_wbinvl1_vol
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000279; GCN: flat_store_dword v{{\[[0-9]+:[0-9]+\]}}, [[RET]]
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000280define amdgpu_kernel void @wavefront_seq_cst(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000281 i32* %in, i32* %out) {
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000282entry:
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000283 %val = load atomic i32, i32* %in syncscope("wavefront") seq_cst, align 4
284 store i32 %val, i32* %out
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000285 ret void
286}
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000287
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +0000288; GCN-LABEL: {{^}}nontemporal_private_0:
289; GFX89: buffer_load_dword v{{[0-9]+}}, v{{[0-9]+}}, s[{{[0-9]+}}:{{[0-9]+}}], s{{[0-9]+}} offen glc slc{{$}}
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000290define amdgpu_kernel void @nontemporal_private_0(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000291 i32 addrspace(5)* %in, i32* %out) {
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000292entry:
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000293 %val = load i32, i32 addrspace(5)* %in, align 4, !nontemporal !0
294 store i32 %val, i32* %out
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000295 ret void
296}
297
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +0000298; GCN-LABEL: {{^}}nontemporal_private_1:
299; GFX89: buffer_load_dword v{{[0-9]+}}, v{{[0-9]+}}, s[{{[0-9]+}}:{{[0-9]+}}], s{{[0-9]+}} offen glc slc{{$}}
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000300define amdgpu_kernel void @nontemporal_private_1(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000301 i32 addrspace(5)* %in, i32* %out) {
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000302entry:
303 %tid = call i32 @llvm.amdgcn.workitem.id.x()
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000304 %val.gep = getelementptr inbounds i32, i32 addrspace(5)* %in, i32 %tid
305 %val = load i32, i32 addrspace(5)* %val.gep, align 4, !nontemporal !0
306 store i32 %val, i32* %out
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000307 ret void
308}
309
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +0000310; GCN-LABEL: {{^}}nontemporal_global_0:
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000311; GCN: s_load_dword s{{[0-9]+}}, s[{{[0-9]+}}:{{[0-9]+}}], 0x0{{$}}
312define amdgpu_kernel void @nontemporal_global_0(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000313 i32 addrspace(1)* %in, i32* %out) {
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000314entry:
315 %val = load i32, i32 addrspace(1)* %in, align 4, !nontemporal !0
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000316 store i32 %val, i32* %out
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000317 ret void
318}
319
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +0000320; GCN-LABEL: {{^}}nontemporal_global_1:
321; GFX8: flat_load_dword v{{[0-9]+}}, v[{{[0-9]+}}:{{[0-9]+}}] glc slc{{$}}
Ron Liebermancac749a2018-11-16 01:13:34 +0000322; GFX9: global_load_dword v{{[0-9]+}}, v[{{[0-9]+}}:{{[0-9]+}}], s[{{[0-9]+}}:{{[0-9]+}}] glc slc{{$}}
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000323define amdgpu_kernel void @nontemporal_global_1(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000324 i32 addrspace(1)* %in, i32* %out) {
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000325entry:
326 %tid = call i32 @llvm.amdgcn.workitem.id.x()
327 %val.gep = getelementptr inbounds i32, i32 addrspace(1)* %in, i32 %tid
328 %val = load i32, i32 addrspace(1)* %val.gep, align 4, !nontemporal !0
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000329 store i32 %val, i32* %out
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000330 ret void
331}
332
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +0000333; GCN-LABEL: {{^}}nontemporal_local_0:
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000334; GCN: ds_read_b32 v{{[0-9]+}}, v{{[0-9]+}}{{$}}
335define amdgpu_kernel void @nontemporal_local_0(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000336 i32 addrspace(3)* %in, i32* %out) {
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000337entry:
338 %val = load i32, i32 addrspace(3)* %in, align 4, !nontemporal !0
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000339 store i32 %val, i32* %out
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000340 ret void
341}
342
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +0000343; GCN-LABEL: {{^}}nontemporal_local_1:
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000344; GCN: ds_read_b32 v{{[0-9]+}}, v{{[0-9]+}}{{$}}
345define amdgpu_kernel void @nontemporal_local_1(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000346 i32 addrspace(3)* %in, i32* %out) {
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000347entry:
348 %tid = call i32 @llvm.amdgcn.workitem.id.x()
349 %val.gep = getelementptr inbounds i32, i32 addrspace(3)* %in, i32 %tid
350 %val = load i32, i32 addrspace(3)* %val.gep, align 4, !nontemporal !0
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000351 store i32 %val, i32* %out
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000352 ret void
353}
354
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +0000355; GCN-LABEL: {{^}}nontemporal_flat_0:
356; GFX89: flat_load_dword v{{[0-9]+}}, v[{{[0-9]+}}:{{[0-9]+}}] glc slc{{$}}
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000357define amdgpu_kernel void @nontemporal_flat_0(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000358 i32* %in, i32* %out) {
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000359entry:
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000360 %val = load i32, i32* %in, align 4, !nontemporal !0
361 store i32 %val, i32* %out
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000362 ret void
363}
364
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +0000365; GCN-LABEL: {{^}}nontemporal_flat_1:
366; GFX89: flat_load_dword v{{[0-9]+}}, v[{{[0-9]+}}:{{[0-9]+}}] glc slc{{$}}
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000367define amdgpu_kernel void @nontemporal_flat_1(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000368 i32* %in, i32* %out) {
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000369entry:
370 %tid = call i32 @llvm.amdgcn.workitem.id.x()
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000371 %val.gep = getelementptr inbounds i32, i32* %in, i32 %tid
372 %val = load i32, i32* %val.gep, align 4, !nontemporal !0
373 store i32 %val, i32* %out
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000374 ret void
375}
376
377!0 = !{i32 1}