1 ; RUN: llc -march=r600 -mcpu=redwood < %s | FileCheck -check-prefix=EG -check-prefix=FUNC %s
2 ; RUN: llc -march=amdgcn -mcpu=verde -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s
3 ; RUN: llc -march=amdgcn -mcpu=bonaire -verify-machineinstrs < %s | FileCheck -check-prefix=CI -check-prefix=FUNC %s
5 @local_memory.local_mem = internal unnamed_addr addrspace(3) global [128 x i32] undef, align 4
8 ; Check that the LDS size emitted correctly
12 ; SI-NEXT: .long 71560
14 ; CI-NEXT: .long 38792
16 ; FUNC-LABEL: {{^}}local_memory:
22 ; GROUP_BARRIER must be the last instruction in a clause
28 ; SI: ds_read_b32 {{v[0-9]+}},
30 define void @local_memory(i32 addrspace(1)* %out) {
32 %y.i = call i32 @llvm.r600.read.tidig.x() #0
33 %arrayidx = getelementptr inbounds [128 x i32], [128 x i32] addrspace(3)* @local_memory.local_mem, i32 0, i32 %y.i
34 store i32 %y.i, i32 addrspace(3)* %arrayidx, align 4
35 %add = add nsw i32 %y.i, 1
36 %cmp = icmp eq i32 %add, 16
37 %.add = select i1 %cmp, i32 0, i32 %add
38 call void @llvm.AMDGPU.barrier.local()
39 %arrayidx1 = getelementptr inbounds [128 x i32], [128 x i32] addrspace(3)* @local_memory.local_mem, i32 0, i32 %.add
40 %0 = load i32, i32 addrspace(3)* %arrayidx1, align 4
41 %arrayidx2 = getelementptr inbounds i32, i32 addrspace(1)* %out, i32 %y.i
42 store i32 %0, i32 addrspace(1)* %arrayidx2, align 4
46 declare i32 @llvm.r600.read.tidig.x() #0
47 declare void @llvm.AMDGPU.barrier.local()
49 attributes #0 = { readnone }