public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
From: Tsukasa OI <a4lg@sourceware.org>
To: bfd-cvs@sourceware.org
Subject: [binutils-gdb] RISC-V: Prohibit the 'Zcf' extension on RV64
Date: Mon, 24 Jul 2023 23:43:43 +0000 (GMT)	[thread overview]
Message-ID: <20230724234343.DE12D3858C5F@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=766f6d170c56d1d7b03e81f64d069386d0a7c5dd

commit 766f6d170c56d1d7b03e81f64d069386d0a7c5dd
Author: Tsukasa OI <research_trasio@irq.a4lg.com>
Date:   Mon Jul 24 05:01:12 2023 +0000

    RISC-V: Prohibit the 'Zcf' extension on RV64
    
    As per:
    <https://github.com/riscv/riscv-code-size-reduction/issues/221>,
    the 'Zcf' extension does not exist on RV64.  This is reflected on the
    version 1.0.4-1 of the code size reduction specification:
    <https://github.com/riscv/riscv-code-size-reduction/releases/tag/v1.0.4-1>.
    
    This commit prohibits the combination: RV64 (or any ISA with XLEN > 32)
    and the 'Zcf' extension.
    
    bfd/ChangeLog:
    
            * elfxx-riscv.c (riscv_parse_check_conflicts): Prohibit
            combination of RV64 and 'Zcf'.
    
    gas/ChangeLog:
    
            * testsuite/gas/riscv/march-fail-rv64i_zcf.d: New test.
            * testsuite/gas/riscv/march-fail-rv64i_zcf.l: Likewise.

Diff:
---
 bfd/elfxx-riscv.c                              | 7 +++++++
 gas/testsuite/gas/riscv/march-fail-rv64i_zcf.d | 3 +++
 gas/testsuite/gas/riscv/march-fail-rv64i_zcf.l | 2 ++
 3 files changed, 12 insertions(+)

diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c
index ee96608358e..eaf496649db 100644
--- a/bfd/elfxx-riscv.c
+++ b/bfd/elfxx-riscv.c
@@ -1946,6 +1946,13 @@ riscv_parse_check_conflicts (riscv_parse_subset_t *rps)
       rps->error_handler (_("rv%d does not support the `q' extension"), xlen);
       no_conflict = false;
     }
+  if (riscv_lookup_subset (rps->subset_list, "zcf", &subset)
+      && xlen > 32)
+    {
+      rps->error_handler
+	(_("rv%d does not support the `zcf' extension"), xlen);
+      no_conflict = false;
+    }
   if (riscv_lookup_subset (rps->subset_list, "zfinx", &subset)
       && riscv_lookup_subset (rps->subset_list, "f", &subset))
     {
diff --git a/gas/testsuite/gas/riscv/march-fail-rv64i_zcf.d b/gas/testsuite/gas/riscv/march-fail-rv64i_zcf.d
new file mode 100644
index 00000000000..1b70a9e280f
--- /dev/null
+++ b/gas/testsuite/gas/riscv/march-fail-rv64i_zcf.d
@@ -0,0 +1,3 @@
+#as: -march=rv64i_zcf
+#source: empty.s
+#error_output: march-fail-rv64i_zcf.l
diff --git a/gas/testsuite/gas/riscv/march-fail-rv64i_zcf.l b/gas/testsuite/gas/riscv/march-fail-rv64i_zcf.l
new file mode 100644
index 00000000000..b9e07c64d52
--- /dev/null
+++ b/gas/testsuite/gas/riscv/march-fail-rv64i_zcf.l
@@ -0,0 +1,2 @@
+.*Assembler messages:
+.*Error: .*rv64 does not support the `zcf' extension

                 reply	other threads:[~2023-07-24 23:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20230724234343.DE12D3858C5F@sourceware.org \
    --to=a4lg@sourceware.org \
    --cc=bfd-cvs@sourceware.org \
    /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).