aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Atanasyan <simon@atanasyan.com>2014-07-04 12:36:56 +0000
committerSimon Atanasyan <simon@atanasyan.com>2014-07-04 12:36:56 +0000
commit26610c596002cb74294dae275ddf790655e83cee (patch)
tree0edd6b9a4132e057e12ba1040f66589605e23bd8
parent3c5b12623952a50d25b9ab9fe14ab5c59bb7b35b (diff)
downloadllvm-26610c596002cb74294dae275ddf790655e83cee.zip
llvm-26610c596002cb74294dae275ddf790655e83cee.tar.gz
llvm-26610c596002cb74294dae275ddf790655e83cee.tar.bz2
[Driver][Mips] Support more MIPS CPU names: mips1 - mips5.
llvm-svn: 212338
-rw-r--r--clang/include/clang/Driver/Options.td15
-rw-r--r--clang/lib/Basic/Targets.cpp5
-rw-r--r--clang/test/Driver/mips-abi.c30
-rw-r--r--clang/test/Driver/mips-as.c25
4 files changed, 75 insertions, 0 deletions
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 6569858..d0cccb6 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -1213,6 +1213,21 @@ def mfp64 : Flag<["-"], "mfp64">, Group<m_Group>,
def mfp32 : Flag<["-"], "mfp32">, Group<m_Group>,
HelpText<"Use 32-bit floating point registers (MIPS only)">;
def mnan_EQ : Joined<["-"], "mnan=">, Group<m_Group>;
+def mips1 : Flag<["-"], "mips1">,
+ Alias<march_EQ>, AliasArgs<["mips1"]>,
+ HelpText<"Equivalent to -march=mips1">, Flags<[HelpHidden]>;
+def mips2 : Flag<["-"], "mips2">,
+ Alias<march_EQ>, AliasArgs<["mips2"]>,
+ HelpText<"Equivalent to -march=mips2">, Flags<[HelpHidden]>;
+def mips3 : Flag<["-"], "mips3">,
+ Alias<march_EQ>, AliasArgs<["mips3"]>,
+ HelpText<"Equivalent to -march=mips3">, Flags<[HelpHidden]>;
+def mips4 : Flag<["-"], "mips4">,
+ Alias<march_EQ>, AliasArgs<["mips4"]>,
+ HelpText<"Equivalent to -march=mips4">, Flags<[HelpHidden]>;
+def mips5 : Flag<["-"], "mips5">,
+ Alias<march_EQ>, AliasArgs<["mips5"]>,
+ HelpText<"Equivalent to -march=mips5">, Flags<[HelpHidden]>;
def mips32 : Flag<["-"], "mips32">,
Alias<march_EQ>, AliasArgs<["mips32"]>,
HelpText<"Equivalent to -march=mips32">, Flags<[HelpHidden]>;
diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp
index 81a0003..9e3686b 100644
--- a/clang/lib/Basic/Targets.cpp
+++ b/clang/lib/Basic/Targets.cpp
@@ -5309,6 +5309,11 @@ public:
getTriple().getArch() == llvm::Triple::mipsel;
CPU = Name;
return llvm::StringSwitch<bool>(Name)
+ .Case("mips1", IsMips32)
+ .Case("mips2", IsMips32)
+ .Case("mips3", true)
+ .Case("mips4", true)
+ .Case("mips5", true)
.Case("mips32", IsMips32)
.Case("mips32r2", IsMips32)
.Case("mips32r6", IsMips32)
diff --git a/clang/test/Driver/mips-abi.c b/clang/test/Driver/mips-abi.c
index c17a4be..f58ba0e 100644
--- a/clang/test/Driver/mips-abi.c
+++ b/clang/test/Driver/mips-abi.c
@@ -57,6 +57,36 @@
// MIPS-ABI-UNKNOWN: error: unknown target ABI 'unknown'
//
// RUN: %clang -target mips-linux-gnu -### -c %s \
+// RUN: -march=mips1 2>&1 \
+// RUN: | FileCheck -check-prefix=MIPS-ARCH-1 %s
+// MIPS-ARCH-1: "-target-cpu" "mips1"
+// MIPS-ARCH-1: "-target-abi" "o32"
+//
+// RUN: %clang -target mips-linux-gnu -### -c %s \
+// RUN: -march=mips2 2>&1 \
+// RUN: | FileCheck -check-prefix=MIPS-ARCH-2 %s
+// MIPS-ARCH-2: "-target-cpu" "mips2"
+// MIPS-ARCH-2: "-target-abi" "o32"
+//
+// RUN: %clang -target mips-linux-gnu -### -c %s \
+// RUN: -march=mips3 2>&1 \
+// RUN: | FileCheck -check-prefix=MIPS-ARCH-3 %s
+// MIPS-ARCH-3: "-target-cpu" "mips3"
+// MIPS-ARCH-3: "-target-abi" "o32"
+//
+// RUN: %clang -target mips-linux-gnu -### -c %s \
+// RUN: -march=mips4 2>&1 \
+// RUN: | FileCheck -check-prefix=MIPS-ARCH-4 %s
+// MIPS-ARCH-4: "-target-cpu" "mips4"
+// MIPS-ARCH-4: "-target-abi" "o32"
+//
+// RUN: %clang -target mips-linux-gnu -### -c %s \
+// RUN: -march=mips5 2>&1 \
+// RUN: | FileCheck -check-prefix=MIPS-ARCH-5 %s
+// MIPS-ARCH-5: "-target-cpu" "mips5"
+// MIPS-ARCH-5: "-target-abi" "o32"
+//
+// RUN: %clang -target mips-linux-gnu -### -c %s \
// RUN: -march=mips32 2>&1 \
// RUN: | FileCheck -check-prefix=MIPS-ARCH-32 %s
// MIPS-ARCH-32: "-target-cpu" "mips32"
diff --git a/clang/test/Driver/mips-as.c b/clang/test/Driver/mips-as.c
index cf85978..27517ac 100644
--- a/clang/test/Driver/mips-as.c
+++ b/clang/test/Driver/mips-as.c
@@ -52,6 +52,31 @@
// RUN: | FileCheck -check-prefix=MIPS-32R2 %s
// MIPS-32R2: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-EB"
//
+// RUN: %clang -target mips-linux-gnu -mips1 -### \
+// RUN: -no-integrated-as -c %s 2>&1 \
+// RUN: | FileCheck -check-prefix=MIPS-ALIAS-1 %s
+// MIPS-ALIAS-1: as{{(.exe)?}}" "-march" "mips1" "-mabi" "32" "-EB"
+//
+// RUN: %clang -target mips-linux-gnu -mips2 -### \
+// RUN: -no-integrated-as -c %s 2>&1 \
+// RUN: | FileCheck -check-prefix=MIPS-ALIAS-2 %s
+// MIPS-ALIAS-2: as{{(.exe)?}}" "-march" "mips2" "-mabi" "32" "-EB"
+//
+// RUN: %clang -target mips-linux-gnu -mips3 -### \
+// RUN: -no-integrated-as -c %s 2>&1 \
+// RUN: | FileCheck -check-prefix=MIPS-ALIAS-3 %s
+// MIPS-ALIAS-3: as{{(.exe)?}}" "-march" "mips3" "-mabi" "32" "-EB"
+//
+// RUN: %clang -target mips-linux-gnu -mips4 -### \
+// RUN: -no-integrated-as -c %s 2>&1 \
+// RUN: | FileCheck -check-prefix=MIPS-ALIAS-4 %s
+// MIPS-ALIAS-4: as{{(.exe)?}}" "-march" "mips4" "-mabi" "32" "-EB"
+//
+// RUN: %clang -target mips-linux-gnu -mips5 -### \
+// RUN: -no-integrated-as -c %s 2>&1 \
+// RUN: | FileCheck -check-prefix=MIPS-ALIAS-5 %s
+// MIPS-ALIAS-5: as{{(.exe)?}}" "-march" "mips5" "-mabi" "32" "-EB"
+//
// RUN: %clang -target mips-linux-gnu -mips32 -### \
// RUN: -no-integrated-as -c %s 2>&1 \
// RUN: | FileCheck -check-prefix=MIPS-ALIAS-32 %s