1; RUN: llc -march=r600 -mcpu=redwood < %s | FileCheck -check-prefix=EG  %s
2
3; EG-LABEL: {{^}}test_group_barrier:
4; EG: GROUP_BARRIER
5define amdgpu_kernel void @test_group_barrier(i32 addrspace(1)* %out) #0 {
6entry:
7  %tmp = call i32 @llvm.r600.read.tidig.x()
8  %tmp1 = getelementptr i32, i32 addrspace(1)* %out, i32 %tmp
9  store i32 %tmp, i32 addrspace(1)* %tmp1
10  call void @llvm.r600.group.barrier()
11  %tmp2 = call i32 @llvm.r600.read.local.size.x()
12  %tmp3 = sub i32 %tmp2, 1
13  %tmp4 = sub i32 %tmp3, %tmp
14  %tmp5 = getelementptr i32, i32 addrspace(1)* %out, i32 %tmp4
15  %tmp6 = load i32, i32 addrspace(1)* %tmp5
16  store i32 %tmp6, i32 addrspace(1)* %tmp1
17  ret void
18}
19
20; Function Attrs: convergent nounwind
21declare void @llvm.r600.group.barrier() #1
22
23; Function Attrs: nounwind readnone
24declare i32 @llvm.r600.read.tidig.x() #2
25
26; Function Attrs: nounwind readnone
27declare i32 @llvm.r600.read.local.size.x() #2
28
29attributes #0 = { nounwind }
30attributes #1 = { convergent nounwind }
31attributes #2 = { nounwind readnone }
32