[PATCH] D14285: [x86] Additional small fix for MCU psABI support

Andrey Bokhanko via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 3 07:44:32 PST 2015


andreybokhanko created this revision.
andreybokhanko added reviewers: rnk, DavidKreitzer, mkuper.
andreybokhanko added a subscriber: cfe-commits.

This patch fixes one more thing in MCU psABI support: LongDoubleWidth should be set to 64.

http://reviews.llvm.org/D14285

Files:
  lib/Basic/Targets.cpp
  test/CodeGen/x86_32-arguments-iamcu.c

Index: lib/Basic/Targets.cpp
===================================================================
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -2335,8 +2335,7 @@
 public:
   X86TargetInfo(const llvm::Triple &Triple) : TargetInfo(Triple) {
     BigEndian = false;
-    LongDoubleFormat = Triple.isOSIAMCU() ? &llvm::APFloat::IEEEdouble
-                                          : &llvm::APFloat::x87DoubleExtended;
+    LongDoubleFormat = &llvm::APFloat::x87DoubleExtended;
   }
   unsigned getFloatEvalMethod() const override {
     // X87 evaluates with 80 bits "long double" precision.
@@ -3624,6 +3623,11 @@
     IntPtrType = SignedInt;
     RegParmMax = 3;
 
+    if (getTriple().isOSIAMCU()) {
+      LongDoubleWidth = 64;
+      LongDoubleFormat = &llvm::APFloat::IEEEdouble;
+    }
+
     // Use fpret for all types.
     RealTypeUsesObjCFPRet = ((1 << TargetInfo::Float) |
                              (1 << TargetInfo::Double) |
Index: test/CodeGen/x86_32-arguments-iamcu.c
===================================================================
--- test/CodeGen/x86_32-arguments-iamcu.c
+++ test/CodeGen/x86_32-arguments-iamcu.c
@@ -57,6 +57,6 @@
 // CHECK-LABEL: define i32 @varArgs(i32 inreg %i1, ...)
 int varArgs(int i1, ...) { return i1; }
 
-// CHECK-LABEL: define double @longDoubleArg(double %ld1)
+// CHECK-LABEL: define double @longDoubleArg(double inreg %ld1)
 long double longDoubleArg(long double ld1) { return ld1; }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14285.39063.patch
Type: text/x-patch
Size: 1450 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151103/578eb418/attachment-0001.bin>


More information about the cfe-commits mailing list