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_local: 5 ; EG: GROUP_BARRIER 6 7 ; SI: buffer_store_dword 8 ; SI: s_waitcnt 9 ; SI: s_barrier 10 11 define void @test_barrier_local(i32 addrspace(1)* %out) { 12 entry: 13 %0 = call i32 @llvm.r600.read.tidig.x() 14 %1 = getelementptr i32, i32 addrspace(1)* %out, i32 %0 15 store i32 %0, i32 addrspace(1)* %1 16 call void @llvm.AMDGPU.barrier.local() 17 %2 = call i32 @llvm.r600.read.local.size.x() 18 %3 = sub i32 %2, 1 19 %4 = sub i32 %3, %0 20 %5 = getelementptr i32, i32 addrspace(1)* %out, i32 %4 21 %6 = load i32, i32 addrspace(1)* %5 22 store i32 %6, i32 addrspace(1)* %1 23 ret void 24 } 25 26 declare void @llvm.AMDGPU.barrier.local() 27 28 declare i32 @llvm.r600.read.tidig.x() #0 29 declare i32 @llvm.r600.read.local.size.x() #0 30 31 attributes #0 = { readnone } 32