1 ; RUN: llc -march=amdgcn -mcpu=SI < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s 2 ; RUN: llc -march=r600 -mcpu=redwood < %s | FileCheck -check-prefix=EG -check-prefix=FUNC %s 3 4 ; FUNC-LABEL: {{^}}test_barrier_global: 5 ; EG: GROUP_BARRIER 6 ; SI: buffer_store_dword 7 ; SI: s_waitcnt 8 ; SI: s_barrier 9 10 define void @test_barrier_global(i32 addrspace(1)* %out) { 11 entry: 12 %0 = call i32 @llvm.r600.read.tidig.x() 13 %1 = getelementptr i32, i32 addrspace(1)* %out, i32 %0 14 store i32 %0, i32 addrspace(1)* %1 15 call void @llvm.AMDGPU.barrier.global() 16 %2 = call i32 @llvm.r600.read.local.size.x() 17 %3 = sub i32 %2, 1 18 %4 = sub i32 %3, %0 19 %5 = getelementptr i32, i32 addrspace(1)* %out, i32 %4 20 %6 = load i32, i32 addrspace(1)* %5 21 store i32 %6, i32 addrspace(1)* %1 22 ret void 23 } 24 25 declare void @llvm.AMDGPU.barrier.global() 26 27 declare i32 @llvm.r600.read.tidig.x() #0 28 declare i32 @llvm.r600.read.local.size.x() #0 29 30 attributes #0 = { readnone } 31