From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yw1-x1130.google.com (mail-yw1-x1130.google.com [IPv6:2607:f8b0:4864:20::1130]) by sourceware.org (Postfix) with ESMTPS id 98A853858C54 for ; Mon, 7 Nov 2022 02:05:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 98A853858C54 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-yw1-x1130.google.com with SMTP id 00721157ae682-369426664f9so91754577b3.12 for ; Sun, 06 Nov 2022 18:05:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Hyf+AOnm5aFqO7ij6Gs0auAq7kg0bl+HW+n/E5vIKz8=; b=gCoHEJzcwvBfseOIOD3Cp19Ze0tZvXeBdp3MqEbG4jNQxwoblu7FQwkP6flI8MYZ5x KEslEHoQsk9IG+5u9o3x3XrU18bSAd03jUvjYg499UzZSeJKdiWUTdcmLx/LvNt5zKGg xIIsIW7AluxFAR3loN8PEwuCiA9DzqlsO3SIztfu6sdpzm8S3oaFQBbtu+2RJhIpEmuQ hkPQyp9gixKCJJVlgxW8b8wGl7M3aAj+05seeEcwWFD7tdxWa0ipMuxbhqcetQ+BNcFd Kee2fyUQKNzumbxNalvksEXMxh05UjaprjEZwzH4qJhBzSYuOj/RoTNJ/J8rBJG1UVND 4v+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Hyf+AOnm5aFqO7ij6Gs0auAq7kg0bl+HW+n/E5vIKz8=; b=zE7MNdPsvsLnl3VUQgJQCq/C2w6uGIf4VJcKq5cml3UR4hfY236N+7/MlftU5+SeOO 5hpCtlp1ZzD5ykhbnRw9qkM6PYb/rEMnRikMKCukfZ9vl/L/bSMD5giN6gQs4biffRtB y552VX3af+QH925PtUPqHX/vkqgHAC4cOrGdzJFmnYa/DtzflAtJlXrbu8jG1UKLgwqq 3veOu/rYb6wHQImBlFb8lgGGw+lCNsyEjlFULVG0zSv1zvWkP+DQ74a7OdZIbW3to4SY TJ/vt/dM6H7WFqFDCKk7sXCxZNMrNuVcjujKlD8HJVI41C44Nf6IDtXeaxE4hImXf01U csDA== X-Gm-Message-State: ACrzQf1B4isUe8BIae2j8ndJfgWLxXhIedKWo9E6GTW53ezlBBvlAtz+ 1LwqDDiENCZvqn02MjWS2xTImrCX3ZK8yKRQIreTYLnXksQ= X-Google-Smtp-Source: AMsMyM6DWtc4pBuBY3RZpw0V/K+sOBEton2vdjoKeBiodqne+XYh39WCqc8Yg/15dykA7dZEcczhVbSQ+xGnLatt1rc= X-Received: by 2002:a0d:c942:0:b0:358:ab9d:ced6 with SMTP id l63-20020a0dc942000000b00358ab9dced6mr660706ywd.241.1667786727916; Sun, 06 Nov 2022 18:05:27 -0800 (PST) MIME-Version: 1.0 References: <20221107014114.71155-1-haochen.jiang@intel.com> <20221107014114.71155-2-haochen.jiang@intel.com> In-Reply-To: <20221107014114.71155-2-haochen.jiang@intel.com> From: Hongtao Liu Date: Mon, 7 Nov 2022 10:08:36 +0800 Message-ID: Subject: Re: [PATCH 1/2] Initial Grand Ridge support To: Haochen Jiang Cc: gcc-patches@gcc.gnu.org, ubizjak@gmail.com, hongtao.liu@intel.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-8.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Mon, Nov 7, 2022 at 9:41 AM Haochen Jiang via Gcc-patches 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< #define m_TREMONT (HOST_WIDE_INT_1U< #define m_SIERRAFOREST (HOST_WIDE_INT_1U< +#define m_GRANDRIDGE (HOST_WIDE_INT_1U< #define m_INTEL (HOST_WIDE_INT_1U< > #define m_LUJIAZUI (HOST_WIDE_INT_1U< @@ -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