From c144f638337944101131d9fe6de4ab908f6d4c2d Mon Sep 17 00:00:00 2001 From: Nelson Chu Date: Mon, 5 Feb 2024 09:39:37 +0800 Subject: RISC-V: Support B, Zaamo and Zalrsc extensions. * https://github.com/riscv/riscv-b/tags Added standard B extension back, which implies Zba, Zbb and Zbs extensions. * https://github.com/riscv/riscv-zaamo-zalrsc/tags Splited standard A extension into two new extensions, Zaamo and Zalrsc. The A extension implies Zaamo and Zalrsc extensions. Not sure if we need to do the similar check as i and zicsr/zifencei. Passed riscv[32|64]-[elf/linux] binutils testcases. bfd/ * elfxx-riscv.c (riscv_implicit_subsets): Added imply rules for A and B extensions. The A implies Zaamo and Zalrsc, the B implies Zba, Zbb and Zbs. (riscv_supported_std_ext): Supported B extension with v1.0. (riscv_supported_std_z_ext): Supported Zaamo and Zalrsc with v1.0. (riscv_multi_subset_supports, riscv_multi_subset_supports_ext): Updated. include/ * opcode/riscv.h (riscv_insn_class): Removed INSN_CLASS_A, Added INSN_CLASS_ZAAMO and INSN_CLASS_ZALRSC. opcodes/ * riscv-opc.c (riscv_opcodes): Splited standard A extension into two new extensions, Zaamo and Zalrsc. gas/ * testsuite/gas/riscv/march-imply-a.d: New testcase. * testsuite/gas/riscv/march-imply-b.d: New testcase. * testsuite/gas/riscv/attribute-01.d: Updated. * testsuite/gas/riscv/attribute-02.d: Updated. * testsuite/gas/riscv/attribute-03.d: Updated. * testsuite/gas/riscv/attribute-04.d: Updated. * testsuite/gas/riscv/attribute-05.d: Updated. * testsuite/gas/riscv/attribute-10.d: Updated. * testsuite/gas/riscv/mapping-symbols.d: Updated. * testsuite/gas/riscv/march-imply-g.d: Updated. * testsuite/gas/riscv/march-imply-unsupported.d: Updated. * testsuite/gas/riscv/march-ok-reorder.d: Updated. ld/ * testsuite/ld-riscv-elf/attr-merge-arch-01.d: Updated. * testsuite/ld-riscv-elf/attr-merge-arch-02.d: Updated. * testsuite/ld-riscv-elf/attr-merge-arch-03.d: Updated. * testsuite/ld-riscv-elf/attr-merge-user-ext-01.d: Updated. --- bfd/elfxx-riscv.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'bfd') diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c index b08e445..dfacb87 100644 --- a/bfd/elfxx-riscv.c +++ b/bfd/elfxx-riscv.c @@ -1277,6 +1277,11 @@ static struct riscv_implicit_subset riscv_implicit_subsets[] = {"ssstateen", "zicsr", check_implicit_always}, {"sstc", "zicsr", check_implicit_always}, {"svadu", "zicsr", check_implicit_always}, + {"b", "zba", check_implicit_always}, + {"b", "zbb", check_implicit_always}, + {"b", "zbs", check_implicit_always}, + {"a", "zaamo", check_implicit_always}, + {"a", "zalrsc", check_implicit_always}, {"xsfvcp", "zve32x", check_implicit_always}, {NULL, NULL, NULL} @@ -1329,6 +1334,7 @@ static struct riscv_supported_ext riscv_supported_std_ext[] = {"c", ISA_SPEC_CLASS_20191213, 2, 0, 0 }, {"c", ISA_SPEC_CLASS_20190608, 2, 0, 0 }, {"c", ISA_SPEC_CLASS_2P2, 2, 0, 0 }, + {"b", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 }, {"v", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 }, {"h", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 }, {NULL, 0, 0, 0, 0} @@ -1349,7 +1355,9 @@ static struct riscv_supported_ext riscv_supported_std_z_ext[] = {"zihintpause", ISA_SPEC_CLASS_DRAFT, 2, 0, 0 }, {"zihpm", ISA_SPEC_CLASS_DRAFT, 2, 0, 0 }, {"zmmul", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 }, + {"zaamo", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 }, {"zabha", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 }, + {"zalrsc", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 }, {"zawrs", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 }, {"zfa", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 }, {"zfh", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 }, @@ -2519,10 +2527,12 @@ riscv_multi_subset_supports (riscv_parse_subset_t *rps, return riscv_subset_supports (rps, "m"); case INSN_CLASS_ZMMUL: return riscv_subset_supports (rps, "zmmul"); - case INSN_CLASS_A: - return riscv_subset_supports (rps, "a"); + case INSN_CLASS_ZAAMO: + return riscv_subset_supports (rps, "zaamo"); case INSN_CLASS_ZABHA: return riscv_subset_supports (rps, "zabha"); + case INSN_CLASS_ZALRSC: + return riscv_subset_supports (rps, "zalrsc"); case INSN_CLASS_ZAWRS: return riscv_subset_supports (rps, "zawrs"); case INSN_CLASS_F: @@ -2745,10 +2755,12 @@ riscv_multi_subset_supports_ext (riscv_parse_subset_t *rps, return "m"; case INSN_CLASS_ZMMUL: return _ ("m' or `zmmul"); - case INSN_CLASS_A: - return "a"; + case INSN_CLASS_ZAAMO: + return "zaamo"; case INSN_CLASS_ZABHA: return "zabha"; + case INSN_CLASS_ZALRSC: + return "zalrsc"; case INSN_CLASS_ZAWRS: return "zawrs"; case INSN_CLASS_F: -- cgit v1.1