From 2e9427a175cf47b4f812a930fc43398c15a4adcf Mon Sep 17 00:00:00 2001 From: Daniel Sanders Date: Wed, 16 Jul 2014 09:57:54 +0000 Subject: [PATCH] [mips] Add support for -mfpxx and -mno-fpxx. Differential Revision: http://reviews.llvm.org/D4464 llvm-svn: 213132 --- clang/include/clang/Driver/Options.td | 3 +++ clang/lib/Driver/Tools.cpp | 4 ++++ clang/test/Driver/mips-features.c | 12 ++++++++++++ 3 files changed, 19 insertions(+) diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 1eb5e44d..1c3f33f 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -1261,6 +1261,9 @@ def mips64r2 : Flag<["-"], "mips64r2">, def mips64r6 : Flag<["-"], "mips64r6">, Alias, AliasArgs<["mips64r6"]>, HelpText<"Equivalent to -march=mips64r6">, Flags<[HelpHidden]>; +def mfpxx : Flag<["-"], "mfpxx">, Group, + HelpText<"Avoid FPU mode dependent operations when used with the O32 ABI">, + Flags<[HelpHidden]>; def modd_spreg : Flag<["-"], "modd-spreg">, Group, HelpText<"Enable odd single-precision floating point registers">, Flags<[HelpHidden]>; diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index 8b8da30..b66d78a 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -1058,6 +1058,10 @@ static void getMIPSTargetFeatures(const Driver &D, const ArgList &Args, "msa"); AddTargetFeature(Args, Features, options::OPT_mfp64, options::OPT_mfp32, "fp64"); + if (Args.getLastArg(options::OPT_mfpxx)) { + Features.push_back(Args.MakeArgString("+fpxx")); + Features.push_back(Args.MakeArgString("+nooddspreg")); + } AddTargetFeature(Args, Features, options::OPT_mno_odd_spreg, options::OPT_modd_spreg, "nooddspreg"); } diff --git a/clang/test/Driver/mips-features.c b/clang/test/Driver/mips-features.c index 2abb632..03cc0fd 100644 --- a/clang/test/Driver/mips-features.c +++ b/clang/test/Driver/mips-features.c @@ -70,6 +70,18 @@ // RUN: | FileCheck --check-prefix=CHECK-NOMODDSPREG %s // CHECK-NOMODDSPREG: "-target-feature" "+nooddspreg" // +// -mfpxx +// RUN: %clang -target mips-linux-gnu -### -c %s -mfpxx 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-MFPXX %s +// CHECK-MFPXX: "-target-feature" "+fpxx" +// CHECK-MFPXX: "-target-feature" "+nooddspreg" +// +// -mfpxx -modd-spreg +// RUN: %clang -target mips-linux-gnu -### -c %s -mfpxx -modd-spreg 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-MFPXX-ODDSPREG %s +// CHECK-MFPXX-ODDSPREG: "-target-feature" "+fpxx" +// CHECK-MFPXX-ODDSPREG: "-target-feature" "-nooddspreg" +// // -mfp64 // RUN: %clang -target mips-linux-gnu -### -c %s \ // RUN: -mfp32 -mfp64 2>&1 \ -- 2.7.4