• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -march=amdgcn -mattr=+promote-alloca,+max-private-element-size-4 -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
2; RUN: llc -march=amdgcn -mattr=-promote-alloca,+max-private-element-size-4 -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
3
4; Pointer value is stored in a candidate for LDS usage.
5
6; GCN-LABEL: {{^}}stored_lds_pointer_value:
7; GCN: buffer_store_dword v
8define amdgpu_kernel void @stored_lds_pointer_value(float addrspace(5)* addrspace(1)* %ptr) #0 {
9  %tmp = alloca float, addrspace(5)
10  store float 0.0, float  addrspace(5)*%tmp
11  store float addrspace(5)* %tmp, float addrspace(5)* addrspace(1)* %ptr
12  ret void
13}
14
15; GCN-LABEL: {{^}}stored_lds_pointer_value_offset:
16; GCN: buffer_store_dword v
17define amdgpu_kernel void @stored_lds_pointer_value_offset(float addrspace(5)* addrspace(1)* %ptr) #0 {
18  %tmp0 = alloca float, addrspace(5)
19  %tmp1 = alloca float, addrspace(5)
20  store float 0.0, float  addrspace(5)*%tmp0
21  store float 0.0, float  addrspace(5)*%tmp1
22  store volatile float addrspace(5)* %tmp0, float addrspace(5)* addrspace(1)* %ptr
23  store volatile float addrspace(5)* %tmp1, float addrspace(5)* addrspace(1)* %ptr
24  ret void
25}
26
27; GCN-LABEL: {{^}}stored_lds_pointer_value_gep:
28; GCN-DAG: s_mov_b32 s{{[0-9]+}}, SCRATCH_RSRC_DWORD0
29; GCN-DAG: s_mov_b32 s{{[0-9]+}}, SCRATCH_RSRC_DWORD1
30; GCN: buffer_store_dword v
31; GCN: buffer_store_dword v
32define amdgpu_kernel void @stored_lds_pointer_value_gep(float addrspace(5)* addrspace(1)* %ptr, i32 %idx) #0 {
33bb:
34  %tmp = alloca float, i32 16, addrspace(5)
35  store float 0.0, float addrspace(5)* %tmp
36  %tmp2 = getelementptr inbounds float, float addrspace(5)* %tmp, i32 %idx
37  store float addrspace(5)* %tmp2, float addrspace(5)* addrspace(1)* %ptr
38  ret void
39}
40
41; Pointer value is stored in a candidate for vector usage
42; GCN-LABEL: {{^}}stored_vector_pointer_value:
43; GCN-DAG: s_mov_b32 s{{[0-9]+}}, SCRATCH_RSRC_DWORD0
44; GCN-DAG: s_mov_b32 s{{[0-9]+}}, SCRATCH_RSRC_DWORD1
45; GCN: buffer_store_dword
46; GCN: buffer_store_dword
47; GCN: buffer_store_dword
48; GCN: buffer_store_dword
49define amdgpu_kernel void @stored_vector_pointer_value(i32 addrspace(5)* addrspace(1)* %out, i32 %index) {
50entry:
51  %tmp0 = alloca [4 x i32], addrspace(5)
52  %x = getelementptr inbounds [4 x i32], [4 x i32] addrspace(5)* %tmp0, i32 0, i32 0
53  %y = getelementptr inbounds [4 x i32], [4 x i32] addrspace(5)* %tmp0, i32 0, i32 1
54  %z = getelementptr inbounds [4 x i32], [4 x i32] addrspace(5)* %tmp0, i32 0, i32 2
55  %w = getelementptr inbounds [4 x i32], [4 x i32] addrspace(5)* %tmp0, i32 0, i32 3
56  store i32 0, i32 addrspace(5)* %x
57  store i32 1, i32 addrspace(5)* %y
58  store i32 2, i32 addrspace(5)* %z
59  store i32 3, i32 addrspace(5)* %w
60  %tmp1 = getelementptr inbounds [4 x i32], [4 x i32] addrspace(5)* %tmp0, i32 0, i32 %index
61  store i32 addrspace(5)* %tmp1, i32 addrspace(5)* addrspace(1)* %out
62  ret void
63}
64
65; GCN-LABEL: {{^}}stored_fi_to_self:
66; GCN-NOT: ds_
67define amdgpu_kernel void @stored_fi_to_self() #0 {
68  %tmp = alloca i32 addrspace(5)*, addrspace(5)
69  store volatile i32 addrspace(5)* inttoptr (i32 1234 to i32 addrspace(5)*), i32 addrspace(5)* addrspace(5)* %tmp
70  %bitcast = bitcast i32 addrspace(5)* addrspace(5)* %tmp to i32 addrspace(5)*
71  store volatile i32 addrspace(5)* %bitcast, i32 addrspace(5)* addrspace(5)* %tmp
72  ret void
73}
74
75attributes #0 = { nounwind }
76