From: Stefan Maksimovic Date: Mon, 30 Jul 2018 10:44:46 +0000 (+0000) Subject: [mips64][clang] Provide the signext attribute for i32 return values X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a1448de5327a4828d65844a659d7e9c6af722fe1;p=clang [mips64][clang] Provide the signext attribute for i32 return values Additional info: see r338019. Differential Revision: https://reviews.llvm.org/D49289 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@338239 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/TargetInfo.cpp b/lib/CodeGen/TargetInfo.cpp index fa9b0a27af..7652cb142c 100644 --- a/lib/CodeGen/TargetInfo.cpp +++ b/lib/CodeGen/TargetInfo.cpp @@ -6985,8 +6985,14 @@ ABIArgInfo MipsABIInfo::classifyReturnType(QualType RetTy) const { if (const EnumType *EnumTy = RetTy->getAs()) RetTy = EnumTy->getDecl()->getIntegerType(); - return (RetTy->isPromotableIntegerType() ? ABIArgInfo::getExtend(RetTy) - : ABIArgInfo::getDirect()); + if (RetTy->isPromotableIntegerType()) + return ABIArgInfo::getExtend(RetTy); + + if ((RetTy->isUnsignedIntegerOrEnumerationType() || + RetTy->isSignedIntegerOrEnumerationType()) && Size == 32 && !IsO32) + return ABIArgInfo::getSignExtend(RetTy); + + return ABIArgInfo::getDirect(); } void MipsABIInfo::computeInfo(CGFunctionInfo &FI) const {