]> granicus.if.org Git - clang/commitdiff
[mips64][clang] Provide the signext attribute for i32 return values
authorStefan Maksimovic <stefan.maksimovic@mips.com>
Mon, 30 Jul 2018 10:44:46 +0000 (10:44 +0000)
committerStefan Maksimovic <stefan.maksimovic@mips.com>
Mon, 30 Jul 2018 10:44:46 +0000 (10:44 +0000)
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

lib/CodeGen/TargetInfo.cpp

index fa9b0a27af28784da58e66c771dc35cc26de0929..7652cb142cbd03520eeaedad474b6398bb9356f6 100644 (file)
@@ -6985,8 +6985,14 @@ ABIArgInfo MipsABIInfo::classifyReturnType(QualType RetTy) const {
   if (const EnumType *EnumTy = RetTy->getAs<EnumType>())
     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 {