public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/2] RISC-V: Reflect v1.0.4-1 of the code size reduction spec
@ 2023-07-24  5:38 Tsukasa OI
  2023-07-24  5:38 ` [PATCH 1/2] RISC-V: Prohibit the 'Zcf' extension on RV64 Tsukasa OI
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Tsukasa OI @ 2023-07-24  5:38 UTC (permalink / raw)
  To: Tsukasa OI, Nelson Chu, Kito Cheng, Palmer Dabbelt; +Cc: binutils

Hello again,

I am pleased to announce that I can contribute to GNU Binutils again!


This is a follow-up patch set for the code size reduction specification
by Jiawei et al. (partial support excluding those that conflict with 'Zcd').

This is compliant with the initial ratified version but there is a new
version of the specification including minor additions.

cf: The version 1.0.4-1 of the specification
<https://github.com/riscv/riscv-code-size-reduction/releases/tag/v1.0.4-1>

1.  'Zcf' is only allowed on RV32 (as no instruction exists on RV64/128).
2.  'Zcf' implies 'F' and 'Zcd' implies D.

This patch set makes GNU Binutils compliant with the latest code size
reduction specification (a subset where GNU Binutils has already
implemented) except a minor issue: 'C' does not imply 'Zca', 'Zcd' and
'Zcf' (only on RV32).  Note that this is a consequence from handling of the
'Zmmul' extension (a subset of 'M').

Thanks,
Tsukasa




Tsukasa OI (2):
  RISC-V: Prohibit the 'Zcf' extension on RV64
  RISC-V: Implications from 'Zc[fd]' extensions

 bfd/elfxx-riscv.c                              | 9 +++++++++
 gas/testsuite/gas/riscv/march-fail-rv64i_zcf.d | 3 +++
 gas/testsuite/gas/riscv/march-fail-rv64i_zcf.l | 2 ++
 gas/testsuite/gas/riscv/march-imply-zcd.d      | 6 ++++++
 gas/testsuite/gas/riscv/march-imply-zcf.d      | 6 ++++++
 5 files changed, 26 insertions(+)
 create mode 100644 gas/testsuite/gas/riscv/march-fail-rv64i_zcf.d
 create mode 100644 gas/testsuite/gas/riscv/march-fail-rv64i_zcf.l
 create mode 100644 gas/testsuite/gas/riscv/march-imply-zcd.d
 create mode 100644 gas/testsuite/gas/riscv/march-imply-zcf.d


base-commit: 5cbe549257b0aed1b615714e74bb6a3f066f3253
-- 
2.41.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] RISC-V: Prohibit the 'Zcf' extension on RV64
  2023-07-24  5:38 [PATCH 0/2] RISC-V: Reflect v1.0.4-1 of the code size reduction spec Tsukasa OI
@ 2023-07-24  5:38 ` Tsukasa OI
  2023-07-24  5:38 ` [PATCH 2/2] RISC-V: Implications from 'Zc[fd]' extensions Tsukasa OI
  2023-07-24 23:22 ` [PATCH 0/2] RISC-V: Reflect v1.0.4-1 of the code size reduction spec Nelson Chu
  2 siblings, 0 replies; 5+ messages in thread
From: Tsukasa OI @ 2023-07-24  5:38 UTC (permalink / raw)
  To: Tsukasa OI, Nelson Chu, Kito Cheng, Palmer Dabbelt; +Cc: binutils

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

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.
---
 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(+)
 create mode 100644 gas/testsuite/gas/riscv/march-fail-rv64i_zcf.d
 create mode 100644 gas/testsuite/gas/riscv/march-fail-rv64i_zcf.l

diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c
index ee96608358e8..eaf496649db1 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 000000000000..1b70a9e280f0
--- /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 000000000000..b9e07c64d52f
--- /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
-- 
2.41.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/2] RISC-V: Implications from 'Zc[fd]' extensions
  2023-07-24  5:38 [PATCH 0/2] RISC-V: Reflect v1.0.4-1 of the code size reduction spec Tsukasa OI
  2023-07-24  5:38 ` [PATCH 1/2] RISC-V: Prohibit the 'Zcf' extension on RV64 Tsukasa OI
@ 2023-07-24  5:38 ` Tsukasa OI
  2023-07-24 23:22 ` [PATCH 0/2] RISC-V: Reflect v1.0.4-1 of the code size reduction spec Nelson Chu
  2 siblings, 0 replies; 5+ messages in thread
From: Tsukasa OI @ 2023-07-24  5:38 UTC (permalink / raw)
  To: Tsukasa OI, Nelson Chu, Kito Cheng, Palmer Dabbelt; +Cc: binutils

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

The version 1.0.4-1 of the code size reduction specification clarifies
that 'Zcf' implies 'F' and 'Zcd' implies 'D'.

cf:
<https://github.com/riscv/riscv-code-size-reduction/releases/tag/v1.0.4-1>

This commit adds those implications.

bfd/ChangeLog:

	* elfxx-riscv.c (riscv_implicit_subsets): Add two implications,
	'Zcf' -> 'F' and 'Zcd' -> 'D'.

gas/ChangeLog:

	* testsuite/gas/riscv/march-imply-zcd.d: New test.
	* testsuite/gas/riscv/march-imply-zcf.d: New test.
---
 bfd/elfxx-riscv.c                         | 2 ++
 gas/testsuite/gas/riscv/march-imply-zcd.d | 6 ++++++
 gas/testsuite/gas/riscv/march-imply-zcf.d | 6 ++++++
 3 files changed, 14 insertions(+)
 create mode 100644 gas/testsuite/gas/riscv/march-imply-zcd.d
 create mode 100644 gas/testsuite/gas/riscv/march-imply-zcf.d

diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c
index eaf496649db1..b43d2cfa0fab 100644
--- a/bfd/elfxx-riscv.c
+++ b/bfd/elfxx-riscv.c
@@ -1132,6 +1132,8 @@ static struct riscv_implicit_subset riscv_implicit_subsets[] =
   {"zvl256b", "zvl128b",	check_implicit_always},
   {"zvl128b", "zvl64b",		check_implicit_always},
   {"zvl64b", "zvl32b",		check_implicit_always},
+  {"zcd", "d",		check_implicit_always},
+  {"zcf", "f",		check_implicit_always},
   {"zfa", "f",		check_implicit_always},
   {"d", "f",		check_implicit_always},
   {"zfh", "zfhmin",	check_implicit_always},
diff --git a/gas/testsuite/gas/riscv/march-imply-zcd.d b/gas/testsuite/gas/riscv/march-imply-zcd.d
new file mode 100644
index 000000000000..e7c75f649a8b
--- /dev/null
+++ b/gas/testsuite/gas/riscv/march-imply-zcd.d
@@ -0,0 +1,6 @@
+#as: -march=rv32i_zcd -march-attr -misa-spec=20191213
+#readelf: -A
+#source: empty.s
+Attribute Section: riscv
+File Attributes
+  Tag_RISCV_arch: "rv32i2p1_f2p2_d2p2_zicsr2p0_zca1p0_zcd1p0"
diff --git a/gas/testsuite/gas/riscv/march-imply-zcf.d b/gas/testsuite/gas/riscv/march-imply-zcf.d
new file mode 100644
index 000000000000..3829637a16fa
--- /dev/null
+++ b/gas/testsuite/gas/riscv/march-imply-zcf.d
@@ -0,0 +1,6 @@
+#as: -march=rv32i_zcf -march-attr -misa-spec=20191213
+#readelf: -A
+#source: empty.s
+Attribute Section: riscv
+File Attributes
+  Tag_RISCV_arch: "rv32i2p1_f2p2_zicsr2p0_zca1p0_zcf1p0"
-- 
2.41.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] RISC-V: Reflect v1.0.4-1 of the code size reduction spec
  2023-07-24  5:38 [PATCH 0/2] RISC-V: Reflect v1.0.4-1 of the code size reduction spec Tsukasa OI
  2023-07-24  5:38 ` [PATCH 1/2] RISC-V: Prohibit the 'Zcf' extension on RV64 Tsukasa OI
  2023-07-24  5:38 ` [PATCH 2/2] RISC-V: Implications from 'Zc[fd]' extensions Tsukasa OI
@ 2023-07-24 23:22 ` Nelson Chu
  2 siblings, 0 replies; 5+ messages in thread
