* [PATCH, i386]: Fix PR67310, gcc fails to compile with -march=native on VIA nano CPU
@ 2016-06-01 13:57 Uros Bizjak
0 siblings, 0 replies; only message in thread
From: Uros Bizjak @ 2016-06-01 13:57 UTC (permalink / raw)
To: J. Mayer; +Cc: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 1144 bytes --]
Hello!
Attached patch fixes the buggy part of PR67310, where VIA CPU is
detected incorrectly, and: "-march=core2 -mtune=i386" is passed from
the driver to the compiler.
The patched driver now emits "-march=core2 -mtune=generic", since the
driver handles VIA target through "Use something reasonable" part, as
there are no entries for VIA CPUs in processor alias tables. This will
be added in a follow-up patch.
2016-06-01 Uros Bizjak <ubizjak@gmail.com>
Jocelyn Mayer <l_indien@magic.fr>
PR target/67310
* config/i386/driver-i386.c (host_detect_local_cpu): Correctly
detect processor family for signature_CENTAUR_ebx.
<case PROCESSOR_I486>: Pass c3, winchip2 or winchip-c6 for
signature_CENTAUR_ebx.
<case PROCESSOR _PENTIUMPRO>: Pass c3-2 for signature_CENTAUR_ebx.
<default>: Pass x86-64 for has_longmode.
Patch was bootstrapped and regression tested on x86_64-linux-gnu
{,-m32}. The patch was also tested by Jocelyn on VIA target.
Patch was committed to mainline SVN. Since attached patch fixes a bug,
it will be backported after a week or so without problems to other
release branches.
Uros.
[-- Attachment #2: p.diff.txt --]
[-- Type: text/plain, Size: 2615 bytes --]
Index: driver-i386.c
===================================================================
--- driver-i386.c (revision 236927)
+++ driver-i386.c (working copy)
@@ -637,33 +637,27 @@ const char *host_detect_local_cpu (int argc, const
}
else if (vendor == signature_CENTAUR_ebx)
{
- if (arch)
+ processor = PROCESSOR_GENERIC;
+
+ switch (family)
{
- switch (family)
- {
- case 6:
- if (model > 9)
- /* Use the default detection procedure. */
- processor = PROCESSOR_GENERIC;
- else if (model == 9)
- cpu = "c3-2";
- else if (model >= 6)
- cpu = "c3";
- else
- processor = PROCESSOR_GENERIC;
- break;
- case 5:
- if (has_3dnow)
- cpu = "winchip2";
- else if (has_mmx)
- cpu = "winchip2-c6";
- else
- processor = PROCESSOR_GENERIC;
- break;
- default:
- /* We have no idea. */
- processor = PROCESSOR_GENERIC;
- }
+ default:
+ /* We have no idea. */
+ break;
+
+ case 5:
+ if (has_3dnow || has_mmx)
+ processor = PROCESSOR_I486;
+ break;
+
+ case 6:
+ if (model > 9 || has_longmode)
+ /* Use the default detection procedure. */
+ ;
+ else if (model == 9)
+ processor = PROCESSOR_PENTIUMPRO;
+ else if (model >= 6)
+ processor = PROCESSOR_I486;
}
}
else
@@ -694,7 +688,18 @@ const char *host_detect_local_cpu (int argc, const
/* Default. */
break;
case PROCESSOR_I486:
- cpu = "i486";
+ if (arch && vendor == signature_CENTAUR_ebx)
+ {
+ if (model >= 6)
+ cpu = "c3";
+ else if (has_3dnow)
+ cpu = "winchip2";
+ else
+ /* Assume WinChip C6. */
+ cpu = "winchip-c6";
+ }
+ else
+ cpu = "i486";
break;
case PROCESSOR_PENTIUM:
if (arch && has_mmx)
@@ -817,8 +822,13 @@ const char *host_detect_local_cpu (int argc, const
/* It is Pentium M. */
cpu = "pentium-m";
else if (has_sse)
- /* It is Pentium III. */
- cpu = "pentium3";
+ {
+ if (vendor == signature_CENTAUR_ebx)
+ cpu = "c3-2";
+ else
+ /* It is Pentium III. */
+ cpu = "pentium3";
+ }
else if (has_mmx)
/* It is Pentium II. */
cpu = "pentium2";
@@ -902,6 +912,11 @@ const char *host_detect_local_cpu (int argc, const
else
cpu = "prescott";
}
+ else if (has_longmode)
+ /* Perhaps some emulator? Assume x86-64, otherwise gcc
+ -march=native would be unusable for 64-bit compilations,
+ as all the CPUs below are 32-bit only. */
+ cpu = "x86-64";
else if (has_sse2)
cpu = "pentium4";
else if (has_cmov)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-06-01 13:57 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-01 13:57 [PATCH, i386]: Fix PR67310, gcc fails to compile with -march=native on VIA nano CPU Uros Bizjak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).