diff mbox series

[1/2] RISC-V: Add support for B standard extension

Message ID 20240708172007.3695827-2-ewlu@rivosinc.com
State New
Headers show
Series Add support for B extention | expand

Commit Message

Edwin Lu July 8, 2024, 5:20 p.m. UTC
This patch adds support for recognizing the B standard extension to be the
collection of Zba, Zbb, Zbs extensions for consistency and conciseness across
toolchains

* https://github.com/riscv/riscv-b/tags

gcc/ChangeLog:

	* common/config/riscv/riscv-common.cc: Add imply rules for B
	  extension
	* config/riscv/arch-canonicalize: Ditto

Signed-off-by: Edwin Lu <ewlu@rivosinc.com>
---
 gcc/common/config/riscv/riscv-common.cc | 6 ++++++
 gcc/config/riscv/arch-canonicalize      | 1 +
 2 files changed, 7 insertions(+)

Comments

Jeff Law July 8, 2024, 5:23 p.m. UTC | #1
On 7/8/24 11:20 AM, Edwin Lu wrote:
> This patch adds support for recognizing the B standard extension to be the
> collection of Zba, Zbb, Zbs extensions for consistency and conciseness across
> toolchains
> 
> * https://github.com/riscv/riscv-b/tags
> 
> gcc/ChangeLog:
> 
> 	* common/config/riscv/riscv-common.cc: Add imply rules for B
> 	  extension
> 	* config/riscv/arch-canonicalize: Ditto
Both patches in this series are OK for the trunk.

jeff
Kito Cheng July 9, 2024, 3:13 a.m. UTC | #2
Hi Edwin:

Could you add B into riscv_combine_info as well? extension should list
there if that extension is just an alias of those extensions, so that
GCC will add b into arch string when zba, zbb, zbs, that's necessary
during arch string canonicalize, which could be used during multilib
match :)


On Tue, Jul 9, 2024 at 1:24 AM Jeff Law <jeffreyalaw@gmail.com> wrote:
>
>
>
> On 7/8/24 11:20 AM, Edwin Lu wrote:
> > This patch adds support for recognizing the B standard extension to be the
> > collection of Zba, Zbb, Zbs extensions for consistency and conciseness across
> > toolchains
> >
> > * https://github.com/riscv/riscv-b/tags
> >
> > gcc/ChangeLog:
> >
> >       * common/config/riscv/riscv-common.cc: Add imply rules for B
> >         extension
> >       * config/riscv/arch-canonicalize: Ditto
> Both patches in this series are OK for the trunk.
>
> jeff
>
Kito Cheng July 9, 2024, 3:14 a.m. UTC | #3
Forgot to say: either v2 or another patch are fine to me :)

On Tue, Jul 9, 2024 at 11:13 AM Kito Cheng <kito.cheng@gmail.com> wrote:
>
> Hi Edwin:
>
> Could you add B into riscv_combine_info as well? extension should list
> there if that extension is just an alias of those extensions, so that
> GCC will add b into arch string when zba, zbb, zbs, that's necessary
> during arch string canonicalize, which could be used during multilib
> match :)
>
>
> On Tue, Jul 9, 2024 at 1:24 AM Jeff Law <jeffreyalaw@gmail.com> wrote:
> >
> >
> >
> > On 7/8/24 11:20 AM, Edwin Lu wrote:
> > > This patch adds support for recognizing the B standard extension to be the
> > > collection of Zba, Zbb, Zbs extensions for consistency and conciseness across
> > > toolchains
> > >
> > > * https://github.com/riscv/riscv-b/tags
> > >
> > > gcc/ChangeLog:
> > >
> > >       * common/config/riscv/riscv-common.cc: Add imply rules for B
> > >         extension
> > >       * config/riscv/arch-canonicalize: Ditto
> > Both patches in this series are OK for the trunk.
> >
> > jeff
> >
diff mbox series

Patch

diff --git a/gcc/common/config/riscv/riscv-common.cc b/gcc/common/config/riscv/riscv-common.cc
index b9bda3e110a..df7f33b7486 100644
--- a/gcc/common/config/riscv/riscv-common.cc
+++ b/gcc/common/config/riscv/riscv-common.cc
@@ -84,6 +84,10 @@  static const riscv_implied_info_t riscv_implied_info[] =
 
   {"zabha", "zaamo"},
 
+  {"b", "zba"},
+  {"b", "zbb"},
+  {"b", "zbs"},
+
   {"zdinx", "zfinx"},
   {"zfinx", "zicsr"},
   {"zdinx", "zicsr"},
@@ -245,6 +249,8 @@  static const struct riscv_ext_version riscv_ext_version_table[] =
   {"c", ISA_SPEC_CLASS_20190608, 2, 0},
   {"c", ISA_SPEC_CLASS_2P2,      2, 0},
 
+  {"b",       ISA_SPEC_CLASS_NONE, 1, 0},
+
   {"h",       ISA_SPEC_CLASS_NONE, 1, 0},
 
   {"v",       ISA_SPEC_CLASS_NONE, 1, 0},
diff --git a/gcc/config/riscv/arch-canonicalize b/gcc/config/riscv/arch-canonicalize
index 35a7fe4455a..2ea514dd986 100755
--- a/gcc/config/riscv/arch-canonicalize
+++ b/gcc/config/riscv/arch-canonicalize
@@ -45,6 +45,7 @@  IMPLIED_EXT = {
   "zabha" : ["zaamo"],
 
   "f" : ["zicsr"],
+  "b" : ["zba", "zbb", "zbs"],
   "zdinx" : ["zfinx", "zicsr"],
   "zfinx" : ["zicsr"],
   "zhinx" : ["zhinxmin", "zfinx", "zicsr"],