Skip to content

Commit b2e4149

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 e568c28 commit b2e4149

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

bfd/elfxx-riscv.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,6 +1099,20 @@ check_implicit_for_i (const 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 (const 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+
riscv_subset_t *tmp = NULL;
1112+
return *rps->xlen == 32
1113+
&& riscv_lookup_subset (rps->subset_list, "zce", &tmp);
1114+
}
1115+
11021116
/* All extension implications. */
11031117

11041118
static riscv_implicit_subset_t riscv_implicit_subsets[] =
@@ -1184,6 +1198,10 @@ static riscv_implicit_subset_t riscv_implicit_subsets[] =
11841198
{"zvksg", "zvkg", check_implicit_always},
11851199
{"zvksc", "zvks", check_implicit_always},
11861200
{"zvksc", "zvbc", check_implicit_always},
1201+
{"zce", "zca", check_implicit_always},
1202+
{"zce", "zcb", check_implicit_always},
1203+
{"zce", "zcmp", check_implicit_always},
1204+
{"zce", "zcmt", check_implicit_always},
11871205
{"zcf", "zca", check_implicit_always},
11881206
{"zcd", "zca", check_implicit_always},
11891207
{"zcb", "zca", check_implicit_always},
@@ -1194,6 +1212,9 @@ static riscv_implicit_subset_t riscv_implicit_subsets[] =
11941212
{"sscofpmf", "zicsr", check_implicit_always},
11951213
{"ssstateen", "zicsr", check_implicit_always},
11961214
{"sstc", "zicsr", check_implicit_always},
1215+
/* Complex implications (that should be checked after others). */
1216+
{"f", "zcf", check_implicit_for_f_zce},
1217+
/* Tail of the list. */
11971218
{NULL, NULL, NULL}
11981219
};
11991220

@@ -1325,6 +1346,10 @@ static struct riscv_supported_ext riscv_supported_std_z_ext[] =
13251346
{"zcb", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 },
13261347
{"zcf", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 },
13271348
{"zcd", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 },
1349+
/* MOCK: uncomment those lines once ready. */
1350+
// {"zce", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 },
1351+
// {"zcmp", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 },
1352+
// {"zcmt", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 },
13281353
{NULL, 0, 0, 0, 0}
13291354
};
13301355

0 commit comments

Comments
 (0)