[PATCH][x86] Knights Mill -march/-mtune options

Uros Bizjak ubizjak@gmail.com
Mon Sep 18 10:23:00 GMT 2017


On Mon, Sep 18, 2017 at 12:17 PM, Peryt, Sebastian
<sebastian.peryt@intel.com> wrote:
>> -----Original Message-----
>> From: gcc-patches-owner@gcc.gnu.org [mailto:gcc-patches-
>> owner@gcc.gnu.org] On Behalf Of Uros Bizjak
>> Sent: Sunday, September 17, 2017 6:14 PM
>> To: Peryt, Sebastian <sebastian.peryt@intel.com>
>> Cc: gcc-patches@gcc.gnu.org; Kirill Yukhin <kirill.yukhin@gmail.com>
>> Subject: Re: [PATCH][x86] Knights Mill -march/-mtune options
>>
>> On Thu, Sep 14, 2017 at 1:47 PM, Peryt, Sebastian <sebastian.peryt@intel.com>
>> wrote:
>> > Hi,
>> >
>> > This patch adds  options -march=/-mtune=knm for Knights Mill.
>> >
>> > 2017-09-14  Sebastian Peryt  <sebastian.peryt@intel.com> gcc/
>> >
>> >         * config.gcc: Support "knm".
>> >         * config/i386/driver-i386.c (host_detect_local_cpu): Detect "knm".
>> >         * config/i386/i386-c.c (ix86_target_macros_internal): Handle
>> >         PROCESSOR_KNM.
>> >         * config/i386/i386.c (m_KNM): Define.
>> >         (processor_target_table): Add "knm".
>> >         (PTA_KNM): Define.
>> >         (ix86_option_override_internal): Add "knm".
>> >         (ix86_issue_rate): Add PROCESSOR_KNM.
>> >         (ix86_adjust_cost): Ditto.
>> >         (ia32_multipass_dfa_lookahead): Ditto.
>> >         (get_builtin_code_for_version): Handle PROCESSOR_KNM.
>> >         (fold_builtin_cpu): Define M_INTEL_KNM.
>> >         * config/i386/i386.h (TARGET_KNM): Define.
>> >         (processor_type): Add PROCESSOR_KNM.
>> >         * config/i386/x86-tune.def: Add m_KNM.
>> >         * doc/invoke.texi: Add knm as x86 -march=/-mtune= CPU type.
>> >
>> >
>> >     gcc/testsuite/
>> >
>> >         * gcc.target/i386/funcspec-5.c: Test knm.
>> >
>> > Is it ok for trunk?
>>
>> You also have to update libgcc/cpuinfo.h together with fold_builtin_cpu from
>> i386.c. Please note that all new processor types and subtypes have to be added
>> at the end of the enum.
>>
>
> Uros,
>
> I have updated libgcc/cpuinfo.h and libgcc/cpuinfo.c. I understood that
> CPU_TYPE_MAX in libgcc/cpuinfo.h processor_types is some kind of barrier,
> this is why I put KNM before that. Is that correct thinking? As for fold_builtin_cpu
> in i386.c I already have something like this:
>
> @@ -34217,6 +34229,7 @@ fold_builtin_cpu (tree fndecl, tree *args)
>      M_AMDFAM15H,
>      M_INTEL_SILVERMONT,
>      M_INTEL_KNL,
> +    M_INTEL_KNM,
>      M_AMD_BTVER1,
>      M_AMD_BTVER2,
>      M_CPU_SUBTYPE_START,
> @@ -34262,6 +34275,7 @@ fold_builtin_cpu (tree fndecl, tree *args)
>        {"bonnell", M_INTEL_BONNELL},
>        {"silvermont", M_INTEL_SILVERMONT},
>        {"knl", M_INTEL_KNL},
> +      {"knm", M_INTEL_KNM},
>        {"amdfam10h", M_AMDFAM10H},
>        {"barcelona", M_AMDFAM10H_BARCELONA},
>        {"shanghai", M_AMDFAM10H_SHANGHAI},
>
> I couldn't find any other place where I'm supposed to add anything extra.

Please look at libgcc/config/i386/cpuinfo.h. The comment here says that:

/* Any new types or subtypes have to be inserted at the end. */

The above patch should then add M_INTEL_KNM as the last entry *before*
M_CPU_SUBTYPE_START.

> Additionally I updated one extra test I found - gcc.target/i386/funcspec-56.inc
>
>> Ops, and ANDFAM17H processor type should not be there in cpuinfo.h.
>
> Sorry, I don't understand - it shouldn't be at this position, or in this enum at all?

This means I have to synchronize gcc part with libgcc. I'll do it later today.

Uros.



More information about the Gcc-patches mailing list