Skip to content

Commit

Permalink
RISC-V: Minimal support of ZC extensions.
Browse files Browse the repository at this point in the history
This patch add all ZC* extension base support, and enable compress
feature when Zca extension enabled.

Co-Authored by: Charlie Keaney <charlie.keaney@embecosm.com>
Co-Authored by: Mary Bennett <mary.bennett@embecosm.com>
Co-Authored by: Nandni Jamnadas <nandni.jamnadas@embecosm.com>
Co-Authored by: Sinan Lin <sinan.lin@linux.alibaba.com>
Co-Authored by: Simon Cook <simon.cook@embecosm.com>
Co-Authored by: Shihua Liao <shihua@iscas.ac.cn>
Co-Authored by: Yulong Shi <yulong@iscas.ac.cn>

bfd/ChangeLog:

        * elfxx-riscv.c (riscv_multi_subset_supports): New extensions.

gas/ChangeLog:

        * config/tc-riscv.c (riscv_set_arch): Extend compress check.
  • Loading branch information
pz9115 authored and ouuleilei-bot committed Jun 13, 2023
1 parent 324998b commit 37eba51
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
26 changes: 23 additions & 3 deletions bfd/elfxx-riscv.c
Original file line number Diff line number Diff line change
Expand Up @@ -1101,6 +1101,16 @@ static struct riscv_implicit_subset riscv_implicit_subsets[] =
{"zks", "zbkx", check_implicit_always},
{"zks", "zksed", check_implicit_always},
{"zks", "zksh", check_implicit_always},
{"zce", "zca", check_implicit_always},
{"zce", "zcb", check_implicit_always},
{"zce", "zcf", check_implicit_always},
{"zce", "zcmp", check_implicit_always},
{"zce", "zcmt", check_implicit_always},
{"zcf", "zca", check_implicit_always},
{"zcd", "zca", check_implicit_always},
{"zcb", "zca", check_implicit_always},
{"zcmp", "zca", check_implicit_always},
{"zcmt", "zca", check_implicit_always},
{"smaia", "ssaia", check_implicit_always},
{"smstateen", "ssstateen", check_implicit_always},
{"smepmp", "zicsr", check_implicit_always},
Expand Down Expand Up @@ -1218,6 +1228,13 @@ static struct riscv_supported_ext riscv_supported_std_z_ext[] =
{"zvl32768b", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 },
{"zvl65536b", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 },
{"ztso", ISA_SPEC_CLASS_DRAFT, 0, 1, 0 },
{"zca", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 },
{"zcb", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 },
{"zce", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 },
{"zcf", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 },
{"zcd", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 },
{"zcmp", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 },
{"zcmt", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 },
{NULL, 0, 0, 0, 0}
};

Expand Down Expand Up @@ -2279,13 +2296,16 @@ riscv_multi_subset_supports (riscv_parse_subset_t *rps,
case INSN_CLASS_Q:
return riscv_subset_supports (rps, "q");
case INSN_CLASS_C:
return riscv_subset_supports (rps, "c");
return riscv_subset_supports (rps, "c")
|| riscv_subset_supports (rps, "zca");
case INSN_CLASS_F_AND_C:
return (riscv_subset_supports (rps, "f")
&& riscv_subset_supports (rps, "c"));
&& (riscv_subset_supports (rps, "c")
|| riscv_subset_supports (rps, "zcf")));
case INSN_CLASS_D_AND_C:
return (riscv_subset_supports (rps, "d")
&& riscv_subset_supports (rps, "c"));
&& (riscv_subset_supports (rps, "c")
|| riscv_subset_supports (rps, "zcd")));
case INSN_CLASS_F_INX:
return (riscv_subset_supports (rps, "f")
|| riscv_subset_supports (rps, "zfinx"));
Expand Down
3 changes: 2 additions & 1 deletion gas/config/tc-riscv.c
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,8 @@ riscv_set_arch (const char *s)
riscv_reset_subsets_list_arch_str ();

riscv_set_rvc (false);
if (riscv_subset_supports (&riscv_rps_as, "c"))
if (riscv_subset_supports (&riscv_rps_as, "c")
|| riscv_subset_supports (&riscv_rps_as, "zca"))
riscv_set_rvc (true);

if (riscv_subset_supports (&riscv_rps_as, "ztso"))
Expand Down

0 comments on commit 37eba51

Please sign in to comment.