Skip to content

Commit cad45cd

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 e4d4e27 commit cad45cd

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},
@@ -1200,6 +1217,9 @@ static riscv_implicit_subset_t riscv_implicit_subsets[] =
12001217
{"ssstateen", "zicsr", check_implicit_always},
12011218
{"sstc", "zicsr", check_implicit_always},
12021219
{"svadu", "zicsr", check_implicit_always},
1220+
/* Complex implications (that should be checked after others). */
1221+
{"f", "zcf", check_implicit_for_f_zce},
1222+
/* Tail of the list. */
12031223
{NULL, NULL, NULL}
12041224
};
12051225

@@ -1333,6 +1353,10 @@ static struct riscv_supported_ext riscv_supported_std_z_ext[] =
13331353
{"zcb", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 },
13341354
{"zcf", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 },
13351355
{"zcd", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 },
1356+
/* MOCK: uncomment those lines once ready. */
1357+
// {"zce", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 },
1358+
// {"zcmp", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 },
1359+
// {"zcmt", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 },
13361360
{NULL, 0, 0, 0, 0}
13371361
};
13381362

0 commit comments

Comments
 (0)