From: Nelson Chu @ 2023-07-24 23:22 UTC (permalink / raw)
  To: Tsukasa OI; +Cc: Kito Cheng, Palmer Dabbelt, binutils

[-- Attachment #1: Type: text/plain, Size: 1976 bytes --]

ok, please commit these, thanks.

Nelson

On Mon, Jul 24, 2023 at 1:39 PM Tsukasa OI <research_trasio@irq.a4lg.com>
wrote:

> Hello again,
>
> I am pleased to announce that I can contribute to GNU Binutils again!
>
>
> This is a follow-up patch set for the code size reduction specification
> by Jiawei et al. (partial support excluding those that conflict with
> 'Zcd').
>
> This is compliant with the initial ratified version but there is a new
> version of the specification including minor additions.
>
> cf: The version 1.0.4-1 of the specification
> <https://github.com/riscv/riscv-code-size-reduction/releases/tag/v1.0.4-1>
>
> 1.  'Zcf' is only allowed on RV32 (as no instruction exists on RV64/128).
> 2.  'Zcf' implies 'F' and 'Zcd' implies D.
>
> This patch set makes GNU Binutils compliant with the latest code size
> reduction specification (a subset where GNU Binutils has already
> implemented) except a minor issue: 'C' does not imply 'Zca', 'Zcd' and
> 'Zcf' (only on RV32).  Note that this is a consequence from handling of the
> 'Zmmul' extension (a subset of 'M').
>
> Thanks,
> Tsukasa
>
>
>
>
> Tsukasa OI (2):
>   RISC-V: Prohibit the 'Zcf' extension on RV64
>   RISC-V: Implications from 'Zc[fd]' extensions
>
>  bfd/elfxx-riscv.c                              | 9 +++++++++
>  gas/testsuite/gas/riscv/march-fail-rv64i_zcf.d | 3 +++
>  gas/testsuite/gas/riscv/march-fail-rv64i_zcf.l | 2 ++
>  gas/testsuite/gas/riscv/march-imply-zcd.d      | 6 ++++++
>  gas/testsuite/gas/riscv/march-imply-zcf.d      | 6 ++++++
>  5 files changed, 26 insertions(+)
>  create mode 100644 gas/testsuite/gas/riscv/march-fail-rv64i_zcf.d
>  create mode 100644 gas/testsuite/gas/riscv/march-fail-rv64i_zcf.l
>  create mode 100644 gas/testsuite/gas/riscv/march-imply-zcd.d
>  create mode 100644 gas/testsuite/gas/riscv/march-imply-zcf.d
>
>
> base-commit: 5cbe549257b0aed1b615714e74bb6a3f066f3253
> --
> 2.41.0
>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] RISC-V: Prohibit the 'Zcf' extension on RV64
@ 2023-07-24  8:39 jiawei
  0 siblings, 0 replies; 5+ messages in thread
From: jiawei @ 2023-07-24  8:39 UTC (permalink / raw)
  To: Tsukasa OI; +Cc: binutils, Nelson Chu

[-- Attachment #1: Type: text/plain, Size: 2449 bytes --]

> 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.
> ---
>  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(+)
>  create mode 100644 gas/testsuite/gas/riscv/march-fail-rv64i_zcf.d
>  create mode 100644 gas/testsuite/gas/riscv/march-fail-rv64i_zcf.l
> 
> diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c
> index ee96608358e8..eaf496649db1 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 000000000000..1b70a9e280f0
> --- /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 000000000000..b9e07c64d52f
> --- /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
> -- 


> 2.41.0




LGTM, thanks for your work!

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-07-24 23:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-24  5:38 [PATCH 0/2] RISC-V: Reflect v1.0.4-1 of the code size reduction spec Tsukasa OI
2023-07-24  5:38 ` [PATCH 1/2] RISC-V: Prohibit the 'Zcf' extension on RV64 Tsukasa OI
2023-07-24  5:38 ` [PATCH 2/2] RISC-V: Implications from 'Zc[fd]' extensions Tsukasa OI
2023-07-24 23:22 ` [PATCH 0/2] RISC-V: Reflect v1.0.4-1 of the code size reduction spec Nelson Chu
2023-07-24  8:39 [PATCH 1/2] RISC-V: Prohibit the 'Zcf' extension on RV64 jiawei

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