Hi!

As mentioned in the PR, some? KVM versions disable some CPU flags,
supposedly so that it can be migrated to any other x86-64 hw.
Thus, it announces only sse2 and lm, but already not sse3, ssse3
nor 3dnow, and (unfortunately) identifies itself as GenuineIntel
family 6 model 13.  There is no 64-bit CPU that actually is the lowest
common denominator of x86-64 CPUs (AMDs had 3dNOW etc., Intel first
x86-64 CPUs had already SSSE3).

This patch just makes sure we can use -march=native -m64 on such hosts,
without that gcc complains that the selected CPU doesn't support 64-bit
mode, because -march=native gives -march=pentium-m.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
ok for trunk/4.9?

2014-06-20  Jakub Jelinek  <ja...@redhat.com>

        PR target/61570
        * config/i386/driver-i386.c (host_detect_local_cpu): For unknown
        model family 6 CPU with has_longmode never use a CPU without
        64-bit support.

--- gcc/config/i386/driver-i386.c.jj    2014-05-14 14:45:54.000000000 +0200
+++ gcc/config/i386/driver-i386.c       2014-06-20 18:59:57.805006358 +0200
@@ -745,6 +745,11 @@ const char *host_detect_local_cpu (int a
                    /* Assume Core 2.  */
                    cpu = "core2";
                }
+             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_sse3)
                /* It is Core Duo.  */
                cpu = "pentium-m";

        Jakub

Reply via email to