diff options
Diffstat (limited to 'llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp')
| -rw-r--r-- | llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp b/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp index 9070b628f12..d939fe5c09b 100644 --- a/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp +++ b/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp @@ -168,6 +168,19 @@ static void ComputePTXValueVTs(const TargetLowering &TLI, const DataLayout &DL, SmallVector<EVT, 16> TempVTs; SmallVector<uint64_t, 16> TempOffsets; + // Special case for i128 - decompose to (i64, i64) + if (Ty->isIntegerTy(128)) { + ValueVTs.push_back(EVT(MVT::i64)); + ValueVTs.push_back(EVT(MVT::i64)); + + if (Offsets) { + Offsets->push_back(StartingOffset + 0); + Offsets->push_back(StartingOffset + 8); + } + + return; + } + ComputeValueVTs(TLI, DL, Ty, TempVTs, &TempOffsets, StartingOffset); for (unsigned i = 0, e = TempVTs.size(); i != e; ++i) { EVT VT = TempVTs[i]; @@ -1262,7 +1275,7 @@ std::string NVPTXTargetLowering::getPrototype( O << "()"; } else { O << "("; - if (retTy->isFloatingPointTy() || retTy->isIntegerTy()) { + if (retTy->isFloatingPointTy() || (retTy->isIntegerTy() && !retTy->isIntegerTy(128))) { unsigned size = 0; if (auto *ITy = dyn_cast<IntegerType>(retTy)) { size = ITy->getBitWidth(); @@ -1280,7 +1293,7 @@ std::string NVPTXTargetLowering::getPrototype( O << ".param .b" << size << " _"; } else if (isa<PointerType>(retTy)) { O << ".param .b" << PtrVT.getSizeInBits() << " _"; - } else if (retTy->isAggregateType() || retTy->isVectorTy()) { + } else if (retTy->isAggregateType() || retTy->isVectorTy() || retTy->isIntegerTy(128)) { auto &DL = CS->getCalledFunction()->getParent()->getDataLayout(); O << ".param .align " << retAlignment << " .b8 _[" << DL.getTypeAllocSize(retTy) << "]"; @@ -1302,7 +1315,7 @@ std::string NVPTXTargetLowering::getPrototype( first = false; if (!Outs[OIdx].Flags.isByVal()) { - if (Ty->isAggregateType() || Ty->isVectorTy()) { + if (Ty->isAggregateType() || Ty->isVectorTy() || Ty->isIntegerTy(128)) { unsigned align = 0; const CallInst *CallI = cast<CallInst>(CS->getInstruction()); // +1 because index 0 is reserved for return type alignment @@ -1458,7 +1471,7 @@ SDValue NVPTXTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI, unsigned AllocSize = DL.getTypeAllocSize(Ty); SDVTList DeclareParamVTs = DAG.getVTList(MVT::Other, MVT::Glue); bool NeedAlign; // Does argument declaration specify alignment? - if (Ty->isAggregateType() || Ty->isVectorTy()) { + if (Ty->isAggregateType() || Ty->isVectorTy() || Ty->isIntegerTy(128)) { // declare .param .align <align> .b8 .param<n>[<size>]; SDValue DeclareParamOps[] = { Chain, DAG.getConstant(ArgAlign, dl, MVT::i32), @@ -1634,8 +1647,8 @@ SDValue NVPTXTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI, // these three types to match the logic in // NVPTXAsmPrinter::printReturnValStr and NVPTXTargetLowering::getPrototype. // Plus, this behavior is consistent with nvcc's. - if (RetTy->isFloatingPointTy() || RetTy->isIntegerTy() || - RetTy->isPointerTy()) { + if (RetTy->isFloatingPointTy() || RetTy->isPointerTy() || + (RetTy->isIntegerTy() && !RetTy->isIntegerTy(128))) { // Scalar needs to be at least 32bit wide if (resultsz < 32) resultsz = 32; @@ -2366,7 +2379,7 @@ SDValue NVPTXTargetLowering::LowerFormalArguments( if (theArgs[i]->use_empty()) { // argument is dead - if (Ty->isAggregateType()) { + if (Ty->isAggregateType() || Ty->isIntegerTy(128)) { SmallVector<EVT, 16> vtparts; ComputePTXValueVTs(*this, DAG.getDataLayout(), Ty, vtparts); |

