diff options
author | Simon Atanasyan <simon@atanasyan.com> | 2013-04-14 08:37:15 +0000 |
---|---|---|
committer | Simon Atanasyan <simon@atanasyan.com> | 2013-04-14 08:37:15 +0000 |
commit | 2ed42b86da17b8fc54480bf34e1965e20eee89f5 (patch) | |
tree | d683ac9a3f38eac277199c84472af60a6c00bf98 | |
parent | 67cd74ec17e6061d70d38d48b7c56ce448063f35 (diff) |
[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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179481 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/Driver/Options.td | 2 | ||||
-rw-r--r-- | lib/Driver/Tools.cpp | 18 | ||||
-rw-r--r-- | test/Driver/mips-float.c | 19 |
3 files changed, 30 insertions, 9 deletions
diff --git a/include/clang/Driver/Options.td b/include/clang/Driver/Options.td index af983207fc..881353e386 100644 --- a/include/clang/Driver/Options.td +++ b/include/clang/Driver/Options.td @@ -963,6 +963,8 @@ def mdsp : Flag<["-"], "mdsp">, Group<m_Group>; 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>, diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 7cec709541..c144a588ac 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -911,7 +911,7 @@ static StringRef getMipsFloatABI(const Driver &D, const ArgList &Args) { 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 ArgList &Args, 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 ArgList &Args, 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"); diff --git a/test/Driver/mips-float.c b/test/Driver/mips-float.c index 5c16b9b063..b52dad3dbe 100644 --- a/test/Driver/mips-float.c +++ b/test/Driver/mips-float.c @@ -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 \ |