Skip to content

Commit 0117fa8

Browse files
committed
MOCK: RISC-V: Add 'Zce' extension support
It adds a support for the 'Zce' superset compressed instruction extension for embedded systems. **THIS IS A MOCKUP** Since 'Zcmp' and 'Zcmt' are not added to GNU Binutils yet, this commit is just a mockup. However, it outlines what will be required on the 'Zce' support along with new complex implication design. bfd/ChangeLog: * elfxx-riscv.c (check_implicit_for_f_zce): New function to check whether adding implication 'F' -> 'Zcf' is appropriate. (riscv_implicit_subsets): Add conditional implication from 'F' -> 'Zcf'. (riscv_supported_std_z_ext): [MOCK] Add 'Zce' to the supported 'Z' extension list.
1 parent 096efb6 commit 0117fa8

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

bfd/elfxx-riscv.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,6 +1099,19 @@ check_implicit_for_i (riscv_parse_subset_t *rps ATTRIBUTE_UNUSED,
10991099
&& subset->minor_version < 1));
11001100
}
11011101

1102+
/* Add the IMPLICIT only when the 'Zce' extension is also available
1103+
and XLEN is 32. */
1104+
1105+
static bool
1106+
check_implicit_for_f_zce (riscv_parse_subset_t *rps,
1107+
const riscv_implicit_subset_t *implicit
1108+
ATTRIBUTE_UNUSED,
1109+
const riscv_subset_t *subset ATTRIBUTE_UNUSED)
1110+
{
1111+
return *rps->xlen == 32
1112+
&& riscv_subset_supports (rps, "zce");
1113+
}
1114+
11021115
/* All extension implications. */
11031116

11041117
static riscv_implicit_subset_t riscv_implicit_subsets[] =
@@ -1188,6 +1201,10 @@ static riscv_implicit_subset_t riscv_implicit_subsets[] =
11881201
{"zvksg", "zvkg", check_implicit_always},
11891202
{"zvksc", "zvks", check_implicit_always},
11901203
{"zvksc", "zvbc", check_implicit_always},
1204+
{"zce", "zca", check_implicit_always},
1205+
{"zce", "zcb", check_implicit_always},
1206+
{"zce", "zcmp", check_implicit_always},
1207+
{"zce", "zcmt", check_implicit_always},
11911208
{"zcf", "zca", check_implicit_always},
11921209
{"zcd", "zca", check_implicit_always},
11931210
{"zcb", "zca", check_implicit_always},
@@ -1198,6 +1215,9 @@ static riscv_implicit_subset_t riscv_implicit_subsets[] =
11981215
{"sscofpmf", "zicsr", check_implicit_always},
11991216
{"ssstateen", "zicsr", check_implicit_always},
12001217
{"sstc", "zicsr", check_implicit_always},
1218+
/* Complex implications (that should be checked after others). */
1219+
{"f", "zcf", check_implicit_for_f_zce},
1220+
/* Tail of the list. */
12011221
{NULL, NULL, NULL}
12021222
};
12031223

@@ -1330,6 +1350,10 @@ static struct riscv_supported_ext riscv_supported_std_z_ext[] =
13301350
{"zcb", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 },
13311351
{"zcf", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 },
13321352
{"zcd", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 },
1353+
/* MOCK: uncomment those lines once ready. */
1354+
// {"zce", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 },
1355+
// {"zcmp", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 },
1356+
// {"zcmt", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 },
13331357
{NULL, 0, 0, 0, 0}
13341358
};
13351359

0 commit comments

Comments
 (0)