xref: /llvm-project/llvm/test/CodeGen/NVPTX/global-incomplete-init.ll (revision b279f6b098d3849f7f1c1f539b108307d5f8ae2d)
1*b279f6b0SFangrui Song; RUN: llc < %s -mtriple=nvptx64 -mcpu=sm_50 | FileCheck %s
2*b279f6b0SFangrui Song; RUN: %if ptxas %{ llc < %s -mtriple=nvptx64 -mcpu=sm_50 | %ptxas-verify %}
33b8539c9SAlex MacLean
43b8539c9SAlex MacLean; Make sure the globals constants have trailing zeros properly trimmed
53b8539c9SAlex MacLean
63b8539c9SAlex MacLean; basic case
73b8539c9SAlex MacLean; CHECK-DAG: .b8 A[8] = {3, 4, 0, 0, 5};
83b8539c9SAlex MacLean@A = global [8 x i8] [i8 3, i8 4, i8 0, i8 0, i8 5, i8 0, i8 0, i8 0]
93b8539c9SAlex MacLean
103b8539c9SAlex MacLean; all-zeros
113b8539c9SAlex MacLean; CHECK-DAG: .b8 B[2];
123b8539c9SAlex MacLean@B = global [2 x i8] [i8 0, i8 0]
133b8539c9SAlex MacLean
143b8539c9SAlex MacLean; all-non-zeros
153b8539c9SAlex MacLean; CHECK-DAG: .b8 C[4] = {1, 2, 3, 4};
163b8539c9SAlex MacLean@C = global [4 x i8] [i8 1, i8 2, i8 3, i8 4]
173b8539c9SAlex MacLean
183b8539c9SAlex MacLean; initializer with a symbol, the last 0 could be default initialized
193b8539c9SAlex MacLean; CHECK-DAG: .u8 e = 1;
203b8539c9SAlex MacLean; CHECK-DAG: .u64 D[4] = {e, 0, e, 0};
213b8539c9SAlex MacLean@e = addrspace(1) global i8 1
223b8539c9SAlex MacLean@D = addrspace(1) global [4 x ptr addrspace(1)] [ptr addrspace(1) @e, ptr addrspace(1) null, ptr addrspace(1) @e, ptr addrspace(1) null]
23