From patchwork Fri Nov 1 03:23:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jiang, Haochen" X-Patchwork-Id: 2004964 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=NN8DcVDa; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XfmSV40Dmz1xwF for ; Fri, 1 Nov 2024 14:24:42 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A04B13858C52 for ; Fri, 1 Nov 2024 03:24:40 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by sourceware.org (Postfix) with ESMTPS id 84970385840E for ; Fri, 1 Nov 2024 03:23:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 84970385840E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=intel.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 84970385840E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=198.175.65.18 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1730431438; cv=none; b=HuWbG59KsknQhkeKIUbF9IWVJqkof8En2BnWTfu+ken5eNQ0JHeI9vXMplvtaX2GL2tWdz72MkAkwPWY7tYzMOURf9TZVpVAR5DBEgR/r0+wciHsT/4cL/QTDahnYgw42m+OzdW3ujQX9VWxFH/eETf52IXH3og1PQQm9rKHP6M= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1730431438; c=relaxed/simple; bh=siP0cNQafPa7bLsJ3QbYjEU/oYRI8SCqGKPvyNC/xuc=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=eauEwPf41JAy09y4+Gt6Za7C1rZaFECLIGBjC0WTVPWMSzxrkDj2FcECxhBCZKrL88rrLP5G+Duuzq6DFeMAiBLuSvN5Va+3+s5PqfiAr9Pf7Y2PlzLLyb01svIRwa4oZ4K2VQrEeylTcvU9OaojGwkiPRoaYPq5MDZGQHIQJyQ= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1730431433; x=1761967433; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=siP0cNQafPa7bLsJ3QbYjEU/oYRI8SCqGKPvyNC/xuc=; b=NN8DcVDaWSaT4IcSRgHPeDhcGQDEG5V8NJaS+dCMGIUZaBzppPsZO1a4 FLkFZwEZe2ilYq+yq9LZDVlmc95h0AqJOHiHsfR0mekz70/74BoBUtf5A j3mXC5DXluijaNdUK7AEBsB5hfcCYoY2STkuga0aY5YXAHLP3Xh2XqfEr dw45x12GEG0rydHiGz3MQZCDo6A+qneiYGG0eihSftN13lM75ZjOJ66Wy b+0auS4ntwg5ZzN6bzNDwvhT6tgWBSOUfkPasDK/x1bWXzttBbzSwg4ej 1eLPUoljwfZ1InSStqx/Bs/NJQ/2wACwAGMdcrDeCY2EjiN705+3PjQo9 A==; X-CSE-ConnectionGUID: vgtMs0h1TOelfAteLGtbNQ== X-CSE-MsgGUID: ztQur6fYSZ217vGPwaNImg== X-IronPort-AV: E=McAfee;i="6700,10204,11222"; a="30383347" X-IronPort-AV: E=Sophos;i="6.11,199,1725346800"; d="scan'208";a="30383347" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Oct 2024 20:23:52 -0700 X-CSE-ConnectionGUID: 0HlaY1YFRXC+t/ASzIAASQ== X-CSE-MsgGUID: ewOF6TZaQTeniX2Oit3CCA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,248,1725346800"; d="scan'208";a="83272612" Received: from shliclel4217.sh.intel.com ([10.239.240.127]) by orviesa007.jf.intel.com with ESMTP; 31 Oct 2024 20:23:51 -0700 From: Haochen Jiang To: gcc-patches@gcc.gnu.org Cc: hongtao.liu@intel.com, ubizjak@gmail.com Subject: [PATCH 2/2] Initial Diamond Rapids Support Date: Fri, 1 Nov 2024 11:23:45 +0800 Message-Id: <20241101032345.3501979-3-haochen.jiang@intel.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20241101032345.3501979-1-haochen.jiang@intel.com> References: <20241101032345.3501979-1-haochen.jiang@intel.com> MIME-Version: 1.0 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org gcc/ChangeLog: * common/config/i386/cpuinfo.h (get_intel_cpu): Handle Diamond Rapids. * common/config/i386/i386-common.cc (processor_name): Add Diamond Rapids. (processor_alias_table): Ditto. * common/config/i386/i386-cpuinfo.h (enum processor_types): Add INTEL_COREI7_DIAMONDRAPIDS. * config.gcc: Add -march=diamondrapids. * config/i386/driver-i386.cc (host_detect_local_cpu): Handle diamondrapids. * config/i386/i386-c.cc (ix86_target_macros_internal): Ditto. * config/i386/i386-options.cc (processor_cost_table): Ditto. (m_DIAMONDRAPIDS): New. (m_CORE_AVX512): Add diamondrapids. * config/i386/i386.h (enum processor_type): Ditto. * doc/extend.texi: Ditto. * doc/invoke.texi: Ditto. gcc/testsuite/ChangeLog: * g++.target/i386/mv16.C: Ditto. * gcc.target/i386/funcspec-56.inc: Handle new march. --- gcc/common/config/i386/cpuinfo.h | 16 ++++++++++++++++ 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 | 8 ++++++-- gcc/config/i386/i386-c.cc | 7 +++++++ gcc/config/i386/i386-options.cc | 5 ++++- gcc/config/i386/i386.h | 11 +++++++++++ gcc/doc/extend.texi | 3 +++ gcc/doc/invoke.texi | 14 ++++++++++++++ gcc/testsuite/g++.target/i386/mv16.C | 6 ++++++ gcc/testsuite/gcc.target/i386/funcspec-56.inc | 1 + 12 files changed, 73 insertions(+), 4 deletions(-) diff --git a/gcc/common/config/i386/cpuinfo.h b/gcc/common/config/i386/cpuinfo.h index f415fc92ec4..310eba3ef8c 100644 --- a/gcc/common/config/i386/cpuinfo.h +++ b/gcc/common/config/i386/cpuinfo.h @@ -636,6 +636,22 @@ get_intel_cpu (struct __processor_model *cpu_model, default: break; } + /* Parse family and model for family 0x13. */ + else if (cpu_model2->__cpu_family == 0x13) + switch (cpu_model2->__cpu_model) + { + case 0x00: + case 0x01: + /* Diamond Rapids. */ + cpu = "diamondrapids"; + CHECK___builtin_cpu_is ("corei7"); + CHECK___builtin_cpu_is ("diamondrapids"); + cpu_model->__cpu_type = INTEL_COREI7; + cpu_model->__cpu_subtype = INTEL_COREI7_DIAMONDRAPIDS; + break; + default: + break; + } return cpu; } diff --git a/gcc/common/config/i386/i386-common.cc b/gcc/common/config/i386/i386-common.cc index b2c2f0bdc11..b044cba758b 100644 --- a/gcc/common/config/i386/i386-common.cc +++ b/gcc/common/config/i386/i386-common.cc @@ -2206,6 +2206,7 @@ const char *const processor_names[] = "arrowlake", "arrowlake-s", "pantherlake", + "diamondrapids", "intel", "lujiazui", "yongfeng", @@ -2343,6 +2344,8 @@ const pta processor_alias_table[] = M_CPU_SUBTYPE (INTEL_COREI7_ARROWLAKE_S), P_PROC_AVX2}, {"pantherlake", PROCESSOR_PANTHERLAKE, CPU_HASWELL, PTA_PANTHERLAKE, M_CPU_SUBTYPE (INTEL_COREI7_PANTHERLAKE), P_PROC_AVX2}, + {"diamondrapids", PROCESSOR_DIAMONDRAPIDS, CPU_HASWELL, PTA_DIAMONDRAPIDS, + M_CPU_SUBTYPE (INTEL_COREI7_DIAMONDRAPIDS), P_PROC_AVX512F}, {"bonnell", PROCESSOR_BONNELL, CPU_ATOM, PTA_BONNELL, M_CPU_TYPE (INTEL_BONNELL), P_PROC_SSSE3}, {"atom", PROCESSOR_BONNELL, CPU_ATOM, PTA_BONNELL, diff --git a/gcc/common/config/i386/i386-cpuinfo.h b/gcc/common/config/i386/i386-cpuinfo.h index 23c995037ed..4c99b358552 100644 --- a/gcc/common/config/i386/i386-cpuinfo.h +++ b/gcc/common/config/i386/i386-cpuinfo.h @@ -105,6 +105,7 @@ enum processor_subtypes ZHAOXIN_FAM7H_YONGFENG, AMDFAM1AH_ZNVER5, ZHAOXIN_FAM7H_SHIJIDADAO, + INTEL_COREI7_DIAMONDRAPIDS, CPU_SUBTYPE_MAX }; diff --git a/gcc/config.gcc b/gcc/config.gcc index 3bdee5bf96f..71d74571672 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -721,7 +721,7 @@ 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 yongfeng shijidadao x86-64 x86-64-v2 \ x86-64-v3 x86-64-v4 sierraforest graniterapids graniterapids-d grandridge \ -arrowlake arrowlake-s clearwaterforest pantherlake native" +arrowlake arrowlake-s clearwaterforest pantherlake diamondrapids 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 f0ce017bfdc..a8b02765245 100644 --- a/gcc/config/i386/driver-i386.cc +++ b/gcc/config/i386/driver-i386.cc @@ -581,6 +581,7 @@ const char *host_detect_local_cpu (int argc, const char **argv) processor = PROCESSOR_PENTIUM; break; case 6: + case 19: processor = PROCESSOR_PENTIUMPRO; break; case 15: @@ -623,11 +624,14 @@ const char *host_detect_local_cpu (int argc, const char **argv) { if (arch) { - /* This is unknown family 0x6 CPU. */ + /* This is unknown CPU. */ if (has_feature (FEATURE_AVX512F)) { + /* Assume Diamond Rapids. */ + if (has_feature (FEATURE_AVX10_2_512)) + cpu = "diamondrapids"; /* Assume Granite Rapids D. */ - if (has_feature (FEATURE_AMX_COMPLEX)) + else if (has_feature (FEATURE_AMX_COMPLEX)) cpu = "graniterapids-d"; /* Assume Granite Rapids. */ else if (has_feature (FEATURE_AMX_FP16)) diff --git a/gcc/config/i386/i386-c.cc b/gcc/config/i386/i386-c.cc index da60da40205..64b0723d23a 100644 --- a/gcc/config/i386/i386-c.cc +++ b/gcc/config/i386/i386-c.cc @@ -291,6 +291,10 @@ ix86_target_macros_internal (HOST_WIDE_INT isa_flag, def_or_undef (parse_in, "__pantherlake"); def_or_undef (parse_in, "__pantherlake__"); break; + case PROCESSOR_DIAMONDRAPIDS: + def_or_undef (parse_in, "__diamondrapids"); + def_or_undef (parse_in, "__diamondrapids__"); + break; /* use PROCESSOR_max to not set/unset the arch macro. */ case PROCESSOR_max: @@ -491,6 +495,9 @@ ix86_target_macros_internal (HOST_WIDE_INT isa_flag, case PROCESSOR_PANTHERLAKE: def_or_undef (parse_in, "__tune_pantherlake__"); break; + case PROCESSOR_DIAMONDRAPIDS: + def_or_undef (parse_in, "__tune_diamondrapids__"); + break; case PROCESSOR_INTEL: case PROCESSOR_GENERIC: break; diff --git a/gcc/config/i386/i386-options.cc b/gcc/config/i386/i386-options.cc index 239269ecbdd..603166d249c 100644 --- a/gcc/config/i386/i386-options.cc +++ b/gcc/config/i386/i386-options.cc @@ -132,10 +132,12 @@ along with GCC; see the file COPYING3. If not see #define m_ARROWLAKE (HOST_WIDE_INT_1U<