74 lines · plain
1; RUN: llc -mtriple=amdgcn -mattr=+promote-alloca,+max-private-element-size-4 < %s | FileCheck -check-prefix=GCN %s2; RUN: llc -mtriple=amdgcn -mattr=-promote-alloca,+max-private-element-size-4 < %s | FileCheck -check-prefix=GCN %s3 4; Pointer value is stored in a candidate for LDS usage.5 6; GCN-LABEL: {{^}}stored_lds_pointer_value:7; GCN: buffer_store_dword v8define amdgpu_kernel void @stored_lds_pointer_value(ptr addrspace(1) %ptr) #0 {9 %tmp = alloca float, addrspace(5)10 store float 0.0, ptr addrspace(5) %tmp11 store ptr addrspace(5) %tmp, ptr addrspace(1) %ptr12 ret void13}14 15; GCN-LABEL: {{^}}stored_lds_pointer_value_offset:16; GCN: buffer_store_dword v17define amdgpu_kernel void @stored_lds_pointer_value_offset(ptr addrspace(1) %ptr) #0 {18 %tmp0 = alloca float, addrspace(5)19 %tmp1 = alloca float, addrspace(5)20 store float 0.0, ptr addrspace(5) %tmp021 store float 0.0, ptr addrspace(5) %tmp122 store volatile ptr addrspace(5) %tmp0, ptr addrspace(1) %ptr23 store volatile ptr addrspace(5) %tmp1, ptr addrspace(1) %ptr24 ret void25}26 27; GCN-LABEL: {{^}}stored_lds_pointer_value_gep:28; GCN-DAG: s_mov_b32 s{{[0-9]+}}, SCRATCH_RSRC_DWORD029; GCN-DAG: s_mov_b32 s{{[0-9]+}}, SCRATCH_RSRC_DWORD130; GCN: buffer_store_dword v31; GCN: buffer_store_dword v32define amdgpu_kernel void @stored_lds_pointer_value_gep(ptr addrspace(1) %ptr, i32 %idx) #0 {33bb:34 %tmp = alloca float, i32 16, addrspace(5)35 store float 0.0, ptr addrspace(5) %tmp36 %tmp2 = getelementptr inbounds float, ptr addrspace(5) %tmp, i32 %idx37 store ptr addrspace(5) %tmp2, ptr addrspace(1) %ptr38 ret void39}40 41; Pointer value is stored in a candidate for vector usage42; GCN-LABEL: {{^}}stored_vector_pointer_value:43; GCN-DAG: s_mov_b32 s{{[0-9]+}}, SCRATCH_RSRC_DWORD044; GCN-DAG: s_mov_b32 s{{[0-9]+}}, SCRATCH_RSRC_DWORD145; GCN: buffer_store_dword46; GCN: buffer_store_dword47; GCN: buffer_store_dword48; GCN: buffer_store_dword49define amdgpu_kernel void @stored_vector_pointer_value(ptr addrspace(1) %out, i32 %index) {50entry:51 %tmp0 = alloca [4 x i32], addrspace(5)52 %y = getelementptr inbounds [4 x i32], ptr addrspace(5) %tmp0, i32 0, i32 153 %z = getelementptr inbounds [4 x i32], ptr addrspace(5) %tmp0, i32 0, i32 254 %w = getelementptr inbounds [4 x i32], ptr addrspace(5) %tmp0, i32 0, i32 355 store i32 0, ptr addrspace(5) %tmp056 store i32 1, ptr addrspace(5) %y57 store i32 2, ptr addrspace(5) %z58 store i32 3, ptr addrspace(5) %w59 %tmp1 = getelementptr inbounds [4 x i32], ptr addrspace(5) %tmp0, i32 0, i32 %index60 store ptr addrspace(5) %tmp1, ptr addrspace(1) %out61 ret void62}63 64; GCN-LABEL: {{^}}stored_fi_to_self:65; GCN-NOT: ds_66define amdgpu_kernel void @stored_fi_to_self() #0 {67 %tmp = alloca ptr addrspace(5), addrspace(5)68 store volatile ptr addrspace(5) inttoptr (i32 1234 to ptr addrspace(5)), ptr addrspace(5) %tmp69 store volatile ptr addrspace(5) %tmp, ptr addrspace(5) %tmp70 ret void71}72 73attributes #0 = { nounwind }74