Home | History | Annotate | Download | only in AMDGPU
      1 ; RUN: llc -march=amdgcn -mattr=+promote-alloca -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
      2 ; RUN: llc -march=amdgcn -mattr=-promote-alloca -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
      8 define void @stored_lds_pointer_value(float* addrspace(1)* %ptr) #0 {
      9   %tmp = alloca float
     10   store float 0.0, float *%tmp
     11   store float* %tmp, float* addrspace(1)* %ptr
     12   ret void
     13 }
     14 
     15 ; GCN-LABEL: {{^}}stored_lds_pointer_value_offset:
     16 ; GCN: buffer_store_dword v
     17 define void @stored_lds_pointer_value_offset(float* addrspace(1)* %ptr) #0 {
     18   %tmp0 = alloca float
     19   %tmp1 = alloca float
     20   store float 0.0, float *%tmp0
     21   store float 0.0, float *%tmp1
     22   store volatile float* %tmp0, float* addrspace(1)* %ptr
     23   store volatile float* %tmp1, float* 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
     32 define void @stored_lds_pointer_value_gep(float* addrspace(1)* %ptr, i32 %idx) #0 {
     33 bb:
     34   %tmp = alloca float, i32 16
     35   store float 0.0, float* %tmp
     36   %tmp2 = getelementptr inbounds float, float* %tmp, i32 %idx
     37   store float* %tmp2, float* 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
     49 define void @stored_vector_pointer_value(i32* addrspace(1)* %out, i32 %index) {
     50 entry:
     51   %tmp0 = alloca [4 x i32]
     52   %x = getelementptr inbounds [4 x i32], [4 x i32]* %tmp0, i32 0, i32 0
     53   %y = getelementptr inbounds [4 x i32], [4 x i32]* %tmp0, i32 0, i32 1
     54   %z = getelementptr inbounds [4 x i32], [4 x i32]* %tmp0, i32 0, i32 2
     55   %w = getelementptr inbounds [4 x i32], [4 x i32]* %tmp0, i32 0, i32 3
     56   store i32 0, i32* %x
     57   store i32 1, i32* %y
     58   store i32 2, i32* %z
     59   store i32 3, i32* %w
     60   %tmp1 = getelementptr inbounds [4 x i32], [4 x i32]* %tmp0, i32 0, i32 %index
     61   store i32* %tmp1, i32* addrspace(1)* %out
     62   ret void
     63 }
     64 
     65 ; GCN-LABEL: {{^}}stored_fi_to_self:
     66 ; GCN-NOT: ds_
     67 define void @stored_fi_to_self() #0 {
     68   %tmp = alloca i32*
     69   store volatile i32* inttoptr (i32 1234 to i32*), i32** %tmp
     70   %bitcast = bitcast i32** %tmp to i32*
     71   store volatile i32* %bitcast, i32** %tmp
     72   ret void
     73 }
     74 
     75 attributes #0 = { nounwind }
     76