From patchwork Sun Nov 27 17:02:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christoph_M=C3=BCllner?= X-Patchwork-Id: 26383 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp5206367wrr; Sun, 27 Nov 2022 09:04:17 -0800 (PST) X-Google-Smtp-Source: AA0mqf67LMsFGWqR/r8AosQaVHYD2+5e8erkkEds3dMdArFpXML5rB/ewxGhZyqaOFk5JhRg+fsf X-Received: by 2002:a05:6402:3808:b0:468:c911:d843 with SMTP id es8-20020a056402380800b00468c911d843mr44426543edb.422.1669568657135; Sun, 27 Nov 2022 09:04:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669568657; cv=none; d=google.com; s=arc-20160816; b=FW/6/iIZzbrei1rbO2ivX2nQ9Q68ByK9fLe0qJiRHatNajvcF3hbHP/FsyyKUemJ4i XCcscTFP9fz+5V7QqUXOuW/KxFtp4+REworE7pO6dfn6FwP2q74Z6+XV4FVKr3WFN/EO rswiNsRdFA8VIS/12l849bl86IBQCXWakjlpFk+YbXJx+qDJFxKyK1XbQkbQihqudOJz T3NDAvsx1RnkfNUIWW/H2P2uehTjjFzjaW3JDs98h0NtXRVdyJUpemzmUT+FFL0BpTHj wbg88Ft5cSiHjC1KhW4MrniAzqWwQSGthzY6ZUmg3nJpDtKwCpe7SmG0tlQtUCjjUNzQ +vqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :dmarc-filter:delivered-to; bh=TRCkTVHEImMF3HDws+AVS/MzVybmkrCYo+GmYqumVw8=; b=w6nhthOPBQlf9ZThQp5nL0BTaFkjnMLqij0zIWgtjCo6dD/bxTUtA4Bn7A6gk28JrO dscStqRhJ5WANCSkrgDz4XQgk9Q1G6e3zpJBJ8qxrxyM1kmDtJMKIYGiklomKfZJCN51 bTJvxZkPgoIApiUW80q1Ooq/1vLAMD1A/TKFF2/9CwgxcRVUsXgMV7se2/7ecjKYhTsJ JcA3Rres/bBoXw8cVOFvTZLicWXCf+BBPWJEFZtCcOhlV4XfYM1Rsut+PSBQGRCWD6/f xxR467X4Elt7bcVksbRW1EsG3JHImVED+w27q+5qgufC1MY2Jgh82BPIkc+0bb3s5GNH W0ZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@vrull.eu header.s=google header.b=gdDJei63; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id sd20-20020a1709076e1400b0078d112eaf80si9788880ejc.86.2022.11.27.09.04.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Nov 2022 09:04:17 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@vrull.eu header.s=google header.b=gdDJei63; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1A5D63853D48 for ; Sun, 27 Nov 2022 17:04:13 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by sourceware.org (Postfix) with ESMTPS id CFEDD3858C83 for ; Sun, 27 Nov 2022 17:03:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CFEDD3858C83 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=vrull.eu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=vrull.eu Received: by mail-ej1-x635.google.com with SMTP id vp12so19382741ejc.8 for ; Sun, 27 Nov 2022 09:03:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vrull.eu; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=TRCkTVHEImMF3HDws+AVS/MzVybmkrCYo+GmYqumVw8=; b=gdDJei63YqyVfxIayYNkEhenC5TUZGIghTMS+iimW8h4+ebRB9tgelJAzMsiMui0aY DASCBiPgcTuU7jcSi3AC5FBFJXD0wq0ifPAD6U0aXDj/VmrmvlLGaxtOC/QNcxlhKW+x uda8rF+nEk9xQFXJNXgQyv6b2R1jj7OLgGg8cRgmm3XRoNiBAuyEuJXWoyEx+VNba+gC ZFu9813lCXY5/bSDG/RXio0u0PpBS58GGf6daSU5Fr+gtmSUJ/cQ9NhKpoNQaEFXF4Kb /b1r9t2xhxPW/AGvEqWbkvqupe/BNOQjo3AfSu05k48+pEVjO9/VuCdZ94YgXcB0IDbW loTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=TRCkTVHEImMF3HDws+AVS/MzVybmkrCYo+GmYqumVw8=; b=GhjjMOZ3f8pXJoWeHK/B0v/dbzoGSqjV0D728i2NlOlblwDBsn/9gpxoPuUy5zxNiS sEezR1ZovUnS0S+P8NefR+/9kPYLs+4AF38g4/HSXweBk8irn2mxgs1tOA6lvf8RBFUa wWjZ46/Cw9PFlntPRlZOpq13pczPPgXqNvNotGI2lgiSKswSqqoS3AbG83fryfMr6EzO ywtP7N35b6kUdvFO10UVsctQBy850oQJXMMu8eB5zOTMtFhxMwbm9C+U8PZ7aFoLS2QS C8JpJxGKuqoIV7DhQm68PUJIzkWaQ1Ngw2na9tS1OOAvM8C+jVcs2CNraVRywF6Ly4et r+3g== X-Gm-Message-State: ANoB5pl/fxPtMLfoS8I1EYzeKJUsLT4FN83M7Efqel11/Ne+CE8Uruhi t+RclY6ur/ZGXrYch+ERS6imFOdeT9etXg== X-Received: by 2002:a17:907:77d6:b0:78d:e26f:bfd8 with SMTP id kz22-20020a17090777d600b0078de26fbfd8mr40565959ejc.482.1669568627295; Sun, 27 Nov 2022 09:03:47 -0800 (PST) Received: from beast.fritz.box (62-178-148-172.cable.dynamic.surfer.at. [62.178.148.172]) by smtp.gmail.com with ESMTPSA id w21-20020a170906385500b0077a201f6d1esm3940267ejc.87.2022.11.27.09.03.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Nov 2022 09:03:46 -0800 (PST) From: Christoph Muellner To: gcc-patches@gcc.gnu.org, Kito Cheng , Palmer Dabbelt , Philipp Tomsich , Jeff Law Cc: =?utf-8?q?Christoph_M=C3=BCllner?= Subject: [PATCH v2] RISC-V: Add support for AIA ISA extensions (Ssaia and Smaia) Date: Sun, 27 Nov 2022 18:02:56 +0100 Message-Id: <20221127170256.3803408-1-christoph.muellner@vrull.eu> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, JMQ_SPF_NEUTRAL, 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 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: , 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?1750669624039847711?= X-GMAIL-MSGID: =?utf-8?q?1750669624039847711?= From: Christoph Müllner This patch adds support for the two AIA ISA extensions Ssaia and Smaia. They are not relelvant for the compiler, but the assembler might want to validate the CSRs. Therefore, all this patch does is recognize the extension name, emit a feature macro (incl. a test). Changes for v2: - Imply "ssaia" with "smaia" - Adding comment to invoke.texi as requested by Palmer Signed-off-by: Christoph Müllner --- gcc/common/config/riscv/riscv-common.cc | 4 ++++ gcc/doc/invoke.texi | 4 ++++ gcc/testsuite/gcc.target/riscv/smaia.c | 18 ++++++++++++++++++ gcc/testsuite/gcc.target/riscv/ssaia.c | 13 +++++++++++++ 4 files changed, 39 insertions(+) create mode 100644 gcc/testsuite/gcc.target/riscv/smaia.c create mode 100644 gcc/testsuite/gcc.target/riscv/ssaia.c diff --git a/gcc/common/config/riscv/riscv-common.cc b/gcc/common/config/riscv/riscv-common.cc index 4b7f777c103..a1e7d9c3787 100644 --- a/gcc/common/config/riscv/riscv-common.cc +++ b/gcc/common/config/riscv/riscv-common.cc @@ -108,6 +108,8 @@ static const riscv_implied_info_t riscv_implied_info[] = {"zhinx", "zhinxmin"}, {"zhinxmin", "zfinx"}, + {"smaia", "ssaia"}, + {NULL, NULL} }; @@ -219,6 +221,8 @@ static const struct riscv_ext_version riscv_ext_version_table[] = {"zmmul", ISA_SPEC_CLASS_NONE, 1, 0}, + {"smaia", ISA_SPEC_CLASS_NONE, 1, 0}, + {"ssaia", ISA_SPEC_CLASS_NONE, 1, 0}, {"svinval", ISA_SPEC_CLASS_NONE, 1, 0}, {"svnapot", ISA_SPEC_CLASS_NONE, 1, 0}, diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 202388b3fb8..a24c6fe2499 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -28662,6 +28662,10 @@ If both @option{-march} and @option{-mcpu=} are not specified, the default for this argument is system dependent, users who want a specific architecture extensions should specify one explicitly. +Note, that AIA support (@samp{Smaia} and @samp{Ssaia}) is based on an AIA +specification, which is frozen but contains draft chapters ("Duo-PLIC" and +"IOMMU Support"). + @item -mcpu=@var{processor-string} @opindex mcpu Use architecture of and optimize the output for the given processor, specified diff --git a/gcc/testsuite/gcc.target/riscv/smaia.c b/gcc/testsuite/gcc.target/riscv/smaia.c new file mode 100644 index 00000000000..497b4133c22 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/smaia.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gc_smaia" { target { rv64 } } } */ +/* { dg-options "-march=rv32gc_smaia" { target { rv32 } } } */ + +#ifndef __riscv_smaia +#error Feature macro not defined +#endif + +// Smaia implies Ssaia +#ifndef __riscv_ssaia +#error Feature macro not defined +#endif + +int +foo (int a) +{ + return a; +} diff --git a/gcc/testsuite/gcc.target/riscv/ssaia.c b/gcc/testsuite/gcc.target/riscv/ssaia.c new file mode 100644 index 00000000000..b20e0eb10f5 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/ssaia.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gc_ssaia" { target { rv64 } } } */ +/* { dg-options "-march=rv32gc_ssaia" { target { rv32 } } } */ + +#ifndef __riscv_ssaia +#error Feature macro not defined +#endif + +int +foo (int a) +{ + return a; +}