Hello!

Attached patch introduces handling of VIA/Centaur processors with
-march=native compile directive. Comparing to original patch in
PR45359, attached patch handles detection of "unknown" processors via
default detection procedure. I also choose to use generic tuning for
all detected  processors.

2013-05-16  Uros Bizjak  <ubiz...@gmail.com>
        Dzianis Kahanovich  <maha...@eu.by>

    PR target/45359
    PR target/46396
    * config/i386/driver-i386.c (host_detect_local_cpu): Detect
    VIA/Centaur processors and determine their cache parameters
    using detect_caches_amd.

The patch was (compile) tested on x86_64-pc-linux-gnu and committed to
mainline SVN.

According to the PR45359, some other fix regressed the detection of
VIA/Centaur processors in 4.5, so I plan to backport the patch to
release branches.

Uros.
Index: driver-i386.c
===================================================================
--- driver-i386.c       (revision 198977)
+++ driver-i386.c       (working copy)
@@ -517,7 +517,8 @@ const char *host_detect_local_cpu (int argc, const
 
   if (!arch)
     {
-      if (vendor == signature_AMD_ebx)
+      if (vendor == signature_AMD_ebx
+         || vendor == signature_CENTAUR_ebx)
        cache = detect_caches_amd (ext_level);
       else if (vendor == signature_INTEL_ebx)
        {
@@ -560,6 +561,32 @@ const char *host_detect_local_cpu (int argc, const
       else
        processor = PROCESSOR_PENTIUM;
     }
+  else if (vendor == signature_CENTAUR_ebx)
+    {
+      if (arch)
+       {
+         if (family == 6)
+           {
+             if (model > 9)
+               /* Use the default detection procedure.  */
+               processor = PROCESSOR_GENERIC32;
+             else if (model == 9)
+               cpu = "c3-2";
+             else if (model >= 6)
+               cpu = "c3";
+             else
+               /* We have no idea.  */
+               processor = PROCESSOR_GENERIC32;
+           }
+         else if (has_3dnow)
+           cpu = "winchip2";
+         else if (has_mmx)
+           cpu = "winchip2-c6";
+         else
+           /* We have no idea.  */
+           processor = PROCESSOR_GENERIC32;
+       }
+    }
   else
     {
       switch (family)

Reply via email to