[cfe-commits] r172062 - in /cfe/trunk: lib/Driver/Tools.cpp test/Driver/mips-float.c

Simon Atanasyan satanasyan at mips.com
Thu Jan 10 04:36:19 PST 2013


Author: atanasyan
Date: Thu Jan 10 06:36:19 2013
New Revision: 172062

URL: http://llvm.org/viewvc/llvm-project?rev=172062&view=rev
Log:
[Mips] Pass a combination of +soft-float and -mips16-hard-float flags to
the backend if hard float ABI is selected under -mips16 mode.

Modified:
    cfe/trunk/lib/Driver/Tools.cpp
    cfe/trunk/test/Driver/mips-float.c

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=172062&r1=172061&r2=172062&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Thu Jan 10 06:36:19 2013
@@ -958,7 +958,9 @@
 
   StringRef FloatABI = getMipsFloatABI(D, Args);
 
-  if (FloatABI == "soft") {
+  bool IsMips16 = Args.getLastArg(options::OPT_mips16) != NULL;
+
+  if (FloatABI == "soft" || (FloatABI == "hard" && IsMips16)) {
     // Floating point operations and argument passing are soft.
     CmdArgs.push_back("-msoft-float");
     CmdArgs.push_back("-mfloat-abi");
@@ -969,6 +971,11 @@
     // Now it is the only method.
     CmdArgs.push_back("-target-feature");
     CmdArgs.push_back("+soft-float");
+
+    if (FloatABI == "hard" && IsMips16) {
+      CmdArgs.push_back("-mllvm");
+      CmdArgs.push_back("-mips16-hard-float");
+    }
   }
   else if (FloatABI == "single") {
     // Restrict the use of hardware floating-point

Modified: cfe/trunk/test/Driver/mips-float.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mips-float.c?rev=172062&r1=172061&r2=172062&view=diff
==============================================================================
--- cfe/trunk/test/Driver/mips-float.c (original)
+++ cfe/trunk/test/Driver/mips-float.c Thu Jan 10 06:36:19 2013
@@ -41,3 +41,44 @@
 // RUN:     -target mips-linux-gnu -mfloat-abi=single \
 // RUN:   | FileCheck --check-prefix=CHECK-ABI-SINGLE %s
 // CHECK-ABI-SINGLE: "-target-feature" "+single-float"
+//
+// Default -mips16
+// RUN: %clang -c %s -### -o %t.o 2>&1 \
+// RUN:     -target mips-linux-gnu -mips16 \
+// RUN:   | FileCheck --check-prefix=CHECK-DEF-MIPS16 %s
+// CHECK-DEF-MIPS16: "-mfloat-abi" "soft"
+// CHECK-DEF-MIPS16: "-mllvm" "-mips16-hard-float"
+//
+// -mhard-float -mips16
+// RUN: %clang -c %s -### -o %t.o 2>&1 \
+// RUN:     -target mips-linux-gnu -mhard-float -mips16 \
+// RUN:   | FileCheck --check-prefix=CHECK-HARD-MIPS16 %s
+// CHECK-HARD-MIPS16: "-msoft-float"
+// CHECK-HARD-MIPS16: "-mfloat-abi" "soft"
+// CHECK-HARD-MIPS16: "-target-feature" "+soft-float"
+// CHECK-HARD-MIPS16: "-mllvm" "-mips16-hard-float"
+//
+// -msoft-float -mips16
+// RUN: %clang -c %s -### -o %t.o 2>&1 \
+// RUN:     -target mips-linux-gnu -msoft-float -mips16 \
+// RUN:   | FileCheck --check-prefix=CHECK-SOFT-MIPS16 %s
+// CHECK-SOFT-MIPS16: "-msoft-float"
+// CHECK-SOFT-MIPS16: "-mfloat-abi" "soft"
+// CHECK-SOFT-MIPS16: "-target-feature" "+soft-float"
+//
+// -mfloat-abi=hard -mips16
+// RUN: %clang -c %s -### -o %t.o 2>&1 \
+// RUN:     -target mips-linux-gnu -mfloat-abi=hard -mips16 \
+// RUN:   | FileCheck --check-prefix=CHECK-ABI-HARD-MIPS16 %s
+// CHECK-ABI-HARD-MIPS16: "-msoft-float"
+// CHECK-ABI-HARD-MIPS16: "-mfloat-abi" "soft"
+// CHECK-ABI-HARD-MIPS16: "-target-feature" "+soft-float"
+// CHECK-ABI-HARD-MIPS16: "-mllvm" "-mips16-hard-float"
+//
+// -mfloat-abi=soft -mips16
+// RUN: %clang -c %s -### -o %t.o 2>&1 \
+// RUN:     -target mips-linux-gnu -mfloat-abi=soft -mips16 \
+// RUN:   | FileCheck --check-prefix=CHECK-ABI-SOFT-MIPS16 %s
+// CHECK-ABI-SOFT-MIPS16: "-msoft-float"
+// CHECK-ABI-SOFT-MIPS16: "-mfloat-abi" "soft"
+// CHECK-ABI-SOFT-MIPS16: "-target-feature" "+soft-float"





More information about the cfe-commits mailing list