public inbox for binutils-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] RISC-V: Fix requirement handling on Zhinx+{D,Q}
@ 2022-07-07  4:22 Nelson Chu
  0 siblings, 0 replies; only message in thread
From: Nelson Chu @ 2022-07-07  4:22 UTC (permalink / raw)
  To: bfd-cvs

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

commit 37cf60c6a6d36bbf5cf1523697906c4bdb4eb468
Author: Tsukasa OI <research_trasio@irq.a4lg.com>
Date:   Fri Jun 24 11:59:04 2022 +0900

    RISC-V: Fix requirement handling on Zhinx+{D,Q}
    
    This commit fixes how instructions are masked on Zhinx+Z{d,q}inx.
    fcvt.h.d and fcvt.d.h require ((D&&Zfh)||(Zdinx&&Zhinx)) and
    fcvt.h.q and fcvt.q.h require ((Q&&Zfh)||(Zqinx&&Zhinx)).
    
    bfd/ChangeLog:
    
            * elfxx-riscv.c (riscv_multi_subset_supports): Fix feature gate
            on INSN_CLASS_{D,Q}_AND_ZFH_INX.
            (riscv_multi_subset_supports_ext): Fix feature gate diagnostics
            on INSN_CLASS_{D,Q}_AND_ZFH_INX.
    
    gas/ChangeLog:
    
            * testsuite/gas/riscv/fp-zhinx-insns.d: Add Zqinx to -march
            for proper testing.

Diff:
---
 bfd/elfxx-riscv.c                        | 30 +++++++++++++++++++++++++-----
 gas/testsuite/gas/riscv/fp-zhinx-insns.d |  2 +-
 2 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c
index c846d6baaa2..7d0825404df 100644
--- a/bfd/elfxx-riscv.c
+++ b/bfd/elfxx-riscv.c
@@ -2340,15 +2340,17 @@ riscv_multi_subset_supports (riscv_parse_subset_t *rps,
       return riscv_subset_supports (rps, "zfh");
     case INSN_CLASS_ZFH_OR_ZHINX:
       return riscv_subset_supports (rps, "zfh")
-        || riscv_subset_supports (rps, "zhinx");
+	     || riscv_subset_supports (rps, "zhinx");
     case INSN_CLASS_D_AND_ZFH_INX:
       return (riscv_subset_supports (rps, "d")
 	      && riscv_subset_supports (rps, "zfh"))
-           || riscv_subset_supports (rps, "zhinx");
+	     || (riscv_subset_supports (rps, "zdinx")
+		 && riscv_subset_supports (rps, "zhinx"));
     case INSN_CLASS_Q_AND_ZFH_INX:
       return (riscv_subset_supports (rps, "q")
 	      && riscv_subset_supports (rps, "zfh"))
-           || riscv_subset_supports (rps, "zhinx");
+	     || (riscv_subset_supports (rps, "zqinx")
+		 && riscv_subset_supports (rps, "zhinx"));
     case INSN_CLASS_ZBA:
       return riscv_subset_supports (rps, "zba");
     case INSN_CLASS_ZBB:
@@ -2495,9 +2497,27 @@ riscv_multi_subset_supports_ext (riscv_parse_subset_t *rps,
     case INSN_CLASS_ZFH_OR_ZHINX:
       return _("zfh' or 'zhinx");
     case INSN_CLASS_D_AND_ZFH_INX:
-      return _("('d' and 'zfh') or 'zhinx");
+      if (riscv_subset_supports (rps, "zfh"))
+	return "d";
+      else if (riscv_subset_supports (rps, "d"))
+	return "zfh";
+      else if (riscv_subset_supports (rps, "zhinx"))
+	return "zdinx";
+      else if (riscv_subset_supports (rps, "zdinx"))
+	return "zhinx";
+      else
+	return _("zfh' and `d', or `zhinx' and `zdinx");
     case INSN_CLASS_Q_AND_ZFH_INX:
-      return _("('q' and 'zfh') or 'zhinx");
+      if (riscv_subset_supports (rps, "zfh"))
+	return "q";
+      else if (riscv_subset_supports (rps, "q"))
+	return "zfh";
+      else if (riscv_subset_supports (rps, "zhinx"))
+	return "zqinx";
+      else if (riscv_subset_supports (rps, "zqinx"))
+	return "zhinx";
+      else
+	return _("zfh' and `q', or `zhinx' and `zqinx");
     case INSN_CLASS_H:
       return _("h");
     default:
diff --git a/gas/testsuite/gas/riscv/fp-zhinx-insns.d b/gas/testsuite/gas/riscv/fp-zhinx-insns.d
index 6e1c40e65f5..2592d8c74e2 100644
--- a/gas/testsuite/gas/riscv/fp-zhinx-insns.d
+++ b/gas/testsuite/gas/riscv/fp-zhinx-insns.d
@@ -1,4 +1,4 @@
-#as: -march=rv64ima_zhinx
+#as: -march=rv64ima_zqinx_zhinx
 #source: fp-zhinx-insns.s
 #objdump: -dr


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-07-07  4:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-07  4:22 [binutils-gdb] RISC-V: Fix requirement handling on Zhinx+{D,Q} Nelson Chu

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).