2014-09-26 01:12:36 +00:00
|
|
|
; RUN: llc -march=r600 -mcpu=redwood < %s | FileCheck -check-prefix=EG -check-prefix=FUNC %s
|
|
|
|
; RUN: llc -march=r600 -mcpu=verde -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s
|
|
|
|
; RUN: llc -march=r600 -mcpu=bonaire -verify-machineinstrs < %s | FileCheck -check-prefix=CI -check-prefix=FUNC %s
|
2013-06-28 15:47:08 +00:00
|
|
|
|
2014-06-06 01:20:28 +00:00
|
|
|
@local_memory.local_mem = internal unnamed_addr addrspace(3) global [128 x i32] zeroinitializer, align 4
|
2013-06-28 15:47:08 +00:00
|
|
|
|
2014-10-01 17:15:17 +00:00
|
|
|
; FUNC-LABEL: {{^}}local_memory:
|
2013-06-28 15:47:08 +00:00
|
|
|
|
|
|
|
; Check that the LDS size emitted correctly
|
2014-09-26 01:12:36 +00:00
|
|
|
; EG: .long 166120
|
|
|
|
; EG-NEXT: .long 128
|
|
|
|
; SI: .long 47180
|
|
|
|
; SI-NEXT: .long 65536
|
|
|
|
; CI: .long 47180
|
|
|
|
; CI-NEXT: .long 32768
|
2013-06-28 15:47:08 +00:00
|
|
|
|
2014-09-26 01:12:36 +00:00
|
|
|
; EG: LDS_WRITE
|
|
|
|
; SI-NOT: S_WQM_B64
|
|
|
|
; SI: DS_WRITE_B32
|
2013-06-28 15:47:08 +00:00
|
|
|
|
|
|
|
; GROUP_BARRIER must be the last instruction in a clause
|
2014-09-26 01:12:36 +00:00
|
|
|
; EG: GROUP_BARRIER
|
|
|
|
; EG-NEXT: ALU clause
|
|
|
|
; SI: S_BARRIER
|
2013-06-28 15:47:08 +00:00
|
|
|
|
2014-09-26 01:12:36 +00:00
|
|
|
; EG: LDS_READ_RET
|
|
|
|
; SI: DS_READ_B32 {{v[0-9]+}},
|
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
|
2013-10-29 16:37:28 +00:00
|
|
|
%arrayidx = getelementptr inbounds [128 x i32] addrspace(3)* @local_memory.local_mem, i32 0, i32 %y.i
|
2013-06-28 15:47:08 +00:00
|
|
|
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()
|
2013-10-29 16:37:28 +00:00
|
|
|
%arrayidx1 = getelementptr inbounds [128 x i32] addrspace(3)* @local_memory.local_mem, i32 0, i32 %.add
|
2013-06-28 15:47:08 +00:00
|
|
|
%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 }
|