blob: 87c43949df6a7559e281980dec3167906e83544c [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_store_dword v[{{[0-9]+}}:{{[0-9]+}}], {{v[0-9]+}}{{$}}
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +000011define amdgpu_kernel void @system_unordered(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +000012 i32 %in, i32* %out) {
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +000013entry:
Yaxun Liu2a22c5d2018-02-02 16:07:16 +000014 store atomic i32 %in, i32* %out unordered, align 4
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +000015 ret void
16}
17
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +000018; GCN-LABEL: {{^}}system_monotonic:
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +000019; GCN-NOT: s_waitcnt vmcnt(0){{$}}
20; GCN: flat_store_dword v[{{[0-9]+}}:{{[0-9]+}}], {{v[0-9]+}}{{$}}
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +000021define amdgpu_kernel void @system_monotonic(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +000022 i32 %in, i32* %out) {
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +000023entry:
Yaxun Liu2a22c5d2018-02-02 16:07:16 +000024 store atomic i32 %in, i32* %out monotonic, align 4
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +000025 ret void
26}
27
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +000028; GCN-LABEL: {{^}}system_release:
29; GCN: s_waitcnt vmcnt(0){{$}}
30; GCN-NEXT: flat_store_dword v[{{[0-9]+}}:{{[0-9]+}}], {{v[0-9]+}}{{$}}
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +000031define amdgpu_kernel void @system_release(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +000032 i32 %in, i32* %out) {
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +000033entry:
Yaxun Liu2a22c5d2018-02-02 16:07:16 +000034 store atomic i32 %in, i32* %out release, align 4
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +000035 ret void
36}
37
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +000038; GCN-LABEL: {{^}}system_seq_cst:
39; GCN: s_waitcnt vmcnt(0){{$}}
40; GCN-NEXT: flat_store_dword v[{{[0-9]+}}:{{[0-9]+}}], {{v[0-9]+}}{{$}}
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +000041define amdgpu_kernel void @system_seq_cst(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +000042 i32 %in, i32* %out) {
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +000043entry:
Yaxun Liu2a22c5d2018-02-02 16:07:16 +000044 store atomic i32 %in, i32* %out seq_cst, align 4
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +000045 ret void
46}
47
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +000048; GCN-LABEL: {{^}}singlethread_unordered:
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +000049; GCN-NOT: s_waitcnt vmcnt(0){{$}}
50; GCN: flat_store_dword v[{{[0-9]+}}:{{[0-9]+}}], {{v[0-9]+}}{{$}}
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +000051define amdgpu_kernel void @singlethread_unordered(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +000052 i32 %in, i32* %out) {
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +000053entry:
Yaxun Liu2a22c5d2018-02-02 16:07:16 +000054 store atomic i32 %in, i32* %out syncscope("singlethread") unordered, align 4
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +000055 ret void
56}
57
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +000058; GCN-LABEL: {{^}}singlethread_monotonic:
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +000059; GCN-NOT: s_waitcnt vmcnt(0){{$}}
60; GCN: flat_store_dword v[{{[0-9]+}}:{{[0-9]+}}], {{v[0-9]+}}{{$}}
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +000061define amdgpu_kernel void @singlethread_monotonic(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +000062 i32 %in, i32* %out) {
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +000063entry:
Yaxun Liu2a22c5d2018-02-02 16:07:16 +000064 store atomic i32 %in, i32* %out syncscope("singlethread") monotonic, align 4
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +000065 ret void
66}
67
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +000068; GCN-LABEL: {{^}}singlethread_release:
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +000069; GCN-NOT: s_waitcnt vmcnt(0){{$}}
70; GCN: flat_store_dword v[{{[0-9]+}}:{{[0-9]+}}], {{v[0-9]+}}{{$}}
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +000071define amdgpu_kernel void @singlethread_release(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +000072 i32 %in, i32* %out) {
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +000073entry:
Yaxun Liu2a22c5d2018-02-02 16:07:16 +000074 store atomic i32 %in, i32* %out syncscope("singlethread") release, align 4
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +000075 ret void
76}
77
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +000078; GCN-LABEL: {{^}}singlethread_seq_cst:
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +000079; GCN-NOT: s_waitcnt vmcnt(0){{$}}
80; GCN: flat_store_dword v[{{[0-9]+}}:{{[0-9]+}}], {{v[0-9]+}}{{$}}
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +000081define amdgpu_kernel void @singlethread_seq_cst(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +000082 i32 %in, i32* %out) {
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +000083entry:
Yaxun Liu2a22c5d2018-02-02 16:07:16 +000084 store atomic i32 %in, i32* %out syncscope("singlethread") seq_cst, align 4
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +000085 ret void
86}
87
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +000088; GCN-LABEL: {{^}}agent_unordered:
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +000089; GCN-NOT: s_waitcnt vmcnt(0){{$}}
90; GCN: flat_store_dword v[{{[0-9]+}}:{{[0-9]+}}], {{v[0-9]+}}{{$}}
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +000091define amdgpu_kernel void @agent_unordered(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +000092 i32 %in, i32* %out) {
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +000093entry:
Yaxun Liu2a22c5d2018-02-02 16:07:16 +000094 store atomic i32 %in, i32* %out syncscope("agent") unordered, align 4
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +000095 ret void
96}
97
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +000098; GCN-LABEL: {{^}}agent_monotonic:
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +000099; GCN-NOT: s_waitcnt vmcnt(0){{$}}
100; GCN: flat_store_dword v[{{[0-9]+}}:{{[0-9]+}}], {{v[0-9]+}}{{$}}
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000101define amdgpu_kernel void @agent_monotonic(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000102 i32 %in, i32* %out) {
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000103entry:
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000104 store atomic i32 %in, i32* %out syncscope("agent") monotonic, align 4
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000105 ret void
106}
107
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +0000108; GCN-LABEL: {{^}}agent_release:
109; GCN: s_waitcnt vmcnt(0){{$}}
110; GCN-NEXT: flat_store_dword v[{{[0-9]+}}:{{[0-9]+}}], {{v[0-9]+}}{{$}}
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000111define amdgpu_kernel void @agent_release(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000112 i32 %in, i32* %out) {
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000113entry:
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000114 store atomic i32 %in, i32* %out syncscope("agent") release, align 4
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000115 ret void
116}
117
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +0000118; GCN-LABEL: {{^}}agent_seq_cst:
119; GCN: s_waitcnt vmcnt(0){{$}}
120; GCN-NEXT: flat_store_dword v[{{[0-9]+}}:{{[0-9]+}}], {{v[0-9]+}}{{$}}
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000121define amdgpu_kernel void @agent_seq_cst(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000122 i32 %in, i32* %out) {
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000123entry:
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000124 store atomic i32 %in, i32* %out syncscope("agent") seq_cst, align 4
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000125 ret void
126}
127
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +0000128; GCN-LABEL: {{^}}workgroup_unordered:
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000129; GCN-NOT: s_waitcnt vmcnt(0){{$}}
130; GCN: flat_store_dword v[{{[0-9]+}}:{{[0-9]+}}], {{v[0-9]+}}{{$}}
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000131define amdgpu_kernel void @workgroup_unordered(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000132 i32 %in, i32* %out) {
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000133entry:
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000134 store atomic i32 %in, i32* %out syncscope("workgroup") unordered, align 4
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000135 ret void
136}
137
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +0000138; GCN-LABEL: {{^}}workgroup_monotonic:
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000139; GCN-NOT: s_waitcnt vmcnt(0){{$}}
140; GCN: flat_store_dword v[{{[0-9]+}}:{{[0-9]+}}], {{v[0-9]+}}{{$}}
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000141define amdgpu_kernel void @workgroup_monotonic(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000142 i32 %in, i32* %out) {
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000143entry:
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000144 store atomic i32 %in, i32* %out syncscope("workgroup") monotonic, align 4
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000145 ret void
146}
147
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +0000148; GCN-LABEL: {{^}}workgroup_release:
149; GFX89-NOT: s_waitcnt vmcnt(0){{$}}
150; GCN: flat_store_dword v[{{[0-9]+}}:{{[0-9]+}}], {{v[0-9]+}}{{$}}
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000151define amdgpu_kernel void @workgroup_release(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000152 i32 %in, i32* %out) {
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000153entry:
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000154 store atomic i32 %in, i32* %out syncscope("workgroup") release, align 4
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000155 ret void
156}
157
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +0000158; GCN-LABEL: {{^}}workgroup_seq_cst:
159; GFX89-NOT: s_waitcnt vmcnt(0){{$}}
160; GCN: flat_store_dword v[{{[0-9]+}}:{{[0-9]+}}], {{v[0-9]+}}{{$}}
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000161define amdgpu_kernel void @workgroup_seq_cst(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000162 i32 %in, i32* %out) {
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000163entry:
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000164 store atomic i32 %in, i32* %out syncscope("workgroup") seq_cst, align 4
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000165 ret void
166}
167
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +0000168; GCN-LABEL: {{^}}wavefront_unordered:
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000169; GCN-NOT: s_waitcnt vmcnt(0){{$}}
170; GCN: flat_store_dword v[{{[0-9]+}}:{{[0-9]+}}], {{v[0-9]+}}{{$}}
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000171define amdgpu_kernel void @wavefront_unordered(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000172 i32 %in, i32* %out) {
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000173entry:
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000174 store atomic i32 %in, i32* %out syncscope("wavefront") unordered, align 4
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000175 ret void
176}
177
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +0000178; GCN-LABEL: {{^}}wavefront_monotonic:
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000179; GCN-NOT: s_waitcnt vmcnt(0){{$}}
180; GCN: flat_store_dword v[{{[0-9]+}}:{{[0-9]+}}], {{v[0-9]+}}{{$}}
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000181define amdgpu_kernel void @wavefront_monotonic(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000182 i32 %in, i32* %out) {
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000183entry:
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000184 store atomic i32 %in, i32* %out syncscope("wavefront") monotonic, align 4
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000185 ret void
186}
187
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +0000188; GCN-LABEL: {{^}}wavefront_release:
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000189; GCN-NOT: s_waitcnt vmcnt(0){{$}}
190; GCN: flat_store_dword v[{{[0-9]+}}:{{[0-9]+}}], {{v[0-9]+}}{{$}}
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000191define amdgpu_kernel void @wavefront_release(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000192 i32 %in, i32* %out) {
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000193entry:
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000194 store atomic i32 %in, i32* %out syncscope("wavefront") release, align 4
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000195 ret void
196}
197
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +0000198; GCN-LABEL: {{^}}wavefront_seq_cst:
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000199; GCN-NOT: s_waitcnt vmcnt(0){{$}}
200; GCN: flat_store_dword v[{{[0-9]+}}:{{[0-9]+}}], {{v[0-9]+}}{{$}}
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000201define amdgpu_kernel void @wavefront_seq_cst(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000202 i32 %in, i32* %out) {
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000203entry:
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000204 store atomic i32 %in, i32* %out syncscope("wavefront") seq_cst, align 4
Konstantin Zhuravlyove9a5a772017-07-21 21:19:23 +0000205 ret void
206}
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000207
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +0000208; GCN-LABEL: {{^}}nontemporal_private_0:
209; GFX89: buffer_store_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 +0000210define amdgpu_kernel void @nontemporal_private_0(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000211 i32* %in, i32 addrspace(5)* %out) {
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000212entry:
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000213 %val = load i32, i32* %in, align 4
214 store i32 %val, i32 addrspace(5)* %out, !nontemporal !0
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000215 ret void
216}
217
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +0000218; GCN-LABEL: {{^}}nontemporal_private_1:
219; GFX89: buffer_store_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 +0000220define amdgpu_kernel void @nontemporal_private_1(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000221 i32* %in, i32 addrspace(5)* %out) {
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000222entry:
223 %tid = call i32 @llvm.amdgcn.workitem.id.x()
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000224 %val = load i32, i32* %in, align 4
225 %out.gep = getelementptr inbounds i32, i32 addrspace(5)* %out, i32 %tid
226 store i32 %val, i32 addrspace(5)* %out.gep, !nontemporal !0
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000227 ret void
228}
229
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +0000230; GCN-LABEL: {{^}}nontemporal_global_0:
231; GFX8: flat_store_dword v[{{[0-9]+}}:{{[0-9]+}}], v{{[0-9]+}} glc slc{{$}}
232; GFX9: global_store_dword v[{{[0-9]+}}:{{[0-9]+}}], v{{[0-9]+}}, off glc slc{{$}}
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000233define amdgpu_kernel void @nontemporal_global_0(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000234 i32* %in, i32 addrspace(1)* %out) {
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000235entry:
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000236 %val = load i32, i32* %in, align 4
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000237 store i32 %val, i32 addrspace(1)* %out, !nontemporal !0
238 ret void
239}
240
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +0000241; GCN-LABEL: {{^}}nontemporal_global_1:
242; GFX8: flat_store_dword v[{{[0-9]+}}:{{[0-9]+}}], v{{[0-9]+}} glc slc{{$}}
Ron Liebermancac749a2018-11-16 01:13:34 +0000243; GFX9: global_store_dword v[{{[0-9]+}}:{{[0-9]+}}], v{{[0-9]+}}, s[{{[0-9]+}}:{{[0-9]+}}] glc slc{{$}}
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000244define amdgpu_kernel void @nontemporal_global_1(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000245 i32* %in, i32 addrspace(1)* %out) {
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000246entry:
247 %tid = call i32 @llvm.amdgcn.workitem.id.x()
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000248 %val = load i32, i32* %in, align 4
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000249 %out.gep = getelementptr inbounds i32, i32 addrspace(1)* %out, i32 %tid
250 store i32 %val, i32 addrspace(1)* %out.gep, !nontemporal !0
251 ret void
252}
253
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +0000254; GCN-LABEL: {{^}}nontemporal_local_0:
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000255; GCN: ds_write_b32 v{{[0-9]+}}, v{{[0-9]+}}{{$}}
256define amdgpu_kernel void @nontemporal_local_0(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000257 i32* %in, i32 addrspace(3)* %out) {
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000258entry:
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000259 %val = load i32, i32* %in, align 4
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000260 store i32 %val, i32 addrspace(3)* %out, !nontemporal !0
261 ret void
262}
263
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +0000264; GCN-LABEL: {{^}}nontemporal_local_1:
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000265; GCN: ds_write_b32 v{{[0-9]+}}, v{{[0-9]+}}{{$}}
266define amdgpu_kernel void @nontemporal_local_1(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000267 i32* %in, i32 addrspace(3)* %out) {
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000268entry:
269 %tid = call i32 @llvm.amdgcn.workitem.id.x()
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000270 %val = load i32, i32* %in, align 4
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000271 %out.gep = getelementptr inbounds i32, i32 addrspace(3)* %out, i32 %tid
272 store i32 %val, i32 addrspace(3)* %out.gep, !nontemporal !0
273 ret void
274}
275
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +0000276; GCN-LABEL: {{^}}nontemporal_flat_0:
277; GFX89: flat_store_dword v[{{[0-9]+}}:{{[0-9]+}}], v{{[0-9]+}} glc slc{{$}}
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000278define amdgpu_kernel void @nontemporal_flat_0(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000279 i32* %in, i32* %out) {
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000280entry:
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000281 %val = load i32, i32* %in, align 4
282 store i32 %val, i32* %out, !nontemporal !0
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000283 ret void
284}
285
Stanislav Mekhanoshin127dbdb2018-02-13 20:03:32 +0000286; GCN-LABEL: {{^}}nontemporal_flat_1:
287; GFX89: flat_store_dword v[{{[0-9]+}}:{{[0-9]+}}], v{{[0-9]+}} glc slc{{$}}
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000288define amdgpu_kernel void @nontemporal_flat_1(
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000289 i32* %in, i32* %out) {
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000290entry:
291 %tid = call i32 @llvm.amdgcn.workitem.id.x()
Yaxun Liu2a22c5d2018-02-02 16:07:16 +0000292 %val = load i32, i32* %in, align 4
293 %out.gep = getelementptr inbounds i32, i32* %out, i32 %tid
294 store i32 %val, i32* %out.gep, !nontemporal !0
Konstantin Zhuravlyovcff11552017-10-25 17:04:46 +0000295 ret void
296}
297
298!0 = !{i32 1}