public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Hongtao Liu <crazylht@gmail.com>
To: Haochen Jiang <haochen.jiang@intel.com>
Cc: gcc-patches@gcc.gnu.org, ubizjak@gmail.com, hongtao.liu@intel.com
Subject: Re: [PATCH 1/2] Initial Grand Ridge support
Date: Mon, 7 Nov 2022 10:08:36 +0800	[thread overview]
Message-ID: <CAMZc-byANuX+C9F_EXa8XJm_pxm3VyrY2hhz5jpuCWb4MsQ72w@mail.gmail.com> (raw)
In-Reply-To: <20221107014114.71155-2-haochen.jiang@intel.com>

On Mon, Nov 7, 2022 at 9:41 AM Haochen Jiang via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> gcc/ChangeLog:
>
>         * common/config/i386/i386-common.cc
>         (processor_names): Add grandridge.
>         (processor_alias_table): Ditto.
>         * common/config/i386/i386-cpuinfo.h:
>         (enum processor_types): Add INTEL_GRANDRIDGE.
>         * config.gcc: Add -march=grandridge.
>         * config/i386/driver-i386.cc (host_detect_local_cpu):
>         Handle grandridge.
>         * config/i386/i386-c.cc (ix86_target_macros_internal):
>         Ditto.
>         * config/i386/i386-options.cc (m_GRANDRIDGE): New define.
>         (processor_cost_table): Add grandridge.
>         * config/i386/i386.h (enum processor_type):
>         Add PROCESSOR_GRANDRIDGE.
>         (PTA_GRANDRIDGE): Ditto.
>         * doc/extend.texi: Add grandridge.
>         * doc/invoke.texi: Ditto.
>
> gcc/testsuite/ChangeLog:
>
>         * gcc/testsuite/g++.target/i386/mv16.C: Add grandridge.
>         * gcc.target/i386/funcspec-56.inc: Handle new march.
> ---
LGTM.
>  gcc/common/config/i386/cpuinfo.h              | 6 ++++++
>  gcc/common/config/i386/i386-common.cc         | 3 +++
>  gcc/common/config/i386/i386-cpuinfo.h         | 1 +
>  gcc/config.gcc                                | 2 +-
>  gcc/config/i386/driver-i386.cc                | 5 ++++-
>  gcc/config/i386/i386-c.cc                     | 7 +++++++
>  gcc/config/i386/i386-options.cc               | 2 ++
>  gcc/config/i386/i386.h                        | 2 ++
>  gcc/doc/extend.texi                           | 3 +++
>  gcc/doc/invoke.texi                           | 9 +++++++++
>  gcc/testsuite/g++.target/i386/mv16.C          | 6 ++++++
>  gcc/testsuite/gcc.target/i386/funcspec-56.inc | 1 +
>  12 files changed, 45 insertions(+), 2 deletions(-)
>
> diff --git a/gcc/common/config/i386/cpuinfo.h b/gcc/common/config/i386/cpuinfo.h
> index df3500adc83..4d1bcffb978 100644
> --- a/gcc/common/config/i386/cpuinfo.h
> +++ b/gcc/common/config/i386/cpuinfo.h
> @@ -573,6 +573,12 @@ get_intel_cpu (struct __processor_model *cpu_model,
>        cpu_model->__cpu_type = INTEL_COREI7;
>        cpu_model->__cpu_subtype = INTEL_COREI7_GRANITERAPIDS;
>        break;
> +    case 0xb6:
> +      /* Grand Ridge.  */
> +      cpu = "grandridge";
> +      CHECK___builtin_cpu_is ("grandridge");
> +      cpu_model->__cpu_type = INTEL_GRANDRIDGE;
> +      break;
>      case 0x17:
>      case 0x1d:
>        /* Penryn.  */
> diff --git a/gcc/common/config/i386/i386-common.cc b/gcc/common/config/i386/i386-common.cc
> index 60a193a651c..431fd0d3ad1 100644
> --- a/gcc/common/config/i386/i386-common.cc
> +++ b/gcc/common/config/i386/i386-common.cc
> @@ -1920,6 +1920,7 @@ const char *const processor_names[] =
>    "goldmont-plus",
>    "tremont",
>    "sierraforest",
> +  "grandridge",
>    "knl",
>    "knm",
>    "skylake",
> @@ -2071,6 +2072,8 @@ const pta processor_alias_table[] =
>      M_CPU_TYPE (INTEL_TREMONT), P_PROC_SSE4_2},
>    {"sierraforest", PROCESSOR_SIERRAFOREST, CPU_HASWELL, PTA_SIERRAFOREST,
>      M_CPU_SUBTYPE (INTEL_SIERRAFOREST), P_PROC_AVX2},
> +  {"grandridge", PROCESSOR_GRANDRIDGE, CPU_HASWELL, PTA_GRANDRIDGE,
> +    M_CPU_TYPE (INTEL_GRANDRIDGE), P_PROC_AVX2},
>    {"knl", PROCESSOR_KNL, CPU_SLM, PTA_KNL,
>      M_CPU_TYPE (INTEL_KNL), P_PROC_AVX512F},
>    {"knm", PROCESSOR_KNM, CPU_SLM, PTA_KNM,
> diff --git a/gcc/common/config/i386/i386-cpuinfo.h b/gcc/common/config/i386/i386-cpuinfo.h
> index 345fda648ff..fe2e9e21fd2 100644
> --- a/gcc/common/config/i386/i386-cpuinfo.h
> +++ b/gcc/common/config/i386/i386-cpuinfo.h
> @@ -61,6 +61,7 @@ enum processor_types
>    AMDFAM19H,
>    ZHAOXIN_FAM7H,
>    INTEL_SIERRAFOREST,
> +  INTEL_GRANDRIDGE,
>    CPU_TYPE_MAX,
>    BUILTIN_CPU_TYPE_MAX = CPU_TYPE_MAX
>  };
> diff --git a/gcc/config.gcc b/gcc/config.gcc
> index 84c040746dc..b5eda046033 100644
> --- a/gcc/config.gcc
> +++ b/gcc/config.gcc
> @@ -669,7 +669,7 @@ silvermont knl knm skylake-avx512 cannonlake icelake-client icelake-server \
>  skylake goldmont goldmont-plus tremont cascadelake tigerlake cooperlake \
>  sapphirerapids alderlake rocketlake eden-x2 nano nano-1000 nano-2000 nano-3000 \
>  nano-x2 eden-x4 nano-x4 lujiazui x86-64 x86-64-v2 x86-64-v3 x86-64-v4 \
> -sierraforest graniterapids native"
> +sierraforest graniterapids grandridge native"
>
>  # Additional x86 processors supported by --with-cpu=.  Each processor
>  # MUST be separated by exactly one space.
> diff --git a/gcc/config/i386/driver-i386.cc b/gcc/config/i386/driver-i386.cc
> index 3117d83de00..95c16c23c7f 100644
> --- a/gcc/config/i386/driver-i386.cc
> +++ b/gcc/config/i386/driver-i386.cc
> @@ -591,8 +591,11 @@ const char *host_detect_local_cpu (int argc, const char **argv)
>               /* This is unknown family 0x6 CPU.  */
>               if (has_feature (FEATURE_AVX))
>                 {
> +                 /* Assume Grand Ridge.  */
> +                 if (has_feature (FEATURE_RAOINT))
> +                   cpu = "grandridge";
>                   /* Assume Granite Rapids.  */
> -                 if (has_feature (FEATURE_AMX_FP16))
> +                 else if (has_feature (FEATURE_AMX_FP16))
>                     cpu = "graniterapids";
>                   /* Assume Sierra Forest.  */
>                   else if (has_feature (FEATURE_AVXVNNIINT8))
> diff --git a/gcc/config/i386/i386-c.cc b/gcc/config/i386/i386-c.cc
> index a877d24148d..44fab6e80ae 100644
> --- a/gcc/config/i386/i386-c.cc
> +++ b/gcc/config/i386/i386-c.cc
> @@ -206,6 +206,10 @@ ix86_target_macros_internal (HOST_WIDE_INT isa_flag,
>        def_or_undef (parse_in, "__sierraforest");
>        def_or_undef (parse_in, "__sierraforest__");
>        break;
> +    case PROCESSOR_GRANDRIDGE:
> +      def_or_undef (parse_in, "__grandridge");
> +      def_or_undef (parse_in, "__grandridge__");
> +      break;
>      case PROCESSOR_KNL:
>        def_or_undef (parse_in, "__knl");
>        def_or_undef (parse_in, "__knl__");
> @@ -395,6 +399,9 @@ ix86_target_macros_internal (HOST_WIDE_INT isa_flag,
>      case PROCESSOR_SIERRAFOREST:
>        def_or_undef (parse_in, "__tune_sierraforest__");
>        break;
> +    case PROCESSOR_GRANDRIDGE:
> +      def_or_undef (parse_in, "__tune_grandridge__");
> +      break;
>      case PROCESSOR_KNL:
>        def_or_undef (parse_in, "__tune_knl__");
>        break;
> diff --git a/gcc/config/i386/i386-options.cc b/gcc/config/i386/i386-options.cc
> index 3c7570c5edd..23ab1f867d0 100644
> --- a/gcc/config/i386/i386-options.cc
> +++ b/gcc/config/i386/i386-options.cc
> @@ -138,6 +138,7 @@ along with GCC; see the file COPYING3.  If not see
>  #define m_GOLDMONT_PLUS (HOST_WIDE_INT_1U<<PROCESSOR_GOLDMONT_PLUS)
>  #define m_TREMONT (HOST_WIDE_INT_1U<<PROCESSOR_TREMONT)
>  #define m_SIERRAFOREST (HOST_WIDE_INT_1U<<PROCESSOR_SIERRAFOREST)
> +#define m_GRANDRIDGE (HOST_WIDE_INT_1U<<PROCESSOR_GRANDRIDGE)
>  #define m_INTEL (HOST_WIDE_INT_1U<<PROCESSOR_INTEL)
>
>  #define m_LUJIAZUI (HOST_WIDE_INT_1U<<PROCESSOR_LUJIAZUI)
> @@ -750,6 +751,7 @@ static const struct processor_costs *processor_cost_table[] =
>    &slm_cost,
>    &tremont_cost,
>    &alderlake_cost,
> +  &alderlake_cost,
>    &slm_cost,
>    &slm_cost,
>    &skylake_cost,
> diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
> index e3e675d36c5..b32db8da109 100644
> --- a/gcc/config/i386/i386.h
> +++ b/gcc/config/i386/i386.h
> @@ -2226,6 +2226,7 @@ enum processor_type
>    PROCESSOR_GOLDMONT_PLUS,
>    PROCESSOR_TREMONT,
>    PROCESSOR_SIERRAFOREST,
> +  PROCESSOR_GRANDRIDGE,
>    PROCESSOR_KNL,
>    PROCESSOR_KNM,
>    PROCESSOR_SKYLAKE,
> @@ -2351,6 +2352,7 @@ constexpr wide_int_bitmask PTA_SIERRAFOREST = PTA_ALDERLAKE | PTA_AVXIFMA
>    | PTA_AVXVNNIINT8 | PTA_AVXNECONVERT | PTA_CMPCCXADD;
>  constexpr wide_int_bitmask PTA_GRANITERAPIDS = PTA_SAPPHIRERAPIDS | PTA_AMX_FP16
>    | PTA_PREFETCHI;
> +constexpr wide_int_bitmask PTA_GRANDRIDGE = PTA_SIERRAFOREST | PTA_RAOINT;
>  constexpr wide_int_bitmask PTA_KNM = PTA_KNL | PTA_AVX5124VNNIW
>    | PTA_AVX5124FMAPS | PTA_AVX512VPOPCNTDQ;
>  constexpr wide_int_bitmask PTA_ZNVER1 = PTA_64BIT | PTA_MMX | PTA_SSE | PTA_SSE2
> diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
> index 33a49338bd3..8da0db9770d 100644
> --- a/gcc/doc/extend.texi
> +++ b/gcc/doc/extend.texi
> @@ -21986,6 +21986,9 @@ Intel Atom Tremont CPU.
>  @item sierraforest
>  Intel Atom Sierra Forest CPU.
>
> +@item grandridge
> +Intel Atom Grand Ridge CPU.
> +
>  @item knl
>  Intel Knights Landing CPU.
>
> diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
> index 7417f528bb1..f9cd41fac28 100644
> --- a/gcc/doc/invoke.texi
> +++ b/gcc/doc/invoke.texi
> @@ -32080,6 +32080,15 @@ MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
>  PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
>  AVXIFMA, AVXVNNIINT8, AVXNECONVERT and CMPCCXADD instruction set support.
>
> +@item grandridge
> +Intel Grand Ridge CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
> +SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
> +XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI,
> +MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
> +PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
> +AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD and RAOINT instruction set
> +support.
> +
>  @item knl
>  Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
>  SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
> diff --git a/gcc/testsuite/g++.target/i386/mv16.C b/gcc/testsuite/g++.target/i386/mv16.C
> index e0e0f153d1c..772791b96e8 100644
> --- a/gcc/testsuite/g++.target/i386/mv16.C
> +++ b/gcc/testsuite/g++.target/i386/mv16.C
> @@ -100,6 +100,10 @@ int __attribute__ ((target("arch=graniterapids"))) foo () {
>    return 26;
>  }
>
> +int __attribute__ ((target("arch=grandridge"))) foo () {
> +  return 27;
> +}
> +
>  int main ()
>  {
>    int val = foo ();
> @@ -142,6 +146,8 @@ int main ()
>      assert (val == 25);
>    else if (__builtin_cpu_is ("graniterapids"))
>      assert (val == 26);
> +  else if (__builtin_cpu_is ("grandridge"))
> +    assert (val == 27);
>    else
>      assert (val == 0);
>
> diff --git a/gcc/testsuite/gcc.target/i386/funcspec-56.inc b/gcc/testsuite/gcc.target/i386/funcspec-56.inc
> index 7eb18c6952d..37802307bcf 100644
> --- a/gcc/testsuite/gcc.target/i386/funcspec-56.inc
> +++ b/gcc/testsuite/gcc.target/i386/funcspec-56.inc
> @@ -186,6 +186,7 @@ extern void test_arch_goldmont (void)               __attribute__((__target__("arch=goldmont"
>  extern void test_arch_goldmont_plus (void)     __attribute__((__target__("arch=goldmont-plus")));
>  extern void test_arch_tremont (void)           __attribute__((__target__("arch=tremont")));
>  extern void test_arch_sierraforest (void)       __attribute__((__target__("arch=sierraforest")));
> +extern void test_arch_grandridge (void)                __attribute__((__target__("arch=grandridge")));
>  extern void test_arch_knl (void)               __attribute__((__target__("arch=knl")));
>  extern void test_arch_knm (void)               __attribute__((__target__("arch=knm")));
>  extern void test_arch_skylake (void)           __attribute__((__target__("arch=skylake")));
> --
> 2.18.1
>


-- 
BR,
Hongtao

  reply	other threads:[~2022-11-07  2:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-07  1:41 [PATCH 0/2] Intel Grand Ridge Support Haochen Jiang
2022-11-07  1:41 ` [PATCH 1/2] Initial Grand Ridge support Haochen Jiang
2022-11-07  2:08   ` Hongtao Liu [this message]
2022-11-07  1:41 ` [PATCH 2/2] Add m_CORE_ATOM for atom cores Haochen Jiang
2022-11-07  9:13   ` Uros Bizjak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAMZc-byANuX+C9F_EXa8XJm_pxm3VyrY2hhz5jpuCWb4MsQ72w@mail.gmail.com \
    --to=crazylht@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=haochen.jiang@intel.com \
    --cc=hongtao.liu@intel.com \
    --cc=ubizjak@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).