[cfe-commits] r157996 - in /cfe/trunk: lib/Basic/Targets.cpp test/Preprocessor/init.c

Simon Atanasyan satanasyan at mips.com
Tue Jun 5 06:06:56 PDT 2012


Author: atanasyan
Date: Tue Jun  5 08:06:56 2012
New Revision: 157996

URL: http://llvm.org/viewvc/llvm-project?rev=157996&view=rev
Log:
Mips: Define __mips_hard_float macro additional to __mips_single_float
when single float ABI is selected.

Modified:
    cfe/trunk/lib/Basic/Targets.cpp
    cfe/trunk/test/Preprocessor/init.c

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=157996&r1=157995&r2=157996&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Tue Jun  5 08:06:56 2012
@@ -3530,14 +3530,15 @@
 
   virtual void getArchDefines(const LangOptions &Opts,
                               MacroBuilder &Builder) const {
-    if (SoftFloat)
+    if (SoftFloat && SingleFloat)
+      llvm_unreachable("Invalid float ABI for Mips.");
+    else if (SoftFloat)
       Builder.defineMacro("__mips_soft_float", Twine(1));
-    else if (SingleFloat)
-      Builder.defineMacro("__mips_single_float", Twine(1));
-    else if (!SoftFloat && !SingleFloat)
+    else {
       Builder.defineMacro("__mips_hard_float", Twine(1));
-    else
-      llvm_unreachable("Invalid float ABI for Mips.");
+      if (SingleFloat)
+        Builder.defineMacro("__mips_single_float", Twine(1));
+    }
 
     Builder.defineMacro("_MIPS_SZPTR", Twine(getPointerWidth(0)));
     Builder.defineMacro("_MIPS_SZINT", Twine(getIntWidth()));

Modified: cfe/trunk/test/Preprocessor/init.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/init.c?rev=157996&r1=157995&r2=157996&view=diff
==============================================================================
--- cfe/trunk/test/Preprocessor/init.c (original)
+++ cfe/trunk/test/Preprocessor/init.c Tue Jun  5 08:06:56 2012
@@ -873,6 +873,7 @@
 // RUN: %clang_cc1 -target-feature +single-float -E -dM -ffreestanding \
 // RUN:   -triple=mips-none-none < /dev/null \
 // RUN:   | FileCheck -check-prefix MIPS-FABI-SINGLE %s
+// MIPS-FABI-SINGLE:#define __mips_hard_float 1
 // MIPS-FABI-SINGLE:#define __mips_single_float 1
 //
 // RUN: %clang_cc1 -E -dM -ffreestanding -triple=msp430-none-none < /dev/null | FileCheck -check-prefix MSP430 %s





More information about the cfe-commits mailing list