xref: /llvm-project/llvm/test/CodeGen/NVPTX/globals_lowering.ll (revision ef8655adc8e025f1614c8540a791560f1a2a6bbc)
1; RUN: llc < %s -mtriple=nvptx64 -mcpu=sm_20 -relocation-model=static | FileCheck %s --check-prefix CHK
2; RUN: %if ptxas %{ llc < %s -mtriple=nvptx64 -mcpu=sm_20 -relocation-model=static | %ptxas-verify %}
3
4%MyStruct = type { i32, i32, float }
5@Gbl = internal addrspace(3) global [1024 x %MyStruct] zeroinitializer
6
7; CHK-LABEL: foo
8define void @foo(float %f) {
9entry:
10  ; CHK: ld.shared.f32  %{{[a-zA-Z0-9]+}}, [Gbl+8];
11  %0 = load float, ptr addrspace(3) getelementptr inbounds ([1024 x %MyStruct], ptr addrspace(3) @Gbl, i32 0, i32 0, i32 2)
12  %add = fadd float %0, %f
13  ; CHK: st.shared.f32   [Gbl+8], %{{[a-zA-Z0-9]+}};
14  store float %add, ptr addrspace(3) getelementptr inbounds ([1024 x %MyStruct], ptr addrspace(3) @Gbl, i32 0, i32 0, i32 2)
15  ret void
16}
17