[llvm-branch-commits] [cfe-branch] r245096 - Merging r244468:

Hans Wennborg via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Aug 14 14:00:50 PDT 2015


Author: hans
Date: Fri Aug 14 16:00:50 2015
New Revision: 245096

URL: http://llvm.org/viewvc/llvm-project?rev=245096&view=rev
Log:
Merging r244468:
------------------------------------------------------------------------
r244468 | chh | 2015-08-10 10:33:31 -0700 (Mon, 10 Aug 2015) | 15 lines

Correct x86_64 fp128 calling convention

These changes are for Android x86_64 targets to be compatible
with current Android g++ and conform to AMD64 ABI.

https://llvm.org/bugs/show_bug.cgi?id=23897
  * Return type of long double (fp128) should be fp128, not x86_fp80.
  * Vararg of long double (fp128) could be in register and overflowed to memory.

https://llvm.org/bugs/show_bug.cgi?id=24111
  * Return value of long double (fp128) _Complex should be in memory like a structure of {fp128,fp128}.

Differential Revision: http://reviews.llvm.org/D11437


------------------------------------------------------------------------

Added:
    cfe/branches/release_37/test/CodeGen/x86_64-fp128.c
      - copied unchanged from r244468, cfe/trunk/test/CodeGen/x86_64-fp128.c
Modified:
    cfe/branches/release_37/   (props changed)
    cfe/branches/release_37/lib/CodeGen/TargetInfo.cpp

Propchange: cfe/branches/release_37/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Aug 14 16:00:50 2015
@@ -1,4 +1,4 @@
 /cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:242244,242285,242293,242297,242313,242382,242422,242499,242574,242600,242660,242662,242667,242678,242766,242854,242905,242973,243018,243048,243085,243098,243101,243105,243133,243144,243153,243196,243206,243277,243280,243285,243289,243343,243417,243463,243538,243594,243642-243644,243851,243945-243950,243964,244000,244719,244794
+/cfe/trunk:242244,242285,242293,242297,242313,242382,242422,242499,242574,242600,242660,242662,242667,242678,242766,242854,242905,242973,243018,243048,243085,243098,243101,243105,243133,243144,243153,243196,243206,243277,243280,243285,243289,243343,243417,243463,243538,243594,243642-243644,243851,243945-243950,243964,244000,244468,244719,244794
 /cfe/trunk/test:170344
 /cfe/trunk/test/SemaTemplate:126920

Modified: cfe/branches/release_37/lib/CodeGen/TargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_37/lib/CodeGen/TargetInfo.cpp?rev=245096&r1=245095&r2=245096&view=diff
==============================================================================
--- cfe/branches/release_37/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/branches/release_37/lib/CodeGen/TargetInfo.cpp Fri Aug 14 16:00:50 2015
@@ -1858,13 +1858,20 @@ void X86_64ABIInfo::classify(QualType Ty
       Hi = Integer;
     } else if (k >= BuiltinType::Bool && k <= BuiltinType::LongLong) {
       Current = Integer;
-    } else if ((k == BuiltinType::Float || k == BuiltinType::Double) ||
-               (k == BuiltinType::LongDouble &&
-                getTarget().getTriple().isOSNaCl())) {
+    } else if (k == BuiltinType::Float || k == BuiltinType::Double) {
       Current = SSE;
     } else if (k == BuiltinType::LongDouble) {
-      Lo = X87;
-      Hi = X87Up;
+      const llvm::fltSemantics *LDF = &getTarget().getLongDoubleFormat();
+      if (LDF == &llvm::APFloat::IEEEquad) {
+        Lo = SSE;
+        Hi = SSEUp;
+      } else if (LDF == &llvm::APFloat::x87DoubleExtended) {
+        Lo = X87;
+        Hi = X87Up;
+      } else if (LDF == &llvm::APFloat::IEEEdouble) {
+        Current = SSE;
+      } else
+        llvm_unreachable("unexpected long double representation!");
     }
     // FIXME: _Decimal32 and _Decimal64 are SSE.
     // FIXME: _float128 and _Decimal128 are (SSE, SSEUp).
@@ -1967,14 +1974,21 @@ void X86_64ABIInfo::classify(QualType Ty
         Current = Integer;
       else if (Size <= 128)
         Lo = Hi = Integer;
-    } else if (ET == getContext().FloatTy)
+    } else if (ET == getContext().FloatTy) {
       Current = SSE;
-    else if (ET == getContext().DoubleTy ||
-             (ET == getContext().LongDoubleTy &&
-              getTarget().getTriple().isOSNaCl()))
+    } else if (ET == getContext().DoubleTy) {
       Lo = Hi = SSE;
-    else if (ET == getContext().LongDoubleTy)
-      Current = ComplexX87;
+    } else if (ET == getContext().LongDoubleTy) {
+      const llvm::fltSemantics *LDF = &getTarget().getLongDoubleFormat();
+      if (LDF == &llvm::APFloat::IEEEquad)
+        Current = Memory;
+      else if (LDF == &llvm::APFloat::x87DoubleExtended)
+        Current = ComplexX87;
+      else if (LDF == &llvm::APFloat::IEEEdouble)
+        Lo = Hi = SSE;
+      else
+        llvm_unreachable("unexpected long double representation!");
+    }
 
     // If this complex type crosses an eightbyte boundary then it
     // should be split.
@@ -2243,7 +2257,8 @@ llvm::Type *X86_64ABIInfo::GetByteVector
     Ty = QualType(InnerTy, 0);
 
   llvm::Type *IRType = CGT.ConvertType(Ty);
-  if(isa<llvm::VectorType>(IRType))
+  if (isa<llvm::VectorType>(IRType) ||
+      IRType->getTypeID() == llvm::Type::FP128TyID)
     return IRType;
 
   // We couldn't find the preferred IR vector type for 'Ty'.




More information about the llvm-branch-commits mailing list