[NVPTX] Support constant vector globals
authorJustin Holewinski <jholewinski@nvidia.com>
Thu, 19 Sep 2013 12:51:46 +0000 (12:51 +0000)
committerJustin Holewinski <jholewinski@nvidia.com>
Thu, 19 Sep 2013 12:51:46 +0000 (12:51 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190997 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/NVPTX/NVPTXAsmPrinter.cpp
test/CodeGen/NVPTX/constant-vectors.ll [new file with mode: 0644]

index 12f18c478acfb14565653dbd1a7b7fdd622ac5da..10f685443fa3ccf4a1097ce0fd66e8cdb50ac55b 100644 (file)
@@ -1864,7 +1864,7 @@ void NVPTXAsmPrinter::bufferLEByte(const Constant *CPV, int Bytes,
   case Type::VectorTyID:
   case Type::StructTyID: {
     if (isa<ConstantArray>(CPV) || isa<ConstantVector>(CPV) ||
   case Type::VectorTyID:
   case Type::StructTyID: {
     if (isa<ConstantArray>(CPV) || isa<ConstantVector>(CPV) ||
-        isa<ConstantStruct>(CPV)) {
+        isa<ConstantStruct>(CPV) || isa<ConstantDataSequential>(CPV)) {
       int ElementSize = TD->getTypeAllocSize(CPV->getType());
       bufferAggregateConstant(CPV, aggBuffer);
       if (Bytes > ElementSize)
       int ElementSize = TD->getTypeAllocSize(CPV->getType());
       bufferAggregateConstant(CPV, aggBuffer);
       if (Bytes > ElementSize)
diff --git a/test/CodeGen/NVPTX/constant-vectors.ll b/test/CodeGen/NVPTX/constant-vectors.ll
new file mode 100644 (file)
index 0000000..7a68756
--- /dev/null
@@ -0,0 +1,7 @@
+; RUN: llc < %s -march=nvptx -mcpu=sm_20 | FileCheck %s
+
+target triple = "nvptx-nvidia-cuda"
+
+; CHECK: .visible .global .align 16 .b8 sphPosArr[80] = {0, 0, 192, 192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 64, 192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 64, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 192, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 63};
+@sphPosArr = constant [5 x <4 x float>] [<4 x float> <float -6.000000e+00, float 0.000000e+00, float 0.000000e+00, float 1.000000e+00>, <4 x float> <float -3.000000e+00, float 0.000000e+00, float 0.000000e+00, float 1.000000e+00>, <4 x float> <float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 1.000000e+00>, <4 x float> <float 3.000000e+00, float 0.000000e+00, float 0.000000e+00, float 1.000000e+00>, <4 x float> <float 6.000000e+00, float 0.000000e+00, float 0.000000e+00, float 1.000000e+00>], align 16
+