diff options
Diffstat (limited to 'llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp')
| -rw-r--r-- | llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp b/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp index fa4b389cdb2..b9473514e5e 100644 --- a/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp +++ b/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp @@ -1230,7 +1230,8 @@ void NVPTXAsmPrinter::printModuleLevelGV(const GlobalVariable *GVar, else O << " .align " << GVar->getAlignment(); - if (ETy->isFloatingPointTy() || ETy->isIntegerTy() || ETy->isPointerTy()) { + if (ETy->isFloatingPointTy() || ETy->isPointerTy() || + (ETy->isIntegerTy() && ETy->getScalarSizeInBits() <= 64)) { O << " ."; // Special case: ABI requires that we use .u8 for predicates if (ETy->isIntegerTy(1)) @@ -1271,6 +1272,7 @@ void NVPTXAsmPrinter::printModuleLevelGV(const GlobalVariable *GVar, // targets that support these high level field accesses. Structs, arrays // and vectors are lowered into arrays of bytes. switch (ETy->getTypeID()) { + case Type::IntegerTyID: // Integers larger than 64 bits case Type::StructTyID: case Type::ArrayTyID: case Type::VectorTyID: @@ -1994,6 +1996,17 @@ void NVPTXAsmPrinter::bufferAggregateConstant(const Constant *CPV, const DataLayout &DL = getDataLayout(); int Bytes; + // Integers of arbitrary width + if (const ConstantInt *CI = dyn_cast<ConstantInt>(CPV)) { + APInt Val = CI->getValue(); + for (unsigned I = 0, E = DL.getTypeAllocSize(CPV->getType()); I < E; ++I) { + uint8_t Byte = Val.getLoBits(8).getZExtValue(); + aggBuffer->addBytes(&Byte, 1, 1); + Val = Val.lshr(8); + } + return; + } + // Old constants if (isa<ConstantArray>(CPV) || isa<ConstantVector>(CPV)) { if (CPV->getNumOperands()) |

