Message ID | 92fad87801003eaa4cf9f47a1ab8d6e6f015ed12.1697866371.git.research_trasio@irq.a4lg.com |
---|---|
State | Accepted |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce89:0:b0:403:3b70:6f57 with SMTP id p9csp130298vqx; Fri, 20 Oct 2023 22:33:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGz/C/4VtBukrKGt3B0m8gMN44QHa/AjA/D5G6vpDk7e95wlBW9E9U/1ZIw7W+nANCRSYML X-Received: by 2002:a05:6214:27c5:b0:65b:21bf:8fc1 with SMTP id ge5-20020a05621427c500b0065b21bf8fc1mr4284553qvb.42.1697866412910; Fri, 20 Oct 2023 22:33:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697866412; cv=pass; d=google.com; s=arc-20160816; b=h+OCs6F++ZLtB4v4vXgNfe0xnP7c0Otta90pS1ZIzOWng0YMx91czNMY3rsZwNm2iO TbXKBOAWn9Abj3eY09PVpJgKub9u0pXXCl+1Lzmh6sRaO6hNwTbu8PjVIjpRQtT+BbPG +t55T/LwY0G16Ja64jKQXL//icGqhKUSU1C9gGJeejidz/fCrqwpOBdODgO9gSVOR2m5 M5jfyOjFrmd91upd78E1+f6t1oHVtvO3G9DfuwShvCoLQk8+QTs5M9jaEyH8yL7Lrhel 6XJ5JyFXU6ELxy2+CU56Ff4Of6sD1Dzz5ouVcUUl7aGNyFAmdvzDYDVsMIYO3SDcuBz1 19VQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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 :arc-filter:dmarc-filter:delivered-to; bh=cvh7htzG+ZDggVCwFCN+jLJTxSgJK5Vknw5VIgekCjA=; fh=HKgiOHUFLyfVG2npWMLYE8/3Ecp4EiEdadhQOzpm3aI=; b=BnbywdpNZoFNjf47RgOHGbbCSYP5MheSw1G9d0omWXuPIUMxxvnEBxvJL5etFTlkaC bt97CXllB6B3epxaA22aUV+YXv9mTLZ0/h0KWpDhnbUYJPdHriK49DfOZMbL7edhXmRY MurcBygQPD/WmyCnTdUGTafMEZKU5ota+29o2P51P2agFPAKqbJEzJWuuxdVlfbZ2OHY 43cKC7ffusfsNh64FkAEbCLF+HTMpvzWpWZ88bKwbYDfAQ5H+22YOOwsBFkrUXLr3MDm YDvCQRvJsRv7CyHXIbVzIIaK7zW9WtgEWGObcPF9t22AfOuvs9SMEO/23XXEzjW7dBxz udxw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@irq.a4lg.com header.s=2017s01 header.b=QSZNf+40; arc=pass (i=1); 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=irq.a4lg.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id l15-20020ad4452f000000b0065b11081339si2498522qvu.417.2023.10.20.22.33.32 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:33:32 -0700 (PDT) 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=@irq.a4lg.com header.s=2017s01 header.b=QSZNf+40; arc=pass (i=1); 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=irq.a4lg.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AD6EA3857806 for <ouuuleilei@gmail.com>; Sat, 21 Oct 2023 05:33:32 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-sender-0.a4lg.com (mail-sender-0.a4lg.com [IPv6:2401:2500:203:30b:4000:6bfe:4757:0]) by sourceware.org (Postfix) with ESMTPS id 8EA60385842C for <gcc-patches@gcc.gnu.org>; Sat, 21 Oct 2023 05:33:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8EA60385842C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=irq.a4lg.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=irq.a4lg.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8EA60385842C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2401:2500:203:30b:4000:6bfe:4757:0 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697866392; cv=none; b=bYhcdKO/3dOMyqgZw5C4w3xGtd0X/oN8wuc/Lj7TiHRAhzBF8bxIgL8CKVOq7s57b3xAlYsWboaLSLNiyNrdJzmfIOMyRXMBAwcRjtdKN91yjwQxp/wExhhYT6x5kDUniaV5K0bf4JMV2damn8nBqHA0/I8mB9AXB4qyTzBJuo0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697866392; c=relaxed/simple; bh=pCllCmP+BRwMfzaRe+tJuY6FNitgMWM8usqq0ykb1Gw=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:Mime-Version; b=eJb9FcAN9xuujsU5A5hJ+PTAstMZyeHaI3Co38CslnVOVhiXDgQFBF6L1rbUyZIoG4SKOl4p7ryRib+bgM1AurmPW481OO+KLAgF8HCr7f640QSgDyhJluzSvoxK5PcJA0DQ/RZxAoIcJBZt6xOnbvbxYD/WZ00Yq81wjgGm+P4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from [127.0.0.1] (localhost [127.0.0.1]) by mail-sender-0.a4lg.com (Postfix) with ESMTPSA id 84450300089; Sat, 21 Oct 2023 05:32:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irq.a4lg.com; s=2017s01; t=1697866379; bh=cvh7htzG+ZDggVCwFCN+jLJTxSgJK5Vknw5VIgekCjA=; h=From:To:Cc:Subject:Date:Message-ID:Mime-Version: Content-Transfer-Encoding; b=QSZNf+40SRPLTJXjxa+SxmCEypkXcM6eudIDOSDDvYIYTqu0UUIRQLzfpHDE2r8na 748/6+dbfR0QRYIX1vfk4qr7H4IAZoPGAyJ2KPW0rqhZUrSg+ukDu9znLiXD8DTopW wlSceM7vZgTOY4NHcxSjAZU4pTGdbgQNl8erp2Jk= From: Tsukasa OI <research_trasio@irq.a4lg.com> To: Tsukasa OI <research_trasio@irq.a4lg.com>, Kito Cheng <kito.cheng@gmail.com>, Palmer Dabbelt <palmer@dabbelt.com>, Andrew Waterman <andrew@sifive.com>, Jim Wilson <jim.wilson.gcc@gmail.com>, Jeff Law <jeffreyalaw@gmail.com> Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] RISC-V: Prohibit combination of 'E' and 'H' Date: Sat, 21 Oct 2023 05:32:56 +0000 Message-ID: <92fad87801003eaa4cf9f47a1ab8d6e6f015ed12.1697866371.git.research_trasio@irq.a4lg.com> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, GIT_PATCH_0, KAM_MANYTO, KAM_SHORT, 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.30 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780341971898462899 X-GMAIL-MSGID: 1780341971898462899 |
Series |
RISC-V: Prohibit combination of 'E' and 'H'
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | success | Github commit url |
Commit Message
Tsukasa OI
Oct. 21, 2023, 5:32 a.m. UTC
From: Tsukasa OI <research_trasio@irq.a4lg.com> According to the ratified privileged specification (version 20211203), it says: > The hypervisor extension depends on an "I" base integer ISA with 32 x > registers (RV32I or RV64I), not RV32E, which has only 16 x registers. Also in the latest draft, it also prohibits RV64E with the 'H' extension. This commit prohibits the combination of 'E' and 'H' extensions. gcc/ChangeLog: * common/config/riscv/riscv-common.cc (riscv_subset_list::parse): Prohibit 'E' and 'H' combinations. gcc/testsuite/ChangeLog: * gcc.target/riscv/arch-26.c: New test. --- gcc/common/config/riscv/riscv-common.cc | 4 ++++ gcc/testsuite/gcc.target/riscv/arch-26.c | 4 ++++ 2 files changed, 8 insertions(+) create mode 100644 gcc/testsuite/gcc.target/riscv/arch-26.c base-commit: 66c26e5cfdf65ae024fcb658629dc5a9a10f3f85
Comments
On 10/20/23 23:32, Tsukasa OI wrote: > From: Tsukasa OI <research_trasio@irq.a4lg.com> > > According to the ratified privileged specification (version 20211203), > it says: > >> The hypervisor extension depends on an "I" base integer ISA with 32 x >> registers (RV32I or RV64I), not RV32E, which has only 16 x registers. > > Also in the latest draft, it also prohibits RV64E with the 'H' extension. > This commit prohibits the combination of 'E' and 'H' extensions. > > gcc/ChangeLog: > > * common/config/riscv/riscv-common.cc (riscv_subset_list::parse): > Prohibit 'E' and 'H' combinations. > > gcc/testsuite/ChangeLog: > > * gcc.target/riscv/arch-26.c: New test. In a similar vein, GCC doesn't really care about the privileged extensions. So this won't really affect code generation. So I'll ACK, but going forward let's start doing the regression test. If you need help setting that up, I'm sure someone here can make suggestions. Personally I prefer a qemu+binfmt setup as it doesn't require setting up a board file and explicitly calling the simulator, ie, it looks a lot like native testing. jeff
On 2023/10/22 3:04, Jeff Law wrote: > > > On 10/20/23 23:32, Tsukasa OI wrote: >> From: Tsukasa OI <research_trasio@irq.a4lg.com> >> >> According to the ratified privileged specification (version 20211203), >> it says: >> >>> The hypervisor extension depends on an "I" base integer ISA with 32 x >>> registers (RV32I or RV64I), not RV32E, which has only 16 x registers. >> >> Also in the latest draft, it also prohibits RV64E with the 'H' extension. >> This commit prohibits the combination of 'E' and 'H' extensions. >> >> gcc/ChangeLog: >> >> * common/config/riscv/riscv-common.cc (riscv_subset_list::parse): >> Prohibit 'E' and 'H' combinations. >> >> gcc/testsuite/ChangeLog: >> >> * gcc.target/riscv/arch-26.c: New test. > In a similar vein, GCC doesn't really care about the privileged > extensions. So this won't really affect code generation. So I'll ACK, > but going forward let's start doing the regression test. If you need > help setting that up, I'm sure someone here can make suggestions. > Personally I prefer a qemu+binfmt setup as it doesn't require setting up > a board file and explicitly calling the simulator, ie, it looks a lot > like native testing. > > jeff > Thanks for reviewing. I'll commit two patches soon. Yes, for GCC, privileged extensions (and version numbers) are not important in general (unless toolchain conventions create privileged built-in functions). Intents of my two small patch sets are: 1. Allow inline assembly to use new/privileged extensions. 2. Allow/disallow same -march for both CC and AS (as possible). 3. (As long as no major compatibility breakage happens), make both GCC and Binutils faithful to the specification and the current status (that would also improve interoperability). Hmm, I generally agree with your opinion and I made a board file for DejaGnu (running qemu-riscv64) to run "make check-gcc RUNTESTFLAGS='--target_board=riscv-sim riscv.exp'" because it already contains many execute tests (and annoys me if I don't do that). What I'm not sure is, what kind of regression tests we need? (In my mind) Level 1: Make nearly empty program with specific -march (and optionally -mabi?) and make sure that it works. Level 2: Make a program with inline assembly and execute tests with specific configurations (with specific -march and -mabi) [I'm not sure how to write **and optionally execute tests**] I would like to hear your thoughts. Thanks, Tsukasa
On 10/21/23 19:33, Tsukasa OI wrote: > > Hmm, I generally agree with your opinion and I made a board file for > DejaGnu (running qemu-riscv64) to run "make check-gcc > RUNTESTFLAGS='--target_board=riscv-sim riscv.exp'" because it already > contains many execute tests (and annoys me if I don't do that). > > What I'm not sure is, what kind of regression tests we need? > > (In my mind) > Level 1: Make nearly empty program with specific -march (and optionally > -mabi?) and make sure that it works. > Level 2: Make a program with inline assembly and execute tests with > specific configurations (with specific -march and -mabi) > [I'm not sure how to write **and optionally execute tests**] > > I would like to hear your thoughts. So I don't think we need to do a large matrix of extensions or anything like that. Whatever config you usually build should be sufficient. What most folks do is a make -k check before/after their patch and compare the results. That's the standard. If you change a target independent file, then the standard would be to bootstrap and regression test on x86 or similar primary architecture. Jeff
diff --git a/gcc/common/config/riscv/riscv-common.cc b/gcc/common/config/riscv/riscv-common.cc index d7216285c648..36201559deff 100644 --- a/gcc/common/config/riscv/riscv-common.cc +++ b/gcc/common/config/riscv/riscv-common.cc @@ -1495,6 +1495,10 @@ riscv_subset_list::parse (const char *arch, location_t loc) error_at (loc, "%<-march=%s%>: z*inx conflicts with floating-point " "extensions", arch); + /* 'H' hypervisor extension requires base ISA with 32 registers. */ + if (subset_list->lookup ("e") && subset_list->lookup ("h")) + error_at (loc, "%<-march=%s%>: h extension requires i extension", arch); + return subset_list; fail: diff --git a/gcc/testsuite/gcc.target/riscv/arch-26.c b/gcc/testsuite/gcc.target/riscv/arch-26.c new file mode 100644 index 000000000000..0b48bc945b58 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/arch-26.c @@ -0,0 +1,4 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32eh -mabi=ilp32e" } */ +int foo() {} +/* { dg-error "'-march=rv32eh': h extension requires i extension" "" { target *-*-* } 0 } */