From 0ef0516836e9f3918c51602ae86816750dbed5f2 Mon Sep 17 00:00:00 2001 From: mm Date: Wed, 16 Mar 2011 12:40:58 +0000 Subject: Fix -march/-mtune=native autodetection for Intel Core 2 CPUs Obtained from: gcc 4.3 (partial rev. 119454; GPLv2) MFC after: 2 weeks --- contrib/gcc/config/i386/driver-i386.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/contrib/gcc/config/i386/driver-i386.c b/contrib/gcc/config/i386/driver-i386.c index ffcee4e..cb9c6c3 100644 --- a/contrib/gcc/config/i386/driver-i386.c +++ b/contrib/gcc/config/i386/driver-i386.c @@ -39,6 +39,7 @@ const char *host_detect_local_cpu (int argc, const char **argv); #define bit_SSE2 (1 << 26) #define bit_SSE3 (1 << 0) +#define bit_SSSE3 (1 << 9) #define bit_CMPXCHG16B (1 << 13) #define bit_3DNOW (1 << 31) @@ -66,7 +67,7 @@ const char *host_detect_local_cpu (int argc, const char **argv) unsigned int vendor; unsigned int ext_level; unsigned char has_mmx = 0, has_3dnow = 0, has_3dnowp = 0, has_sse = 0; - unsigned char has_sse2 = 0, has_sse3 = 0, has_cmov = 0; + unsigned char has_sse2 = 0, has_sse3 = 0, has_ssse3 = 0, has_cmov = 0; unsigned char has_longmode = 0, has_cmpxchg8b = 0; unsigned char is_amd = 0; unsigned int family = 0; @@ -107,6 +108,7 @@ const char *host_detect_local_cpu (int argc, const char **argv) has_sse = !!(edx & bit_SSE); has_sse2 = !!(edx & bit_SSE2); has_sse3 = !!(ecx & bit_SSE3); + has_ssse3 = !!(ecx & bit_SSSE3); /* We don't care for extended family. */ family = (eax >> 8) & ~(1 << 4); @@ -148,7 +150,9 @@ const char *host_detect_local_cpu (int argc, const char **argv) /* We have no idea. Use something reasonable. */ if (arch) { - if (has_sse3) + if (has_ssse3) + cpu = "core2"; + else if (has_sse3) { if (has_longmode) cpu = "nocona"; @@ -230,6 +234,9 @@ const char *host_detect_local_cpu (int argc, const char **argv) cpu = "generic"; } break; + case PROCESSOR_GEODE: + cpu = "geode"; + break; case PROCESSOR_K6: if (has_3dnow) cpu = "k6-3"; -- cgit v1.1