]> granicus.if.org Git - clang/commitdiff
[Mips] Follow-up to r179481. Consider "single-float" as a separate
authorSimon Atanasyan <simon@atanasyan.com>
Sun, 14 Apr 2013 14:07:30 +0000 (14:07 +0000)
committerSimon Atanasyan <simon@atanasyan.com>
Sun, 14 Apr 2013 14:07:30 +0000 (14:07 +0000)
independent of float ABI feature in the MipsTargetInfoBase class.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179486 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Basic/Targets.cpp
test/Preprocessor/init.c

index 82ea6563d9fe4ce4b4f7e11cd1bb0092997d8785..9689193869bf0dda889fb3d33fb69da81b3bf5df 100644 (file)
@@ -4405,8 +4405,9 @@ class MipsTargetInfoBase : public TargetInfo {
   static const Builtin::Info BuiltinInfo[];
   std::string CPU;
   bool IsMips16;
+  bool IsSingleFloat;
   enum MipsFloatABI {
-    HardFloat, SingleFloat, SoftFloat
+    HardFloat, SoftFloat
   } FloatABI;
   enum DspRevEnum {
     NoDSP, DSP1, DSP2
@@ -4422,6 +4423,7 @@ public:
     : TargetInfo(triple),
       CPU(CPUStr),
       IsMips16(false),
+      IsSingleFloat(false),
       FloatABI(HardFloat),
       DspRev(NoDSP),
       ABI(ABIStr)
@@ -4448,15 +4450,14 @@ public:
     case HardFloat:
       Builder.defineMacro("__mips_hard_float", Twine(1));
       break;
-    case SingleFloat:
-      Builder.defineMacro("__mips_hard_float", Twine(1));
-      Builder.defineMacro("__mips_single_float", Twine(1));
-      break;
     case SoftFloat:
       Builder.defineMacro("__mips_soft_float", Twine(1));
       break;
     }
 
+    if (IsSingleFloat)
+      Builder.defineMacro("__mips_single_float", Twine(1));
+
     if (IsMips16)
       Builder.defineMacro("__mips16", Twine(1));
 
@@ -4564,13 +4565,14 @@ public:
 
   virtual void HandleTargetFeatures(std::vector<std::string> &Features) {
     IsMips16 = false;
+    IsSingleFloat = false;
     FloatABI = HardFloat;
     DspRev = NoDSP;
 
     for (std::vector<std::string>::iterator it = Features.begin(),
          ie = Features.end(); it != ie; ++it) {
       if (*it == "+single-float")
-        FloatABI = SingleFloat;
+        IsSingleFloat = true;
       else if (*it == "+soft-float")
         FloatABI = SoftFloat;
       else if (*it == "+mips16")
index 90b846634648d6aa3fd1c850cff108d38de70e5d..8ab1439fa63dcf289ca973181fba410acbb047cc 100644 (file)
 // MIPS-FABI-SINGLE:#define __mips_hard_float 1
 // MIPS-FABI-SINGLE:#define __mips_single_float 1
 //
+// RUN: %clang_cc1 -target-feature +soft-float -target-feature +single-float \
+// RUN:   -E -dM -ffreestanding -triple=mips-none-none < /dev/null \
+// RUN:   | FileCheck -check-prefix MIPS-FABI-SINGLE-SOFT %s
+// MIPS-FABI-SINGLE-SOFT:#define __mips_single_float 1
+// MIPS-FABI-SINGLE-SOFT:#define __mips_soft_float 1
+//
 // Check MIPS features macros
 //
 // RUN: %clang_cc1 -target-feature +mips16 \