MIPS: improve Loongson-2E/2F/3A detection for -march=native
diff mbox

Message ID 1389334938-14157-1-git-send-email-chenhc@lemote.com
State New
Headers show

Commit Message

=?utf-8?B?6ZmI5Y2O5omN?= Jan. 10, 2014, 6:22 a.m. UTC
Hi all,

For human-readability, I submit a patch to Linux kernel to display
Loongson-2E/2F/3A in /proc/cpuinfo. But that break -march=native, this
patch fix that.

Regards,

Huacai

2014-01-10  Huacai Chen  <chenhc@lemote.com>

	* config/mips/driver-native.c: improve Loongson-2E/2F/3A detection

---
 gcc/config/mips/driver-native.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Comments

Richard Sandiford Jan. 10, 2014, 8:54 a.m. UTC | #1
Huacai Chen <chenhc@lemote.com> writes:
> For human-readability, I submit a patch to Linux kernel to display
> Loongson-2E/2F/3A in /proc/cpuinfo. But that break -march=native, this
> patch fix that.

Thanks, applied to trunk, 4.8 and 4.7 with a minor formatting tweak.

Richard

Patch
diff mbox

diff --git a/gcc/config/mips/driver-native.c b/gcc/config/mips/driver-native.c
index 3f1a8d0..63848d2 100644
--- a/gcc/config/mips/driver-native.c
+++ b/gcc/config/mips/driver-native.c
@@ -58,11 +58,17 @@  host_detect_local_cpu (int argc, const char **argv)
     if (strncmp (buf, "cpu model", sizeof ("cpu model") - 1) == 0)
       {
 	if (strstr (buf, "Godson2 V0.2") != NULL
-	    || strstr (buf, "Loongson-2 V0.2") != NULL)
+		 || strstr (buf, "Loongson-2 V0.2") != NULL
+		 || strstr (buf, "Loongson-2E") != NULL)
 	  cpu = "loongson2e";
 	else if (strstr (buf, "Godson2 V0.3") != NULL
-		 || strstr (buf, "Loongson-2 V0.3") != NULL)
+		 || strstr (buf, "Loongson-2 V0.3") != NULL
+		 || strstr (buf, "Loongson-2F") != NULL)
 	  cpu = "loongson2f";
+	else if (strstr (buf, "Godson3 V0.5") != NULL
+		 || strstr (buf, "Loongson-3 V0.5") != NULL
+		 || strstr (buf, "Loongson-3A") != NULL)
+	  cpu = "loongson3a";
 	else if (strstr (buf, "SiByte SB1") != NULL)
 	  cpu = "sb1";
 	else if (strstr (buf, "R5000") != NULL)