1 ; RUN: llc < %s -march=r600 -mcpu=redwood | FileCheck --check-prefix=EG-CHECK %s 2 ; RUN: llc < %s -march=r600 -mcpu=verde | FileCheck --check-prefix=SI-CHECK %s 3 4 @local_memory.local_mem = internal addrspace(3) unnamed_addr global [16 x i32] zeroinitializer, align 4 5 6 ; EG-CHECK: @local_memory 7 ; SI-CHECK: @local_memory 8 9 ; Check that the LDS size emitted correctly 10 ; EG-CHECK: .long 166120 11 ; EG-CHECK-NEXT: .long 16 12 ; SI-CHECK: .long 47180 13 ; SI-CHECK-NEXT: .long 32768 14 15 ; EG-CHECK: LDS_WRITE 16 ; SI-CHECK: DS_WRITE_B32 17 18 ; GROUP_BARRIER must be the last instruction in a clause 19 ; EG-CHECK: GROUP_BARRIER 20 ; EG-CHECK-NEXT: ALU clause 21 ; SI-CHECK: S_BARRIER 22 23 ; EG-CHECK: LDS_READ_RET 24 ; SI-CHECK: DS_READ_B32 25 26 define void @local_memory(i32 addrspace(1)* %out) { 27 entry: 28 %y.i = call i32 @llvm.r600.read.tidig.x() #0 29 %arrayidx = getelementptr inbounds [16 x i32] addrspace(3)* @local_memory.local_mem, i32 0, i32 %y.i 30 store i32 %y.i, i32 addrspace(3)* %arrayidx, align 4 31 %add = add nsw i32 %y.i, 1 32 %cmp = icmp eq i32 %add, 16 33 %.add = select i1 %cmp, i32 0, i32 %add 34 call void @llvm.AMDGPU.barrier.local() 35 %arrayidx1 = getelementptr inbounds [16 x i32] addrspace(3)* @local_memory.local_mem, i32 0, i32 %.add 36 %0 = load i32 addrspace(3)* %arrayidx1, align 4 37 %arrayidx2 = getelementptr inbounds i32 addrspace(1)* %out, i32 %y.i 38 store i32 %0, i32 addrspace(1)* %arrayidx2, align 4 39 ret void 40 } 41 42 declare i32 @llvm.r600.read.tidig.x() #0 43 declare void @llvm.AMDGPU.barrier.local() 44 45 attributes #0 = { readnone } 46