]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR target/67310 ([PATCH] gcc 4.8.4 fails to compile with -march=native...
authorUros Bizjak <ubizjak@gmail.com>
Sun, 5 Jun 2016 15:52:01 +0000 (17:52 +0200)
committerUros Bizjak <uros@gcc.gnu.org>
Sun, 5 Jun 2016 15:52:01 +0000 (17:52 +0200)
Backport from mainline
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.

From-SVN: r237101

gcc/ChangeLog
gcc/config/i386/driver-i386.c

index 389c7d4076043587549f94367ea7474c98d0957c..49e0f89a75e292be039e31054f2b3585a9f9b906 100644 (file)
@@ -1,3 +1,17 @@
+2016-06-05  Uros Bizjak  <ubizjak@gmail.com>
+
+       Backport from mainline
+       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.
+
 2016-05-22  Iain Sandoe  <iain@codesourcery.com>
            Dominique d'Humieres  <dominiq@lps.ens.fr>
 
index 992f91f8a57943d38a040a3f4ef9aa4095c19e24..20866db35460036ec26c382cdbf2bd88925328cc 100644 (file)
@@ -596,33 +596,27 @@ const char *host_detect_local_cpu (int argc, const char **argv)
     }
   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
@@ -653,7 +647,18 @@ const char *host_detect_local_cpu (int argc, const char **argv)
       /* 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)
@@ -766,8 +771,13 @@ const char *host_detect_local_cpu (int argc, const char **argv)
                /* 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";
@@ -848,6 +858,11 @@ const char *host_detect_local_cpu (int argc, const char **argv)
              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)