Currently -march=native selects -march=broadwell on Kaby Lake systems,
since its model numbers are missing from the switch statement. It falls
back to the default case and chooses -march=broadwell because of the
presence of the ADX instruction set.

gcc/
        * config/i386/driver-i386.c (host_detect_local_cpu): Add Kaby
        Lake models to skylake case.

gcc/testsuite/

        * gcc.target/i386/builtin_target.c: Add Kaby Lake models to
        skylake check.

libgcc/

        * config/i386/cpuinfo.c (get_intel_cpu): Add Kaby Lake models to
        skylake case.
---
 gcc/config/i386/driver-i386.c                  | 3 +++
 gcc/testsuite/gcc.target/i386/builtin_target.c | 3 +++
 libgcc/config/i386/cpuinfo.c                   | 3 +++
 3 files changed, 9 insertions(+)

diff --git a/gcc/config/i386/driver-i386.c b/gcc/config/i386/driver-i386.c
index 6c812514239..09faad0af0e 100644
--- a/gcc/config/i386/driver-i386.c
+++ b/gcc/config/i386/driver-i386.c
@@ -781,6 +781,9 @@ const char *host_detect_local_cpu (int argc, const char 
**argv)
        case 0x4e:
        case 0x5e:
          /* Skylake.  */
+       case 0x8e:
+       case 0x9e:
+         /* Kaby Lake.  */
          cpu = "skylake";
          break;
        case 0x57:
diff --git a/gcc/testsuite/gcc.target/i386/builtin_target.c 
b/gcc/testsuite/gcc.target/i386/builtin_target.c
index 374f0292453..9c190eb7ebc 100644
--- a/gcc/testsuite/gcc.target/i386/builtin_target.c
+++ b/gcc/testsuite/gcc.target/i386/builtin_target.c
@@ -88,6 +88,9 @@ check_intel_cpu_model (unsigned int family, unsigned int 
model,
            case 0x4e:
            case 0x5e:
              /* Skylake.  */
+           case 0x8e:
+           case 0x9e:
+             /* Kaby Lake.  */
              assert (__builtin_cpu_is ("corei7"));
              assert (__builtin_cpu_is ("skylake"));
              break;
diff --git a/libgcc/config/i386/cpuinfo.c b/libgcc/config/i386/cpuinfo.c
index a1dc011525f..b008fb6e396 100644
--- a/libgcc/config/i386/cpuinfo.c
+++ b/libgcc/config/i386/cpuinfo.c
@@ -183,6 +183,9 @@ get_intel_cpu (unsigned int family, unsigned int model, 
unsigned int brand_id)
            case 0x4e:
            case 0x5e:
              /* Skylake.  */
+           case 0x8e:
+           case 0x9e:
+             /* Kaby Lake.  */
              __cpu_model.__cpu_type = INTEL_COREI7;
              __cpu_model.__cpu_subtype = INTEL_COREI7_SKYLAKE;
              break;
-- 
2.13.0

Reply via email to