From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by sourceware.org (Postfix) with ESMTPS id 65ADA384F6E3 for ; Fri, 18 Nov 2022 05:09:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 65ADA384F6E3 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=dabbelt.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=dabbelt.com Received: by mail-pl1-x62f.google.com with SMTP id k7so3607100pll.6 for ; Thu, 17 Nov 2022 21:09:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dabbelt-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:to:from:cc :in-reply-to:subject:date:from:to:cc:subject:date:message-id :reply-to; bh=/yoaB7o6WXn7dXSDhTNRdlcz1CpNjt3iVhDb88YnLlo=; b=N9QtKrv/pswUJP+Yq4qwab1clAZG31qSBqESsHUMyE+f4HhMpXfPfXCbjL76c/FKdW 7eEC9DeJkD1zhN10IneA/c4RaEzM6doq1LWL0QxKiAR29a3xq56gkOiGWGjt1cpcUYRi scRTwKj4J6BTPOqqJc8bAUJk8DJNO/rhObGCmEvvmxkUZoTzZ0q6oyprWoC++SBJ1Y0h EuPZKMyKx/FAOFQOcYPPjtGOExuLwWSWrvOvKO1cX8IbIBXE9WEjEAGhw1Fu0N3TkuMy nSA6JhrmPpS6l38FRYwwUnHMFv3rdkh8T99W282ei9fVnYLZLXsrARJwryFynu8s3Shx swXg== 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:to:from:cc :in-reply-to:subject:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=/yoaB7o6WXn7dXSDhTNRdlcz1CpNjt3iVhDb88YnLlo=; b=uFd03RdqcGbOYonGEqkRQYdBpJSsKqZBq8mBoC2R/cPpUGZ1Pc6u0fcyThiqunM2nd B1Z4Aok5kgIwTUf4+vnDbDQ+xOzq+0z1AoPXPlZkxCWO3G4S//wJ8pkd4UX0PqWKX4tD Nf4f0INGTDVrribzKQ7REuyEju2Zcju/M33kGoTq4x0QAxD/K9X4+Efd3n2/kpKTBtWq pIrPR+xgH67ASuqKuvxa0yYLA6UeDamSgAmJXx0tXcXSnW5iRqVnnUS9VVDC0ocfZwSP IP5Ldi5DVFGopWoalT33sb50D/BD6Wm2f/IqedHd442E8f9wIf5CLStetAUWtrynLnSA sHGA== X-Gm-Message-State: ANoB5pkPECKsAQfTFmC4ygLGkM8HpBc5KdiIPqmB/utH5MwI6oCDhZmd K7/dMbggBTHaWKg9ScLOU3otTaUmnHaebw== X-Google-Smtp-Source: AA0mqf5UqOX68rbnfLwcT6OX1nMbyCMNNiVbck6duc4hOz9hKQIBNyyCvc4J1E20XKFOFBdc8Hc2pA== X-Received: by 2002:a17:902:e2d3:b0:187:2430:d37d with SMTP id l19-20020a170902e2d300b001872430d37dmr5986662plc.28.1668748186023; Thu, 17 Nov 2022 21:09:46 -0800 (PST) Received: from localhost ([50.221.140.188]) by smtp.gmail.com with ESMTPSA id t4-20020a170902e84400b001767f6f04efsm2404543plg.242.2022.11.17.21.09.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 21:09:45 -0800 (PST) Date: Thu, 17 Nov 2022 21:09:45 -0800 (PST) X-Google-Original-Date: Thu, 17 Nov 2022 21:09:40 PST (-0800) Subject: Re: [PATCH] RISC-V: Add support for AIA ISA extensions (Ssaia and Smaia) In-Reply-To: <20221118021223.348112-1-christoph.muellner@vrull.eu> CC: gcc-patches@gcc.gnu.org, kito.cheng@sifive.com, philipp.tomsich@vrull.eu, jeffreyalaw@gmail.com, christoph.muellner@vrull.eu From: Palmer Dabbelt To: christoph.muellner@vrull.eu Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,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 Thu, 17 Nov 2022 18:12:23 PST (-0800), christoph.muellner@vrull.eu wrote: > 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). This is pretty far in the weeds, but the AIA PDF says extension Smaia encompasses all added CSRs and all modifications to interrupt response behavior that the AIA specifies for a hart, over all privilege levels but only a subset of AIA has been frozen. I think that's fine, assuming we're decoupling ourselves from the ISA strings (and thus extension names). We just need to document it somewhere -- presumably invoke, but that doesn't document anything else yet so we don't really have a pattern to match. > Signed-off-by: Christoph Müllner > --- > gcc/common/config/riscv/riscv-common.cc | 2 ++ > gcc/testsuite/gcc.target/riscv/smaia.c | 13 +++++++++++++ > gcc/testsuite/gcc.target/riscv/ssaia.c | 13 +++++++++++++ > 3 files changed, 28 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..674eded07b7 100644 > --- a/gcc/common/config/riscv/riscv-common.cc > +++ b/gcc/common/config/riscv/riscv-common.cc > @@ -219,6 +219,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/testsuite/gcc.target/riscv/smaia.c b/gcc/testsuite/gcc.target/riscv/smaia.c > new file mode 100644 > index 00000000000..9ca80236245 > --- /dev/null > +++ b/gcc/testsuite/gcc.target/riscv/smaia.c > @@ -0,0 +1,13 @@ > +/* { 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 > + > +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; > +}