2013-07-10 16:37:07 +00:00
|
|
|
; RUN: llc < %s -march=r600 -mcpu=redwood | FileCheck --check-prefix=EG-CHECK %s
|
2013-10-10 17:11:46 +00:00
|
|
|
; RUN: llc < %s -march=r600 -mcpu=verde -verify-machineinstrs | FileCheck --check-prefix=SI-CHECK %s
|
2013-06-28 15:47:08 +00:00
|
|
|
|
|
|
|
@local_memory.local_mem = internal addrspace(3) unnamed_addr global [16 x i32] zeroinitializer, align 4
|
|
|
|
|
2013-07-10 16:37:07 +00:00
|
|
|
; EG-CHECK: @local_memory
|
|
|
|
; SI-CHECK: @local_memory
|
2013-06-28 15:47:08 +00:00
|
|
|
|
|
|
|
; Check that the LDS size emitted correctly
|
2013-07-10 16:37:07 +00:00
|
|
|
; EG-CHECK: .long 166120
|
|
|
|
; EG-CHECK-NEXT: .long 16
|
|
|
|
; SI-CHECK: .long 47180
|
|
|
|
; SI-CHECK-NEXT: .long 32768
|
2013-06-28 15:47:08 +00:00
|
|
|
|
2013-07-10 16:37:07 +00:00
|
|
|
; EG-CHECK: LDS_WRITE
|
2013-09-05 18:37:52 +00:00
|
|
|
; SI-CHECK_NOT: S_WQM_B64
|
2013-08-16 16:19:24 +00:00
|
|
|
; SI-CHECK: DS_WRITE_B32 0
|
2013-06-28 15:47:08 +00:00
|
|
|
|
|
|
|
; GROUP_BARRIER must be the last instruction in a clause
|
2013-07-10 16:37:07 +00:00
|
|
|
; EG-CHECK: GROUP_BARRIER
|
|
|
|
; EG-CHECK-NEXT: ALU clause
|
|
|
|
; SI-CHECK: S_BARRIER
|
2013-06-28 15:47:08 +00:00
|
|
|
|
2013-07-10 16:37:07 +00:00
|
|
|
; EG-CHECK: LDS_READ_RET
|
2013-08-16 16:19:24 +00:00
|
|
|
; SI-CHECK: DS_READ_B32 {{VGPR[0-9]+}}, 0
|
2013-06-28 15:47:08 +00:00
|
|
|
|
|
|
|
define void @local_memory(i32 addrspace(1)* %out) {
|
|
|
|
entry:
|
|
|
|
%y.i = call i32 @llvm.r600.read.tidig.x() #0
|
|
|
|
%arrayidx = getelementptr inbounds [16 x i32] addrspace(3)* @local_memory.local_mem, i32 0, i32 %y.i
|
|
|
|
store i32 %y.i, i32 addrspace(3)* %arrayidx, align 4
|
|
|
|
%add = add nsw i32 %y.i, 1
|
|
|
|
%cmp = icmp eq i32 %add, 16
|
|
|
|
%.add = select i1 %cmp, i32 0, i32 %add
|
|
|
|
call void @llvm.AMDGPU.barrier.local()
|
|
|
|
%arrayidx1 = getelementptr inbounds [16 x i32] addrspace(3)* @local_memory.local_mem, i32 0, i32 %.add
|
|
|
|
%0 = load i32 addrspace(3)* %arrayidx1, align 4
|
|
|
|
%arrayidx2 = getelementptr inbounds i32 addrspace(1)* %out, i32 %y.i
|
|
|
|
store i32 %0, i32 addrspace(1)* %arrayidx2, align 4
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
declare i32 @llvm.r600.read.tidig.x() #0
|
|
|
|
declare void @llvm.AMDGPU.barrier.local()
|
|
|
|
|
|
|
|
attributes #0 = { readnone }
|