aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorH.J. Lu <hongjiu.lu@intel.com>2010-05-09 14:49:53 +0000
committerH.J. Lu <hjl@gcc.gnu.org>2010-05-09 07:49:53 -0700
commit44f276c65fc93a5ced092eca774c772cb10acd66 (patch)
treedf151a95b5b56de5c0eb492bcccef6b6b11eefe6 /gcc
parentd6205185769eaf5898405d2883f4ee38a519b4d4 (diff)
downloadgcc-44f276c65fc93a5ced092eca774c772cb10acd66.zip
gcc-44f276c65fc93a5ced092eca774c772cb10acd66.tar.gz
gcc-44f276c65fc93a5ced092eca774c772cb10acd66.tar.bz2
Properly detect Atom, Core 2 and Core i7.
2010-05-09 H.J. Lu <hongjiu.lu@intel.com> PR target/44046 * config/i386/driver-i386.c (host_detect_local_cpu): Properly detect Atom, Core 2 and Core i7. From-SVN: r159202
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/i386/driver-i386.c77
2 files changed, 58 insertions, 25 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index bd64d9d..3a9d1f9 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2010-05-09 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/44046
+ * config/i386/driver-i386.c (host_detect_local_cpu): Properly
+ detect Atom, Core 2 and Core i7.
+
2010-05-09 Richard Guenther <rguenther@suse.de>
* gcc.c (store_arg): Handle temporary file deletion for
diff --git a/gcc/config/i386/driver-i386.c b/gcc/config/i386/driver-i386.c
index 17694ef..063279a 100644
--- a/gcc/config/i386/driver-i386.c
+++ b/gcc/config/i386/driver-i386.c
@@ -538,34 +538,61 @@ const char *host_detect_local_cpu (int argc, const char **argv)
cpu = "pentium";
break;
case PROCESSOR_PENTIUMPRO:
- if (model == 28)
- cpu = "atom";
- else if (model >= 28 && l2sizekb < 2048)
- /* Assume it's a small core if there's less than 2MB cache */
- cpu = "atom";
- else if (has_longmode)
- cpu = "core2";
- else if (arch)
+ switch (model)
{
- if (has_sse3)
- /* It is Core Duo. */
- cpu = "pentium-m";
- else if (has_sse2)
- /* It is Pentium M. */
- cpu = "pentium-m";
- else if (has_sse)
- /* It is Pentium III. */
- cpu = "pentium3";
- else if (has_mmx)
- /* It is Pentium II. */
- cpu = "pentium2";
+ case 0x1c:
+ case 0x26:
+ /* Atom. */
+ cpu = "atom";
+ break;
+ case 0x1a:
+ case 0x1e:
+ case 0x1f:
+ case 0x2e:
+ /* FIXME: Optimize for Nehalem. */
+ cpu = "core2";
+ break;
+ case 0x25:
+ case 0x2f:
+ /* FIXME: Optimize for Westmere. */
+ cpu = "core2";
+ break;
+ case 0x17:
+ case 0x1d:
+ /* Penryn. FIXME: -mtune=core2 is slower than -mtune=generic */
+ cpu = "core2";
+ break;
+ case 0x0f:
+ /* Merom. FIXME: -mtune=core2 is slower than -mtune=generic */
+ cpu = "core2";
+ break;
+ default:
+ if (arch)
+ {
+ if (has_ssse3)
+ /* If it is an unknown CPU with SSSE3, assume Core 2. */
+ cpu = "core2";
+ else if (has_sse3)
+ /* It is Core Duo. */
+ cpu = "pentium-m";
+ else if (has_sse2)
+ /* It is Pentium M. */
+ cpu = "pentium-m";
+ else if (has_sse)
+ /* It is Pentium III. */
+ cpu = "pentium3";
+ else if (has_mmx)
+ /* It is Pentium II. */
+ cpu = "pentium2";
+ else
+ /* Default to Pentium Pro. */
+ cpu = "pentiumpro";
+ }
else
- /* Default to Pentium Pro. */
- cpu = "pentiumpro";
+ /* For -mtune, we default to -mtune=generic. */
+ cpu = "generic";
+ break;
}
- else
- /* For -mtune, we default to -mtune=generic. */
- cpu = "generic";
break;
case PROCESSOR_PENTIUM4:
if (has_sse3)