1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -mtriple=amdgcn-- -amdgpu-lower-module-lds < %s --amdgpu-lower-module-lds-strategy=module | FileCheck -check-prefix=OPT %s
3 ; RUN: opt -S -mtriple=amdgcn-- -passes=amdgpu-lower-module-lds < %s --amdgpu-lower-module-lds-strategy=module | FileCheck -check-prefix=OPT %s
4 ; RUN: llc -march=amdgcn -mcpu=gfx900 -verify-machineinstrs < %s --amdgpu-lower-module-lds-strategy=module | FileCheck -check-prefix=GCN %s
6 ; Check that module LDS is allocated at address 0 and kernel starts its
7 ; allocation past module LDS when a call is present.
9 @lds.size.1.align.1 = internal unnamed_addr addrspace(3) global [1 x i8] undef, align 1
10 @lds.size.16.align.16 = internal unnamed_addr addrspace(3) global [16 x i8] undef, align 16
13 ; GCN-DAG: v_mov_b32_e32 [[NULL:v[0-9]+]], 0
14 ; GCN-DAG: v_mov_b32_e32 [[ONE:v[0-9]+]], 1
15 ; GCN: ds_write_b8 [[NULL]], [[ONE]]
16 ; GCN: v_mov_b32_e32 [[TWO:v[0-9]+]], 2
17 ; GCN: ds_write_b8 [[NULL]], [[TWO]] offset:16
18 define amdgpu_kernel void @k0() {
20 ; OPT-NEXT: call void @llvm.donothing() [ "ExplicitUse"(ptr addrspace(3) @llvm.amdgcn.kernel.k0.lds) ]
21 ; OPT-NEXT: call void @llvm.donothing() [ "ExplicitUse"(ptr addrspace(3) @llvm.amdgcn.module.lds) ]
22 ; OPT-NEXT: store i8 1, ptr addrspace(3) @llvm.amdgcn.module.lds, align 1
23 ; OPT-NEXT: store i8 2, ptr addrspace(3) @llvm.amdgcn.kernel.k0.lds, align 16
24 ; OPT-NEXT: call void @f0()
27 store i8 1, ptr addrspace(3) @lds.size.1.align.1, align 1
28 store i8 2, ptr addrspace(3) @lds.size.16.align.16, align 16
34 ; GCN-DAG: v_mov_b32_e32 [[NULL:v[0-9]+]], 0
35 ; GCN-DAG: v_mov_b32_e32 [[TREE:v[0-9]+]], 3
36 ; GCN: ds_write_b8 [[NULL]], [[TREE]]
39 ; OPT-NEXT: store i8 3, ptr addrspace(3) @llvm.amdgcn.module.lds, align 1
42 store i8 3, ptr addrspace(3) @lds.size.1.align.1, align 1