[RFC,2/5] RISC-V: Add insn classes for Zfh/Zfhmin extensions

Message ID 3a40c19310810288606061a733581b1b277aec0e.1641898063.git.research_trasio@irq.a4lg.com
State New
Headers show
Series
  • RISC-V: Add Half-precision floating point extensions
Related show

Commit Message

H.J. Lu via Binutils Jan. 11, 2022, 10:48 a.m.
This commit adds several instruction classes corresponding 'Zfh',
'Zfhmin' and 'Zfhmin'+'D|Q' extensions.

bfd/ChangeLog:

	* elfxx-riscv.c (riscv_multi_subset_supports): Add handling for
	new instruction classes.

include/ChangeLog:

	* opcode/riscv.h (enum riscv_insn_class): Add new instruction
	classes INSN_CLASS_ZFH, INSN_CLASS_ZFHMIN,
	INSN_CLASS_ZFHMIN_AND_D and INSN_CLASS_ZFHMIN_AND_Q.
---
 bfd/elfxx-riscv.c      | 10 ++++++++++
 include/opcode/riscv.h |  4 ++++
 2 files changed, 14 insertions(+)

-- 
2.32.0

Patch

diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c
index dbe3611304b..4f3705ad396 100644
--- a/bfd/elfxx-riscv.c
+++ b/bfd/elfxx-riscv.c
@@ -2368,6 +2368,16 @@  riscv_multi_subset_supports (riscv_parse_subset_t *rps,
     case INSN_CLASS_Q_OR_ZQINX:
       return (riscv_subset_supports (rps, "q")
 	      || riscv_subset_supports (rps, "zqinx"));
+    case INSN_CLASS_ZFH:
+      return riscv_subset_supports (rps, "zfh");
+    case INSN_CLASS_ZFHMIN:
+      return riscv_subset_supports (rps, "zfhmin");
+    case INSN_CLASS_ZFHMIN_AND_D:
+      return (riscv_subset_supports (rps, "zfhmin")
+	      && riscv_subset_supports (rps, "d"));
+    case INSN_CLASS_ZFHMIN_AND_Q:
+      return (riscv_subset_supports (rps, "zfhmin")
+	      && riscv_subset_supports (rps, "q"));
     case INSN_CLASS_ZBA:
       return riscv_subset_supports (rps, "zba");
     case INSN_CLASS_ZBB:
diff --git a/include/opcode/riscv.h b/include/opcode/riscv.h
index 048ab0a5d68..a5da8d0c4e0 100644
--- a/include/opcode/riscv.h
+++ b/include/opcode/riscv.h
@@ -370,6 +370,10 @@  enum riscv_insn_class
   INSN_CLASS_F_OR_ZFINX,
   INSN_CLASS_D_OR_ZDINX,
   INSN_CLASS_Q_OR_ZQINX,
+  INSN_CLASS_ZFH,
+  INSN_CLASS_ZFHMIN,
+  INSN_CLASS_ZFHMIN_AND_D,
+  INSN_CLASS_ZFHMIN_AND_Q,
   INSN_CLASS_ZBA,
   INSN_CLASS_ZBB,
   INSN_CLASS_ZBC,