• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
2
3; GCN-LABEL: {{^}}test_barrier:
4; GCN: buffer_store_dword
5; GCN: s_waitcnt
6; GCN: s_barrier
7define void @test_barrier(i32 addrspace(1)* %out) #0 {
8entry:
9  %tmp = call i32 @llvm.amdgcn.workitem.id.x()
10  %tmp1 = getelementptr i32, i32 addrspace(1)* %out, i32 %tmp
11  store i32 %tmp, i32 addrspace(1)* %tmp1
12  call void @llvm.amdgcn.s.barrier()
13  %tmp2 = call i32 @llvm.r600.read.local.size.x()
14  %tmp3 = sub i32 %tmp2, 1
15  %tmp4 = sub i32 %tmp3, %tmp
16  %tmp5 = getelementptr i32, i32 addrspace(1)* %out, i32 %tmp4
17  %tmp6 = load i32, i32 addrspace(1)* %tmp5
18  store i32 %tmp6, i32 addrspace(1)* %tmp1
19  ret void
20}
21
22declare void @llvm.amdgcn.s.barrier() #1
23declare i32 @llvm.amdgcn.workitem.id.x() #2
24declare i32 @llvm.r600.read.local.size.x() #2
25
26attributes #0 = { nounwind }
27attributes #1 = { convergent nounwind }
28attributes #2 = { nounwind readnone }
29