public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
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 v2 2/3] RISC-V: Add stub support for existing extensions (vendor)
Date: Mon, 14 Aug 2023 06:09:52 +0000	[thread overview]
Message-ID: <0404a8f4c12a3a2798f0ca18313949b9f268d305.1691993380.git.research_trasio@irq.a4lg.com> (raw)
In-Reply-To: <cover.1691993380.git.research_trasio@irq.a4lg.com>

From: Tsukasa OI <research_trasio@irq.a4lg.com>

After commit c283c4774d1c ("RISC-V: Throw compilation error for unknown
extensions") changed how do we handle unknown extensions, we have no
guarantee that we can share the same architectural string with Binutils
(specifically, the assembler).

To avoid compilation errors on shared Assembler-C/C++ projects, GCC should
support almost all extensions that Binutils support, even if the GCC does
not touch a thing.

This commit adds stub supported vendor extensions to
riscv_ext_version_table (no riscv_implied_info entries to add; all
information is copied from Binutils' bfd/elfxx-riscv.c).

gcc/ChangeLog:

	* common/config/riscv/riscv-common.cc (riscv_ext_version_table):
	Add stub support for all vendor extensions supported by Binutils.

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/predef-30.c: New test for a stub
	vendor extension 'XVentanaCondOps'.
---
 gcc/common/config/riscv/riscv-common.cc    |  2 ++
 gcc/testsuite/gcc.target/riscv/predef-30.c | 27 ++++++++++++++++++++++
 2 files changed, 29 insertions(+)
 create mode 100644 gcc/testsuite/gcc.target/riscv/predef-30.c

diff --git a/gcc/common/config/riscv/riscv-common.cc b/gcc/common/config/riscv/riscv-common.cc
index 91b0316acfea..0c351105e015 100644
--- a/gcc/common/config/riscv/riscv-common.cc
+++ b/gcc/common/config/riscv/riscv-common.cc
@@ -298,6 +298,8 @@ static const struct riscv_ext_version riscv_ext_version_table[] =
   {"xtheadmempair", ISA_SPEC_CLASS_NONE, 1, 0},
   {"xtheadsync", ISA_SPEC_CLASS_NONE, 1, 0},
 
+  {"xventanacondops", ISA_SPEC_CLASS_NONE, 1, 0},
+
   /* Terminate the list.  */
   {NULL, ISA_SPEC_CLASS_NONE, 0, 0}
 };
diff --git a/gcc/testsuite/gcc.target/riscv/predef-30.c b/gcc/testsuite/gcc.target/riscv/predef-30.c
new file mode 100644
index 000000000000..9784b9ce5033
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/predef-30.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64i_xventanacondops -mabi=lp64 -mcmodel=medlow -misa-spec=20191213" } */
+
+int main () {
+
+#ifndef __riscv_arch_test
+#error "__riscv_arch_test"
+#endif
+
+#if __riscv_xlen != 64
+#error "__riscv_xlen"
+#endif
+
+#if !defined(__riscv_i) || (__riscv_i != (2 * 1000 * 1000 + 1 * 1000))
+#error "__riscv_i"
+#endif
+
+#if defined(__riscv_e)
+#error "__riscv_e"
+#endif
+
+#if !defined(__riscv_xventanacondops)
+#error "__riscv_xventanacondops"
+#endif
+
+  return 0;
+}
-- 
2.41.0


  parent reply	other threads:[~2023-08-14  6:10 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-12  2:57 [PATCH 0/3] RISC-V: Add stub support for existing extensions Tsukasa OI
2023-08-12  2:57 ` [PATCH 1/3] RISC-V: Add stub support for existing extensions (privileged) Tsukasa OI
2023-08-12  2:57 ` [PATCH 2/3] RISC-V: Add stub support for existing extensions (vendor) Tsukasa OI
2023-08-12  2:57 ` [PATCH 3/3] RISC-V: Add stub support for existing extensions (unprivileged) Tsukasa OI
2023-08-14  6:09 ` [PATCH v2 0/3] RISC-V: Add stub support for existing extensions Tsukasa OI
2023-08-14  6:09   ` [PATCH v2 1/3] RISC-V: Add stub support for existing extensions (privileged) Tsukasa OI
2023-08-14  6:09   ` Tsukasa OI [this message]
2023-08-14  6:09   ` [PATCH v2 3/3] RISC-V: Add stub support for existing extensions (unprivileged) Tsukasa OI
2023-08-29  1:42     ` Jeff Law
2023-08-29  3:14       ` Tsukasa OI
2023-08-14  6:17   ` [PATCH v2 0/3] RISC-V: Add stub support for existing extensions Tsukasa OI
2023-08-29  3:39   ` [PATCH v3 " Tsukasa OI
2023-08-29  3:39     ` [PATCH v3 1/3] RISC-V: Add stub support for existing extensions (privileged) Tsukasa OI
2023-08-29 13:41       ` Jeff Law
2023-08-29  3:39     ` [PATCH v3 2/3] RISC-V: Add stub support for existing extensions (vendor) Tsukasa OI
2023-08-29 13:42       ` Jeff Law
2023-08-29  3:39     ` [PATCH v3 3/3] RISC-V: Add stub support for existing extensions (unprivileged) Tsukasa OI
2023-08-29 13:42       ` Jeff Law

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0404a8f4c12a3a2798f0ca18313949b9f268d305.1691993380.git.research_trasio@irq.a4lg.com \
    --to=research_trasio@irq.a4lg.com \
    --cc=andrew@sifive.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jeffreyalaw@gmail.com \
    --cc=jim.wilson.gcc@gmail.com \
    --cc=kito.cheng@gmail.com \
    --cc=palmer@dabbelt.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).