From patchwork Mon Nov 7 01:41:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jiang, Haochen" X-Patchwork-Id: 16212 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1773194wru; Sun, 6 Nov 2022 17:42:10 -0800 (PST) X-Google-Smtp-Source: AA0mqf71gv55cG57cIaPIOXYCAFYSW9PM4aVUA1KqcJbp0NNc2d6UGw6D7JP3SCQhVXBIE7x1Ccw X-Received: by 2002:a17:906:a157:b0:7ae:5d04:c96 with SMTP id bu23-20020a170906a15700b007ae5d040c96mr5938632ejb.564.1667785330822; Sun, 06 Nov 2022 17:42:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667785330; cv=none; d=google.com; s=arc-20160816; b=v+c1BMCE+Jv2Tja9Jh3OKtCc0iBvbXb6lcjZ0Ckn4XMnsHVb3Z0KK5eH44ljmqIBcQ t7hxWGIX5VMFCR+He3HLbGd/DdpgktAxvQBFAGWVDpkkGcViv5NvSSUh7lND0x9Buq5m GY0459TtCCtS8Q+L0TjRUIMDXuGbI7+ytoVyLE1skD85bReZtXlxTXssV87QObYJgoS6 UNuo3JfH4Nh8U1IG6OJ/QmJMNCJwcRI4Yoc22ugu5eSFKHaRhU7hRh0WrRH9O64T7JH1 ZSoIDbidP7WOeXOrZbnzuYiKnw1IfJRmz0Tn9R75e4zfI9sN1cD+Mnp+NAXzfgT34ILX lI+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=k+ep+Zh1Sfyntw/WI0oJl4gLvYvNaGrxV1iVp4r3Mzs=; b=uCbIDBgpvNiztmBiaEyvA1YikcEGTYkftuSJ3HBgJpjqTkUaCEZ9qzbEoLj5M5k0Cf 7w2yS73aiomV2OnJXEOU+BYTiH9Trs2oRGRXd9yU5nryNT8dhZsc+jC2tglEfOX3J+S3 SofHfOQcmY3Gj7sNO+l9Kmhx1NFl1AQdk8BjR8fOQTn7VU8N413VwSEQ4j3/amhWCz7R geyFPD13IwT4VbDxxmmyuqhG+/lO6xYoLWg7EC0AJV2SohPzksGDgQNjjHiwFbx9jW5I D/+pFsCxr89mEIELfd5OnWvb1hTEJLra9A9T2xM21G2TYsbg4XKhMse31hFXSABDfbyv lBTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=CkJWoX+R; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id wy8-20020a170906fe0800b00791a7e441a3si7620414ejb.459.2022.11.06.17.42.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Nov 2022 17:42:10 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=CkJWoX+R; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7C00B38582A2 for ; Mon, 7 Nov 2022 01:42:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7C00B38582A2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1667785324; bh=k+ep+Zh1Sfyntw/WI0oJl4gLvYvNaGrxV1iVp4r3Mzs=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=CkJWoX+RF1OY0o7dwFba0Omv8hshsQXEvGeAsVJNyXOvmOo4AH1QjygnXZTepY2Fl dTKGoRIiFTTHobw28vTvAA48+i7bfci1FpXwyfY39GwLO5x93oA08Rua12oLHo5jrq NirrsNmLWVdsuJXJhAMU9VFhrA4HPnHueJsBoX08= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by sourceware.org (Postfix) with ESMTPS id CF2393858C74 for ; Mon, 7 Nov 2022 01:41:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CF2393858C74 X-IronPort-AV: E=McAfee;i="6500,9779,10523"; a="396601347" X-IronPort-AV: E=Sophos;i="5.96,143,1665471600"; d="scan'208";a="396601347" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Nov 2022 17:41:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10523"; a="880887332" X-IronPort-AV: E=Sophos;i="5.96,143,1665471600"; d="scan'208";a="880887332" Received: from shvmail03.sh.intel.com ([10.239.245.20]) by fmsmga006.fm.intel.com with ESMTP; 06 Nov 2022 17:41:17 -0800 Received: from shliclel320.sh.intel.com (shliclel320.sh.intel.com [10.239.240.127]) by shvmail03.sh.intel.com (Postfix) with ESMTP id 31D0B1005674; Mon, 7 Nov 2022 09:41:16 +0800 (CST) To: gcc-patches@gcc.gnu.org Cc: ubizjak@gmail.com, hongtao.liu@intel.com Subject: [PATCH 1/2] Initial Grand Ridge support Date: Mon, 7 Nov 2022 09:41:13 +0800 Message-Id: <20221107014114.71155-2-haochen.jiang@intel.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20221107014114.71155-1-haochen.jiang@intel.com> References: <20221107014114.71155-1-haochen.jiang@intel.com> X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, SPF_HELO_NONE, SPF_NONE, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Haochen Jiang via Gcc-patches From: "Jiang, Haochen" Reply-To: Haochen Jiang Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748799671256264399?= X-GMAIL-MSGID: =?utf-8?q?1748799671256264399?= 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. --- 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<