aboutsummaryrefslogtreecommitdiff
path: root/gcc/common/config
diff options
context:
space:
mode:
authorKito Cheng <kito.cheng@sifive.com>2022-10-14 17:34:02 +0800
committerKito Cheng <kito.cheng@sifive.com>2022-10-26 08:59:45 +0800
commit0cd11d301013af50a3fae0694c909952e94e20d5 (patch)
tree308a8f19b2c6ee58a6bc27e1ddeaeb4e58fc0ad9 /gcc/common/config
parenta9f339d86f8e26e3a4b3ad169e1937a254d19cf7 (diff)
downloadgcc-0cd11d301013af50a3fae0694c909952e94e20d5.zip
gcc-0cd11d301013af50a3fae0694c909952e94e20d5.tar.gz
gcc-0cd11d301013af50a3fae0694c909952e94e20d5.tar.bz2
RISC-V: Add h extension support
`h` was the prefix of multi-letter extension name, but it become a extension in later RISC-V isa spec. Fortunately we don't have any extension really defined is prefixed with `h`, so we can just change that. gcc/ChangeLog: * common/config/riscv/riscv-common.cc (riscv_ext_version_table): Add `h`. (riscv_supported_std_ext): Ditto. (multi_letter_subset_rank): Remove `h`. (riscv_subset_list::parse_std_ext): Handle `h` as single letter extension. (riscv_subset_list::parse): Ditto. gcc/testsuite/ChangeLog: * gcc.target/riscv/arch-18.c: New. * gcc.target/riscv/arch-5.c: Remove test for prefixed with `h`. * gcc.target/riscv/predef-23.c: New.
Diffstat (limited to 'gcc/common/config')
-rw-r--r--gcc/common/config/riscv/riscv-common.cc23
1 files changed, 8 insertions, 15 deletions
diff --git a/gcc/common/config/riscv/riscv-common.cc b/gcc/common/config/riscv/riscv-common.cc
index dead3802..d77020b 100644
--- a/gcc/common/config/riscv/riscv-common.cc
+++ b/gcc/common/config/riscv/riscv-common.cc
@@ -145,6 +145,8 @@ static const struct riscv_ext_version riscv_ext_version_table[] =
{"c", ISA_SPEC_CLASS_20190608, 2, 0},
{"c", ISA_SPEC_CLASS_2P2, 2, 0},
+ {"h", ISA_SPEC_CLASS_NONE, 1, 0},
+
{"v", ISA_SPEC_CLASS_NONE, 1, 0},
{"zicsr", ISA_SPEC_CLASS_20191213, 2, 0},
@@ -361,21 +363,18 @@ multi_letter_subset_rank (const std::string &subset)
gcc_assert (subset.length () >= 2);
int high_order = -1;
int low_order = 0;
- /* The order between multi-char extensions: s -> h -> z -> x. */
+ /* The order between multi-char extensions: s -> z -> x. */
char multiletter_class = subset[0];
switch (multiletter_class)
{
case 's':
high_order = 0;
break;
- case 'h':
- high_order = 1;
- break;
case 'z':
- high_order = 2;
+ high_order = 1;
break;
case 'x':
- high_order = 3;
+ high_order = 2;
break;
default:
gcc_unreachable ();
@@ -671,7 +670,7 @@ riscv_subset_list::lookup (const char *subset, int major_version,
static const char *
riscv_supported_std_ext (void)
{
- return "mafdqlcbkjtpvn";
+ return "mafdqlcbkjtpvnh";
}
/* Parsing subset version.
@@ -830,7 +829,7 @@ riscv_subset_list::parse_std_ext (const char *p)
{
char subset[2] = {0, 0};
- if (*p == 'x' || *p == 's' || *p == 'h' || *p == 'z')
+ if (*p == 'x' || *p == 's' || *p == 'z')
break;
if (*p == '_')
@@ -955,7 +954,7 @@ riscv_subset_list::handle_combine_ext ()
Arguments:
`p`: Current parsing position.
- `ext_type`: What kind of extensions, 's', 'h', 'z' or 'x'.
+ `ext_type`: What kind of extensions, 's', 'z' or 'x'.
`ext_type_str`: Full name for kind of extension. */
const char *
@@ -1097,12 +1096,6 @@ riscv_subset_list::parse (const char *arch, location_t loc)
if (p == NULL)
goto fail;
- /* Parsing hypervisor extension. */
- p = subset_list->parse_multiletter_ext (p, "h", "hypervisor extension");
-
- if (p == NULL)
- goto fail;
-
/* Parsing sub-extensions. */
p = subset_list->parse_multiletter_ext (p, "z", "sub-extension");