[v2,1/3] RISC-V: Add mininal support for z[fdq]inx

Message ID 20211117121008.3626-2-jiawei@iscas.ac.cn
State New
Headers show
Series
  • RISC-V: Zfinx extension support
Related show

Commit Message

jiawei Nov. 17, 2021, 12:10 p.m.
Minimal support for zfinx, zdinx, zqinx. Like f/d/q, the zqinx 
imply zdinx and zdinx imply zfinx, where zfinx are not compatible 
with f/d/q.

bfd/ChangeLog:

* elfxx-riscv.c (riscv_implicit_subsets): Added implicit rules 
for z*inx extensions.
(riscv_supported_std_z_ext): Added entries for z*inx.
(riscv_parse_check_conflicts): Added conflict check for z*inx.

---
 bfd/elfxx-riscv.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

-- 
2.25.1

Comments

Palmer Dabbelt Nov. 18, 2021, 2:15 a.m. | #1
On Wed, 17 Nov 2021 04:10:06 PST (-0800), jiawei@iscas.ac.cn wrote:
> Minimal support for zfinx, zdinx, zqinx. Like f/d/q, the zqinx

> imply zdinx and zdinx imply zfinx, where zfinx are not compatible

> with f/d/q.

>

> bfd/ChangeLog:

>

> * elfxx-riscv.c (riscv_implicit_subsets): Added implicit rules

> for z*inx extensions.

> (riscv_supported_std_z_ext): Added entries for z*inx.

> (riscv_parse_check_conflicts): Added conflict check for z*inx.

>

> ---

>  bfd/elfxx-riscv.c | 12 ++++++++++++

>  1 file changed, 12 insertions(+)

>

> diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c

> index e2fb4003380..9f03542ab77 100644

> --- a/bfd/elfxx-riscv.c

> +++ b/bfd/elfxx-riscv.c

> @@ -1075,6 +1075,8 @@ static struct riscv_implicit_subset riscv_implicit_subsets[] =

>    {"q", "d",		check_implicit_always},

>    {"d", "f",		check_implicit_always},

>    {"f", "zicsr",	check_implicit_always},

> +  {"zqinx", "zdinx",	check_implicit_always},

> +  {"zdinx", "zfinx",	check_implicit_always},

>    {"zk", "zkn",		check_implicit_always},

>    {"zk", "zkr",		check_implicit_always},

>    {"zk", "zkt",		check_implicit_always},

> @@ -1157,6 +1159,9 @@ static struct riscv_supported_ext riscv_supported_std_z_ext[] =

>    {"zifencei",		ISA_SPEC_CLASS_20191213,	2, 0,  0 },

>    {"zifencei",		ISA_SPEC_CLASS_20190608,	2, 0,  0 },

>    {"zihintpause",	ISA_SPEC_CLASS_DRAFT,		1, 0,  0 },

> +  {"zfinx",		ISA_SPEC_CLASS_DRAFT,		1, 0,  0 },

> +  {"zdinx",		ISA_SPEC_CLASS_DRAFT,		1, 0,  0 },

> +  {"zqinx",		ISA_SPEC_CLASS_DRAFT,		1, 0,  0 },

>    {"zbb",		ISA_SPEC_CLASS_DRAFT,		1, 0,  0 },

>    {"zba",		ISA_SPEC_CLASS_DRAFT,		1, 0,  0 },

>    {"zbc",		ISA_SPEC_CLASS_DRAFT,		1, 0,  0 },

> @@ -1854,6 +1859,13 @@ riscv_parse_check_conflicts (riscv_parse_subset_t *rps)

>          (_("rv32e does not support the `f' extension"));

>        no_conflict = false;

>      }

> +  if (riscv_lookup_subset (rps->subset_list, "zfinx", &subset)

> +      && (riscv_lookup_subset (rps->subset_list, "f", &subset)))

> +    {

> +      rps->error_handler

> +        (_("`zfinx' is conflict with the `f/d/q' extension"));

> +      no_conflict = false;

> +    }

>    return no_conflict;

>  }


Reviewed-by: Palmer Dabbelt <palmer@rivosinc.com>

Patch

diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c
index e2fb4003380..9f03542ab77 100644
--- a/bfd/elfxx-riscv.c
+++ b/bfd/elfxx-riscv.c
@@ -1075,6 +1075,8 @@  static struct riscv_implicit_subset riscv_implicit_subsets[] =
   {"q", "d",		check_implicit_always},
   {"d", "f",		check_implicit_always},
   {"f", "zicsr",	check_implicit_always},
+  {"zqinx", "zdinx",	check_implicit_always},
+  {"zdinx", "zfinx",	check_implicit_always},
   {"zk", "zkn",		check_implicit_always},
   {"zk", "zkr",		check_implicit_always},
   {"zk", "zkt",		check_implicit_always},
@@ -1157,6 +1159,9 @@  static struct riscv_supported_ext riscv_supported_std_z_ext[] =
   {"zifencei",		ISA_SPEC_CLASS_20191213,	2, 0,  0 },
   {"zifencei",		ISA_SPEC_CLASS_20190608,	2, 0,  0 },
   {"zihintpause",	ISA_SPEC_CLASS_DRAFT,		1, 0,  0 },
+  {"zfinx",		ISA_SPEC_CLASS_DRAFT,		1, 0,  0 },
+  {"zdinx",		ISA_SPEC_CLASS_DRAFT,		1, 0,  0 },
+  {"zqinx",		ISA_SPEC_CLASS_DRAFT,		1, 0,  0 },
   {"zbb",		ISA_SPEC_CLASS_DRAFT,		1, 0,  0 },
   {"zba",		ISA_SPEC_CLASS_DRAFT,		1, 0,  0 },
   {"zbc",		ISA_SPEC_CLASS_DRAFT,		1, 0,  0 },
@@ -1854,6 +1859,13 @@  riscv_parse_check_conflicts (riscv_parse_subset_t *rps)
         (_("rv32e does not support the `f' extension"));
       no_conflict = false;
     }
+  if (riscv_lookup_subset (rps->subset_list, "zfinx", &subset)
+      && (riscv_lookup_subset (rps->subset_list, "f", &subset)))
+    {
+      rps->error_handler
+        (_("`zfinx' is conflict with the `f/d/q' extension"));
+      no_conflict = false;
+    }
   return no_conflict;
 }