This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH: Support -march=native on Intel Atom
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: ubizjak at gmail dot com
- Date: Tue, 19 May 2009 14:09:17 -0700
- Subject: PATCH: Support -march=native on Intel Atom
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
Hi,
Intel Atom has cpu family 6 and model 28:
http://www.sandpile.org/ia32/cpuid.htm
This patch adds Intel Atom support for -march=native. Tested on Atom,
Core 2 and Core i7. OK for trunk?
Thanks.
H.J.
---
2009-05-19 H.J. Lu <hongjiu.lu@intel.com>
* config/i386/driver-i386.c (host_detect_local_cpu): Check
extended family and model for Intel processors. Support Intel
Atom.
--- gcc/config/i386/driver-i386.c.atom 2009-05-14 17:21:57.000000000 -0700
+++ gcc/config/i386/driver-i386.c 2009-05-19 14:02:15.000000000 -0700
@@ -370,7 +370,7 @@ const char *host_detect_local_cpu (int a
unsigned int max_level, ext_level;
unsigned int vendor;
- unsigned int model, family;
+ unsigned int model, family, extended_model, extended_family;
unsigned int has_sse3, has_ssse3, has_cmpxchg16b;
unsigned int has_cmpxchg8b, has_cmov, has_mmx, has_sse, has_sse2;
@@ -395,9 +395,10 @@ const char *host_detect_local_cpu (int a
__cpuid (1, eax, ebx, ecx, edx);
- /* We don't care for extended family. */
model = (eax >> 4) & 0x0f;
family = (eax >> 8) & 0x0f;
+ extended_model = (eax >> 12) & 0xf0;
+ extended_family = (eax >> 20) & 0xff;
has_sse3 = ecx & bit_SSE3;
has_ssse3 = ecx & bit_SSSE3;
@@ -460,6 +461,17 @@ const char *host_detect_local_cpu (int a
}
else
{
+ if (vendor == SIG_INTEL)
+ {
+ if (family == 0x0f)
+ {
+ family += extended_family;
+ model += extended_model;
+ }
+ else if (family == 0x06)
+ model += extended_model;
+ }
+
switch (family)
{
case 4:
@@ -496,8 +508,8 @@ const char *host_detect_local_cpu (int a
break;
case PROCESSOR_PENTIUMPRO:
if (has_longmode)
- /* It is Core 2 Duo. */
- cpu = "core2";
+ /* It is Core 2 or Atom. */
+ cpu = (model == 28) ? "atom" : "core2";
else if (arch)
{
if (has_sse3)