RISC-V: Add Zama16b extension support

Message ID 20260714082601.45789-1-wangyaduo@linux.alibaba.com
State New
Headers
Series RISC-V: Add Zama16b extension support |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_binutils_check--master-arm success Test passed
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 success Test passed

Commit Message

Wang Yaduo July 14, 2026, 8:26 a.m. UTC
  bfd/ChangeLog:

	* elfxx-riscv.c (riscv_supported_std_z_ext): Add Zama16b.

gas/ChangeLog:

	* NEWS: Mention Zama16b.
	* testsuite/gas/riscv/march-help.l: Add Zama16b.
---
Hi all,

I noticed that using -march with zama16b on current trunk triggers an
assembler error(https://godbolt.org/z/ed1EdfaKr). GCC has supported the
extension but it seems that the binutils misses it.

 bfd/elfxx-riscv.c                    | 1 +
 gas/NEWS                             | 1 +
 gas/testsuite/gas/riscv/march-help.l | 1 +
 3 files changed, 3 insertions(+)
  

Comments

Wang Yaduo July 14, 2026, 9:46 a.m. UTC | #1
I noticed that a similar patch was submitted by Dongyan Chen previously
(https://inbox.sourceware.org/binutils/20260627144517.3442618-1-chendongyan@isrc.iscas.ac.cn/ <https://inbox.sourceware.org/binutils/20260627144517.3442618-1-chendongyan@isrc.iscas.ac.cn/ >)
. Perhaps we could pick up the discussion there and move it forward.
  
Nelson Chu July 29, 2026, 11:32 a.m. UTC | #2
Okay, if Gcc already supported it then we should at least recognize it in
Binutils.  Please commit, thanks.

Nelson

Wang Yaduo <wangyaduo@linux.alibaba.com>

> bfd/ChangeLog:
>
>         * elfxx-riscv.c (riscv_supported_std_z_ext): Add Zama16b.
>
> gas/ChangeLog:
>
>         * NEWS: Mention Zama16b.
>         * testsuite/gas/riscv/march-help.l: Add Zama16b.
> ---
> Hi all,
>
> I noticed that using -march with zama16b on current trunk triggers an
> assembler error(https://godbolt.org/z/ed1EdfaKr). GCC has supported the
> extension but it seems that the binutils misses it.
>
>  bfd/elfxx-riscv.c                    | 1 +
>  gas/NEWS                             | 1 +
>  gas/testsuite/gas/riscv/march-help.l | 1 +
>  3 files changed, 3 insertions(+)
>
> diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c
> index c3cb4197ba8..0895128c048 100644
> --- a/bfd/elfxx-riscv.c
> +++ b/bfd/elfxx-riscv.c
> @@ -1494,6 +1494,7 @@ static const struct riscv_supported_ext
> riscv_supported_std_z_ext[] =
>    {"zacas",            ISA_SPEC_CLASS_DRAFT,           1, 0, 0 },
>    {"zalasr",           ISA_SPEC_CLASS_DRAFT,           1, 0,  0 },
>    {"zalrsc",           ISA_SPEC_CLASS_DRAFT,           1, 0, 0 },
> +  {"zama16b",          ISA_SPEC_CLASS_DRAFT,           1, 0, 0 },
>    {"zawrs",            ISA_SPEC_CLASS_DRAFT,           1, 0, 0 },
>    {"zfbfmin",          ISA_SPEC_CLASS_DRAFT,           1, 0, 0 },
>    {"zfa",              ISA_SPEC_CLASS_DRAFT,           1, 0, 0 },
> diff --git a/gas/NEWS b/gas/NEWS
> index 165e23361bb..940e8f9dd19 100644
> --- a/gas/NEWS
> +++ b/gas/NEWS
> @@ -19,6 +19,7 @@ Changes in 2.47:
>
>  * Add support for RISC-V standard extensions:
>    zalasr v1.0, svrsw60t59b v1.0, zvabd v1.0, smpmpmt v1.0,
> +  zama16b v1.0,
>    zvqwdota8i, zvqwdota16i, zvfwdota16bf and zvfqwdota8f v1.0,
>    zvqwbdota8i, zvqwbdota16i, zvfwbdota16bf, zvfqwbdota8f and
>    zvfbdota32f v1.0.
> diff --git a/gas/testsuite/gas/riscv/march-help.l
> b/gas/testsuite/gas/riscv/march-help.l
> index 142369b6b1d..0ad33ddc9f9 100644
> --- a/gas/testsuite/gas/riscv/march-help.l
> +++ b/gas/testsuite/gas/riscv/march-help.l
> @@ -37,6 +37,7 @@ All available -march extensions for RISC-V:
>         zacas                                   1.0
>         zalasr                                  1.0
>         zalrsc                                  1.0
> +       zama16b                                 1.0
>         zawrs                                   1.0
>         zfbfmin                                 1.0
>         zfa                                     1.0
> --
> 2.47.1
>
>
  

Patch

diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c
index c3cb4197ba8..0895128c048 100644
--- a/bfd/elfxx-riscv.c
+++ b/bfd/elfxx-riscv.c
@@ -1494,6 +1494,7 @@  static const struct riscv_supported_ext riscv_supported_std_z_ext[] =
   {"zacas",		ISA_SPEC_CLASS_DRAFT,		1, 0, 0 },
   {"zalasr",           ISA_SPEC_CLASS_DRAFT,           1, 0,  0 },
   {"zalrsc",		ISA_SPEC_CLASS_DRAFT,		1, 0, 0 },
+  {"zama16b",		ISA_SPEC_CLASS_DRAFT,		1, 0, 0 },
   {"zawrs",		ISA_SPEC_CLASS_DRAFT,		1, 0, 0 },
   {"zfbfmin",		ISA_SPEC_CLASS_DRAFT,		1, 0, 0 },
   {"zfa",		ISA_SPEC_CLASS_DRAFT,		1, 0, 0 },
diff --git a/gas/NEWS b/gas/NEWS
index 165e23361bb..940e8f9dd19 100644
--- a/gas/NEWS
+++ b/gas/NEWS
@@ -19,6 +19,7 @@  Changes in 2.47:
 
 * Add support for RISC-V standard extensions:
   zalasr v1.0, svrsw60t59b v1.0, zvabd v1.0, smpmpmt v1.0,
+  zama16b v1.0,
   zvqwdota8i, zvqwdota16i, zvfwdota16bf and zvfqwdota8f v1.0,
   zvqwbdota8i, zvqwbdota16i, zvfwbdota16bf, zvfqwbdota8f and
   zvfbdota32f v1.0.
diff --git a/gas/testsuite/gas/riscv/march-help.l b/gas/testsuite/gas/riscv/march-help.l
index 142369b6b1d..0ad33ddc9f9 100644
--- a/gas/testsuite/gas/riscv/march-help.l
+++ b/gas/testsuite/gas/riscv/march-help.l
@@ -37,6 +37,7 @@  All available -march extensions for RISC-V:
 	zacas                                   1.0
 	zalasr                                  1.0
 	zalrsc                                  1.0
+	zama16b                                 1.0
 	zawrs                                   1.0
 	zfbfmin                                 1.0
 	zfa                                     1.0