From patchwork Fri Nov 18 02:12:23 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: 22062 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp735055wrr; Thu, 17 Nov 2022 18:15:15 -0800 (PST) X-Google-Smtp-Source: AA0mqf5rOFO8hbGf1hBRQt3CecgM3+b8RwhxZnAY++K9p/QmMs9BYvx0Uy0POakIWDJ4k0nhbvdo X-Received: by 2002:a50:fb05:0:b0:464:718c:b266 with SMTP id d5-20020a50fb05000000b00464718cb266mr4318885edq.320.1668737715572; Thu, 17 Nov 2022 18:15:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668737715; cv=none; d=google.com; s=arc-20160816; b=t+ltg9B7JP2ggQqQAsoO6QdmaVM4mGGCByCvp/Df21h+xGIFphZngAjsjD3NtiXrCt tj+enTG7ZkTIuAMVpxnCzlmumwJ8nCvSzglSmmNur9yFFsgNohWN9O+y+rmgtka5iFsr oyrSjyu/JMGFECXLMtwQ1g0UKmKVBMcRxZEBz26l5KnUSnikxB3M03kkOrcJyJe0VZYt 7v5f9da36m6V8rwx+UDzkJMzsd+7r/wRsP7T/z6vazHzmI55Dw1FKzIfXBQktAa2jaYo tabOADmsfjk2TeCyHCbrcAHqd81ZBVSxltxtGukhWZSk+Il54zyQ5pQ4KGjpv5f7AC8J dejg== 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=1puhCWYYlcNH+J4Sp9bR4gxPCDxxAPLygIQgBStlxLc=; b=eZI/qpMLawBtinNls38hypcCVu5CtUuoOvzd1ca9aQ9uWDXq5OvPKT8oOWJzIbHUE+ Z2TdT+5wnOJCepb2TQBB4laMAD1n8LzQ4Pk569RZnOoUXA1G5biEkRNRxPqDg6gT+zbU d6BHY93ssWmjykeiH9fbgFLr5GWDm8vzCP+Uf4khMKSC1SCKI1Dza5df5o5VYK/1PtRJ 42kZmsvP8tC4IIVqsLgSvYTXLvK0aJHlFpyQzt3GuAzLdEJDyT7lsN+t3Zddc7Xezir4 tShpzoZo4zCLdRXxxkOeTKlTjdAKIkHQTb71pf/CBPSgInS+/CDtQIJ1WVxGA21qGPpy 6ijg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@vrull.eu header.s=google header.b="o/3RD8N3"; 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" Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id hb31-20020a170907161f00b00732fa9d3df0si1943349ejc.795.2022.11.17.18.15.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 18:15:15 -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=@vrull.eu header.s=google header.b="o/3RD8N3"; 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" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 874F23839F45 for ; Fri, 18 Nov 2022 02:12:53 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by sourceware.org (Postfix) with ESMTPS id 9284C3842313 for ; Fri, 18 Nov 2022 02:12:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9284C3842313 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-ed1-x530.google.com with SMTP id a5so5189724edb.11 for ; Thu, 17 Nov 2022 18:12:28 -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=1puhCWYYlcNH+J4Sp9bR4gxPCDxxAPLygIQgBStlxLc=; b=o/3RD8N3knU250g2Td1J9irOu6gONEKlVUEZR0n0RKO2OQjdX2POSK0KG6gub3zTi2 zoxAZe9HOCdlu6/alUl/vFigRRO0hDdkL+FKOYipMxmUTJITNpCe9lRwUx6dzOpcVx8M fpj4OOi3ZgYP6MAF+HaklmEvWqNwWJFs08amj0WDl2izPbhnYejzxs6NZanNw7t2B1gN hfiZr4JBFwUtKXxuHOg7sWccd86X72wyDc+acOO3DKlaH/XN/C8I7FgA++zNH9KUCWf9 BrHDViovM4/rdyQPjyPuuXmTGkqEZglja9SOiE+g4ddSdBL2lAftwtz4Or/qA2MeA3ib xH+w== 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=1puhCWYYlcNH+J4Sp9bR4gxPCDxxAPLygIQgBStlxLc=; b=73QtTdBxwRIZwKmgTGv88fRoCmnRkp/dbe/t3Fhbxil6qdAPmQ3gb9BLt36DTNSjt1 9RMQBRnPFhAAca28XboZ81wMlRrVUJQzYInlt16XwofC2Q4bpJA1PQKCYIb4sSelfljj 8mbfAke7ph8XyXYyA1koeJ2NxyYMC2VLG0Fwah45EQkRbNXLHTvpQfCvyRSHUirZ6BRl 4aHZlfHT+VVAMYXaNPruLq7/XgQGFMjqO4oL/UzxReujiFRJnWZCrhHUiGnRFhwnmCy+ uZSifOhWV5KrclL0MXZryWk0MOp2Hx6gNpBV+7jNSL4SiaNMIfQTAVa7Gzu/S7K2T/zQ 5atw== X-Gm-Message-State: ANoB5plSNc96SKgPH9cjtAfz4L0qzG2rxkFr0Jsh6CpxGx5NGsxw67sk xKiNfyUGLTNGkxT9NJmRqY7BLub9ZfjvdFJj X-Received: by 2002:aa7:c3c2:0:b0:457:791d:8348 with SMTP id l2-20020aa7c3c2000000b00457791d8348mr4417192edr.306.1668737547194; Thu, 17 Nov 2022 18:12:27 -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 ew5-20020a056402538500b004619f024864sm1186079edb.81.2022.11.17.18.12.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 18:12:26 -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] RISC-V: Add support for AIA ISA extensions (Ssaia and Smaia) Date: Fri, 18 Nov 2022 03:12:23 +0100 Message-Id: <20221118021223.348112-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?1749798318974257590?= X-GMAIL-MSGID: =?utf-8?q?1749798318974257590?= 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). 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; +}