diff mbox

[1/2] i386: Consider Kaby Lake to be equivalent to Skylake

Message ID 20170616214249.21194-1-mattst88@gmail.com
State New
Headers show

Commit Message

Matt Turner June 16, 2017, 9:42 p.m. UTC
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(+)

Comments

Uros Bizjak June 18, 2017, 5:56 p.m. UTC | #1
On Fri, Jun 16, 2017 at 11:42 PM, Matt Turner <mattst88@gmail.com> wrote:
> 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.

OK.

Thanks,
Uros.

> ---
>  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
>
Matt Turner June 22, 2017, 5:33 p.m. UTC | #2
On Sun, Jun 18, 2017 at 10:56 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
> On Fri, Jun 16, 2017 at 11:42 PM, Matt Turner <mattst88@gmail.com> wrote:
>> 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.
>
> OK.
>
> Thanks,
> Uros.

Thank you very much. I do not have write access, so please check the
patches in for me if you would not mind.
diff mbox

Patch

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;