From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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-Google-Smtp-Source: AA0mqf6FMr2v5YHosyJpjlwFz4JwLMfxRgColH2Im8rXbCPuCQKhypRSqSoNa3I40I105S7qROCqFA== 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=20M=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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 List-Id: 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; +} -- 2.38.1