Home | History | Annotate | Download | only in AMDGPU
      1 ; RUN: llc -march=amdgcn < %s | FileCheck -check-prefix=GCN %s
      2 
      3 ; Pointer value is stored in a candidate for LDS usage.
      4 
      5 ; GCN-LABEL: {{^}}stored_lds_pointer_value:
      6 ; GCN: buffer_store_dword v
      7 define void @stored_lds_pointer_value(float* addrspace(1)* %ptr) #0 {
      8   %tmp = alloca float
      9   store float 0.0, float *%tmp
     10   store float* %tmp, float* addrspace(1)* %ptr
     11   ret void
     12 }
     13 
     14 ; GCN-LABEL: {{^}}stored_lds_pointer_value_gep:
     15 ; GCN-DAG: s_mov_b32 s{{[0-9]+}}, SCRATCH_RSRC_DWORD0
     16 ; GCN-DAG: s_mov_b32 s{{[0-9]+}}, SCRATCH_RSRC_DWORD1
     17 ; GCN: buffer_store_dword v
     18 ; GCN: buffer_store_dword v
     19 define void @stored_lds_pointer_value_gep(float* addrspace(1)* %ptr, i32 %idx) #0 {
     20 bb:
     21   %tmp = alloca float, i32 16
     22   store float 0.0, float* %tmp
     23   %tmp2 = getelementptr inbounds float, float* %tmp, i32 %idx
     24   store float* %tmp2, float* addrspace(1)* %ptr
     25   ret void
     26 }
     27 
     28 ; Pointer value is stored in a candidate for vector usage
     29 ; GCN-LABEL: {{^}}stored_vector_pointer_value:
     30 ; GCN-DAG: s_mov_b32 s{{[0-9]+}}, SCRATCH_RSRC_DWORD0
     31 ; GCN-DAG: s_mov_b32 s{{[0-9]+}}, SCRATCH_RSRC_DWORD1
     32 ; GCN: buffer_store_dword
     33 ; GCN: buffer_store_dword
     34 ; GCN: buffer_store_dword
     35 ; GCN: buffer_store_dword
     36 define void @stored_vector_pointer_value(i32* addrspace(1)* %out, i32 %index) {
     37 entry:
     38   %tmp0 = alloca [4 x i32]
     39   %x = getelementptr [4 x i32], [4 x i32]* %tmp0, i32 0, i32 0
     40   %y = getelementptr [4 x i32], [4 x i32]* %tmp0, i32 0, i32 1
     41   %z = getelementptr [4 x i32], [4 x i32]* %tmp0, i32 0, i32 2
     42   %w = getelementptr [4 x i32], [4 x i32]* %tmp0, i32 0, i32 3
     43   store i32 0, i32* %x
     44   store i32 1, i32* %y
     45   store i32 2, i32* %z
     46   store i32 3, i32* %w
     47   %tmp1 = getelementptr [4 x i32], [4 x i32]* %tmp0, i32 0, i32 %index
     48   store i32* %tmp1, i32* addrspace(1)* %out
     49   ret void
     50 }
     51 
     52 attributes #0 = { nounwind }
     53