From d797a85866fd5ce62850dd145396b451364032a3 Mon Sep 17 00:00:00 2001 From: Simon Atanasyan Date: Thu, 5 Jul 2012 19:23:00 +0000 Subject: [PATCH] MIPS: Add -mdsp/-mno-dsp and -mdspr2/-mno-dspr2 command line options support. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159769 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Driver/Options.td | 4 ++++ lib/Basic/Targets.cpp | 2 +- lib/Driver/Tools.cpp | 6 ++++++ test/Driver/mips-features.c | 24 ++++++++++++++++++++++++ 4 files changed, 35 insertions(+), 1 deletion(-) diff --git a/include/clang/Driver/Options.td b/include/clang/Driver/Options.td index 496683307b..4d23f47d85 100644 --- a/include/clang/Driver/Options.td +++ b/include/clang/Driver/Options.td @@ -848,6 +848,10 @@ def mpopcnt : Flag<"-mpopcnt">, Group; def mfma4 : Flag<"-mfma4">, Group; def mips16 : Flag<"-mips16">, Group; def mno_mips16 : Flag<"-mno-mips16">, Group; +def mdsp : Flag<"-mdsp">, Group; +def mno_dsp : Flag<"-mno-dsp">, Group; +def mdspr2 : Flag<"-mdspr2">, Group; +def mno_dspr2 : Flag<"-mno-dspr2">, Group; def mthumb : Flag<"-mthumb">, Group; def mtune_EQ : Joined<"-mtune=">, Group; def multi__module : Flag<"-multi_module">; diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index 3eaa65177c..42f5d63cc3 100644 --- a/lib/Basic/Targets.cpp +++ b/lib/Basic/Targets.cpp @@ -3719,7 +3719,7 @@ public: Name == "o32" || Name == "n32" || Name == "n64" || Name == "eabi" || Name == "mips32" || Name == "mips32r2" || Name == "mips64" || Name == "mips64r2" || - Name == "mips16") { + Name == "mips16" || Name == "dsp" || Name == "dspr2") { Features[Name] = Enabled; return true; } diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index a4153515de..98beb2234a 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -937,6 +937,12 @@ void Clang::AddMIPSTargetArgs(const ArgList &Args, AddTargetFeature(Args, CmdArgs, options::OPT_mips16, options::OPT_mno_mips16, "mips16"); + AddTargetFeature(Args, CmdArgs, + options::OPT_mdsp, options::OPT_mno_dsp, + "dsp"); + AddTargetFeature(Args, CmdArgs, + options::OPT_mdspr2, options::OPT_mno_dspr2, + "dspr2"); } /// getPPCTargetCPU - Get the (LLVM) name of the PowerPC cpu we are targeting. diff --git a/test/Driver/mips-features.c b/test/Driver/mips-features.c index 038b718098..e5f735e571 100644 --- a/test/Driver/mips-features.c +++ b/test/Driver/mips-features.c @@ -11,3 +11,27 @@ // RUN: -mips16 -mno-mips16 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-NOMIPS16 %s // CHECK-NOMIPS16: "-target-feature" "-mips16" +// +// -mdsp +// RUN: %clang -target mips-linux-gnu -### -c %s \ +// RUN: -mno-dsp -mdsp 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-MDSP %s +// CHECK-MDSP: "-target-feature" "+dsp" +// +// -mno-dsp +// RUN: %clang -target mips-linux-gnu -### -c %s \ +// RUN: -mdsp -mno-dsp 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-NOMDSP %s +// CHECK-NOMDSP: "-target-feature" "-dsp" +// +// -mdspr2 +// RUN: %clang -target mips-linux-gnu -### -c %s \ +// RUN: -mno-dspr2 -mdspr2 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-MDSPR2 %s +// CHECK-MDSPR2: "-target-feature" "+dspr2" +// +// -mno-dspr2 +// RUN: %clang -target mips-linux-gnu -### -c %s \ +// RUN: -mdspr2 -mno-dspr2 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-NOMDSPR2 %s +// CHECK-NOMDSPR2: "-target-feature" "-dspr2" -- 2.40.0