diff options
Diffstat (limited to 'llvm/test/CodeGen/AMDGPU/promote-alloca-stored-pointer-value.ll')
| -rw-r--r-- | llvm/test/CodeGen/AMDGPU/promote-alloca-stored-pointer-value.ll | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/llvm/test/CodeGen/AMDGPU/promote-alloca-stored-pointer-value.ll b/llvm/test/CodeGen/AMDGPU/promote-alloca-stored-pointer-value.ll index 2ee98cc3d2d..307eca712cc 100644 --- a/llvm/test/CodeGen/AMDGPU/promote-alloca-stored-pointer-value.ll +++ b/llvm/test/CodeGen/AMDGPU/promote-alloca-stored-pointer-value.ll @@ -1,4 +1,5 @@ -; RUN: llc -march=amdgcn < %s | FileCheck -check-prefix=GCN %s +; RUN: llc -march=amdgcn -mattr=+promote-alloca -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s +; RUN: llc -march=amdgcn -mattr=-promote-alloca -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s ; Pointer value is stored in a candidate for LDS usage. @@ -11,6 +12,18 @@ define void @stored_lds_pointer_value(float* addrspace(1)* %ptr) #0 { ret void } +; GCN-LABEL: {{^}}stored_lds_pointer_value_offset: +; GCN: buffer_store_dword v +define void @stored_lds_pointer_value_offset(float* addrspace(1)* %ptr) #0 { + %tmp0 = alloca float + %tmp1 = alloca float + store float 0.0, float *%tmp0 + store float 0.0, float *%tmp1 + store volatile float* %tmp0, float* addrspace(1)* %ptr + store volatile float* %tmp1, float* addrspace(1)* %ptr + ret void +} + ; GCN-LABEL: {{^}}stored_lds_pointer_value_gep: ; GCN-DAG: s_mov_b32 s{{[0-9]+}}, SCRATCH_RSRC_DWORD0 ; GCN-DAG: s_mov_b32 s{{[0-9]+}}, SCRATCH_RSRC_DWORD1 @@ -36,17 +49,27 @@ bb: define void @stored_vector_pointer_value(i32* addrspace(1)* %out, i32 %index) { entry: %tmp0 = alloca [4 x i32] - %x = getelementptr [4 x i32], [4 x i32]* %tmp0, i32 0, i32 0 - %y = getelementptr [4 x i32], [4 x i32]* %tmp0, i32 0, i32 1 - %z = getelementptr [4 x i32], [4 x i32]* %tmp0, i32 0, i32 2 - %w = getelementptr [4 x i32], [4 x i32]* %tmp0, i32 0, i32 3 + %x = getelementptr inbounds [4 x i32], [4 x i32]* %tmp0, i32 0, i32 0 + %y = getelementptr inbounds [4 x i32], [4 x i32]* %tmp0, i32 0, i32 1 + %z = getelementptr inbounds [4 x i32], [4 x i32]* %tmp0, i32 0, i32 2 + %w = getelementptr inbounds [4 x i32], [4 x i32]* %tmp0, i32 0, i32 3 store i32 0, i32* %x store i32 1, i32* %y store i32 2, i32* %z store i32 3, i32* %w - %tmp1 = getelementptr [4 x i32], [4 x i32]* %tmp0, i32 0, i32 %index + %tmp1 = getelementptr inbounds [4 x i32], [4 x i32]* %tmp0, i32 0, i32 %index store i32* %tmp1, i32* addrspace(1)* %out ret void } +; GCN-LABEL: {{^}}stored_fi_to_self: +; GCN-NOT: ds_ +define void @stored_fi_to_self() #0 { + %tmp = alloca i32* + store volatile i32* inttoptr (i32 1234 to i32*), i32** %tmp + %bitcast = bitcast i32** %tmp to i32* + store volatile i32* %bitcast, i32** %tmp + ret void +} + attributes #0 = { nounwind } |

