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