mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-23 02:29:18 +00:00
This ensures that all memory operations are complete when all threads reach the barrier. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225290 91177308-0d34-0410-b5e6-96231b3b80d8
32 lines
925 B
LLVM
32 lines
925 B
LLVM
; RUN: llc -march=amdgcn -mcpu=SI < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s
|
|
; RUN: llc -march=r600 -mcpu=redwood < %s | FileCheck -check-prefix=EG -check-prefix=FUNC %s
|
|
|
|
; FUNC-LABEL: {{^}}test_barrier_local:
|
|
; EG: GROUP_BARRIER
|
|
|
|
; SI: buffer_store_dword
|
|
; SI: s_waitcnt
|
|
; SI: s_barrier
|
|
|
|
define void @test_barrier_local(i32 addrspace(1)* %out) {
|
|
entry:
|
|
%0 = call i32 @llvm.r600.read.tidig.x()
|
|
%1 = getelementptr i32 addrspace(1)* %out, i32 %0
|
|
store i32 %0, i32 addrspace(1)* %1
|
|
call void @llvm.AMDGPU.barrier.local()
|
|
%2 = call i32 @llvm.r600.read.local.size.x()
|
|
%3 = sub i32 %2, 1
|
|
%4 = sub i32 %3, %0
|
|
%5 = getelementptr i32 addrspace(1)* %out, i32 %4
|
|
%6 = load i32 addrspace(1)* %5
|
|
store i32 %6, i32 addrspace(1)* %1
|
|
ret void
|
|
}
|
|
|
|
declare void @llvm.AMDGPU.barrier.local()
|
|
|
|
declare i32 @llvm.r600.read.tidig.x() #0
|
|
declare i32 @llvm.r600.read.local.size.x() #0
|
|
|
|
attributes #0 = { readnone }
|