r179481 - [Mips] Remove "single" from the list of valid MIPS float ABI names. Add
Simon Atanasyan
simon at atanasyan.com
Sun Apr 14 01:37:16 PDT 2013
Author: atanasyan
Date: Sun Apr 14 03:37:15 2013
New Revision: 179481
URL: http://llvm.org/viewvc/llvm-project?rev=179481&view=rev
Log:
[Mips] Remove "single" from the list of valid MIPS float ABI names. Add
two new options –msingle-float and –mdouble-float. These options can be
used simultaneously with float ABI selection options (-mfloat-abi,
-mhard-float, -msoft-float). They mark whether a floating-point
coprocessor supports double-precision operations.
Modified:
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/mips-float.c
Modified: cfe/trunk/include/clang/Driver/Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=179481&r1=179480&r2=179481&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Sun Apr 14 03:37:15 2013
@@ -963,6 +963,8 @@ def mdsp : Flag<["-"], "mdsp">, Group<m_
def mno_dsp : Flag<["-"], "mno-dsp">, Group<m_Group>;
def mdspr2 : Flag<["-"], "mdspr2">, Group<m_Group>;
def mno_dspr2 : Flag<["-"], "mno-dspr2">, Group<m_Group>;
+def msingle_float : Flag<["-"], "msingle-float">, Group<m_Group>;
+def mdouble_float : Flag<["-"], "mdouble-float">, Group<m_Group>;
def mips32 : Flag<["-"], "mips32">, Group<mips_CPUs_Group>,
HelpText<"Equivalent to -march=mips32">, Flags<[HelpHidden]>;
def mips32r2 : Flag<["-"], "mips32r2">, Group<mips_CPUs_Group>,
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=179481&r1=179480&r2=179481&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Sun Apr 14 03:37:15 2013
@@ -911,7 +911,7 @@ static StringRef getMipsFloatABI(const D
FloatABI = "hard";
else {
FloatABI = A->getValue();
- if (FloatABI != "soft" && FloatABI != "single" && FloatABI != "hard") {
+ if (FloatABI != "soft" && FloatABI != "hard") {
D.Diag(diag::err_drv_invalid_mfloat_abi) << A->getAsString(Args);
FloatABI = "hard";
}
@@ -977,12 +977,6 @@ void Clang::AddMIPSTargetArgs(const ArgL
CmdArgs.push_back("-mips16-hard-float");
}
}
- else if (FloatABI == "single") {
- // Restrict the use of hardware floating-point
- // instructions to 32-bit operations.
- CmdArgs.push_back("-target-feature");
- CmdArgs.push_back("+single-float");
- }
else {
// Floating point operations and argument passing are hard.
assert(FloatABI == "hard" && "Invalid float abi!");
@@ -990,6 +984,16 @@ void Clang::AddMIPSTargetArgs(const ArgL
CmdArgs.push_back("hard");
}
+ if (Arg *A = Args.getLastArg(options::OPT_msingle_float,
+ options::OPT_mdouble_float)) {
+ if (A->getOption().matches(options::OPT_msingle_float)) {
+ // Restrict the use of hardware floating-point
+ // instructions to 32-bit operations.
+ CmdArgs.push_back("-target-feature");
+ CmdArgs.push_back("+single-float");
+ }
+ }
+
AddTargetFeature(Args, CmdArgs,
options::OPT_mips16, options::OPT_mno_mips16,
"mips16");
Modified: cfe/trunk/test/Driver/mips-float.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mips-float.c?rev=179481&r1=179480&r2=179481&view=diff
==============================================================================
--- cfe/trunk/test/Driver/mips-float.c (original)
+++ cfe/trunk/test/Driver/mips-float.c Sun Apr 14 03:37:15 2013
@@ -36,12 +36,27 @@
// CHECK-ABI-SOFT: "-mfloat-abi" "soft"
// CHECK-ABI-SOFT: "-target-feature" "+soft-float"
//
-// -mfloat-abi=single
+// -mdouble-float
// RUN: %clang -c %s -### -o %t.o 2>&1 \
-// RUN: -target mips-linux-gnu -mfloat-abi=single \
+// RUN: -target mips-linux-gnu -msingle-float -mdouble-float \
+// RUN: | FileCheck --check-prefix=CHECK-ABI-DOUBLE %s
+// CHECK-ABI-DOUBLE: "-mfloat-abi" "hard"
+// CHECK-ABI-DOUBLE-NOT: "+single-float"
+//
+// -msingle-float
+// RUN: %clang -c %s -### -o %t.o 2>&1 \
+// RUN: -target mips-linux-gnu -mdouble-float -msingle-float \
// RUN: | FileCheck --check-prefix=CHECK-ABI-SINGLE %s
+// CHECK-ABI-SINGLE: "-mfloat-abi" "hard"
// CHECK-ABI-SINGLE: "-target-feature" "+single-float"
//
+// -msoft-float -msingle-float
+// RUN: %clang -c %s -### -o %t.o 2>&1 \
+// RUN: -target mips-linux-gnu -msoft-float -msingle-float \
+// RUN: | FileCheck --check-prefix=CHECK-ABI-SOFT-SINGLE %s
+// CHECK-ABI-SOFT-SINGLE: "-mfloat-abi" "soft"
+// CHECK-ABI-SOFT-SINGLE: "-target-feature" "+single-float"
+//
// Default -mips16
// RUN: %clang -c %s -### -o %t.o 2>&1 \
// RUN: -target mips-linux-gnu -mips16 \
More information about the cfe-commits
mailing list