RISC-V: Add support for B standard extension
Checks
Commit Message
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 | 7 +++++++
gcc/config/riscv/arch-canonicalize | 1 +
2 files changed, 8 insertions(+)
Comments
On Tue, Feb 6, 2024 at 9:39 AM Edwin Lu <ewlu@rivosinc.com> 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
Note this is/was recorded as PR 106531.
Thanks,
Andrew Pinski
>
> 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 | 7 +++++++
> gcc/config/riscv/arch-canonicalize | 1 +
> 2 files changed, 8 insertions(+)
>
> diff --git a/gcc/common/config/riscv/riscv-common.cc b/gcc/common/config/riscv/riscv-common.cc
> index 631ce8309a0..31117a7b0fd 100644
> --- a/gcc/common/config/riscv/riscv-common.cc
> +++ b/gcc/common/config/riscv/riscv-common.cc
> @@ -77,6 +77,10 @@ static const riscv_implied_info_t riscv_implied_info[] =
> {"f", "zicsr"},
> {"d", "zicsr"},
>
> + {"b", "zba"},
> + {"b", "zbb"},
> + {"b", "zbs"},
> +
> {"zdinx", "zfinx"},
> {"zfinx", "zicsr"},
> {"zdinx", "zicsr"},
> @@ -235,6 +239,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},
> @@ -388,6 +394,7 @@ static const struct riscv_ext_version riscv_ext_version_table[] =
> /* Combine extensions defined in this table */
> static const struct riscv_ext_version riscv_combine_info[] =
> {
> + {"b", ISA_SPEC_CLASS_NONE, 1, 0},
> {"zk", ISA_SPEC_CLASS_NONE, 1, 0},
> {"zkn", ISA_SPEC_CLASS_NONE, 1, 0},
> {"zks", ISA_SPEC_CLASS_NONE, 1, 0},
> diff --git a/gcc/config/riscv/arch-canonicalize b/gcc/config/riscv/arch-canonicalize
> index 629bed85347..dcfae732714 100755
> --- a/gcc/config/riscv/arch-canonicalize
> +++ b/gcc/config/riscv/arch-canonicalize
> @@ -41,6 +41,7 @@ LONG_EXT_PREFIXES = ['z', 's', 'h', 'x']
> IMPLIED_EXT = {
> "d" : ["f", "zicsr"],
> "f" : ["zicsr"],
> + "b" : ["zba", "zbb", "zbs"],
> "zdinx" : ["zfinx", "zicsr"],
> "zfinx" : ["zicsr"],
> "zhinx" : ["zhinxmin", "zfinx", "zicsr"],
> --
> 2.34.1
>
On 2/6/24 10:38, 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
So similar to Patrick's change, no major concerns here. We just need to
wait to see how the proposal moves through RVI before committing.
jeff
@@ -77,6 +77,10 @@ static const riscv_implied_info_t riscv_implied_info[] =
{"f", "zicsr"},
{"d", "zicsr"},
+ {"b", "zba"},
+ {"b", "zbb"},
+ {"b", "zbs"},
+
{"zdinx", "zfinx"},
{"zfinx", "zicsr"},
{"zdinx", "zicsr"},
@@ -235,6 +239,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},
@@ -388,6 +394,7 @@ static const struct riscv_ext_version riscv_ext_version_table[] =
/* Combine extensions defined in this table */
static const struct riscv_ext_version riscv_combine_info[] =
{
+ {"b", ISA_SPEC_CLASS_NONE, 1, 0},
{"zk", ISA_SPEC_CLASS_NONE, 1, 0},
{"zkn", ISA_SPEC_CLASS_NONE, 1, 0},
{"zks", ISA_SPEC_CLASS_NONE, 1, 0},
@@ -41,6 +41,7 @@ LONG_EXT_PREFIXES = ['z', 's', 'h', 'x']
IMPLIED_EXT = {
"d" : ["f", "zicsr"],
"f" : ["zicsr"],
+ "b" : ["zba", "zbb", "zbs"],
"zdinx" : ["zfinx", "zicsr"],
"zfinx" : ["zicsr"],
"zhinx" : ["zhinxmin", "zfinx", "zicsr"],