From 35b5c52ca1923bd0be3e0794cf1da16318742489 Mon Sep 17 00:00:00 2001 From: Joe Faulls Date: Mon, 15 Aug 2022 16:53:26 +0100 Subject: [PATCH 1/2] Revert "RISC-V: Fix wrong expansion for arch-canonicalize" This reverts commit 4f015efba2a89acc6e078d3abf86e69d52932ddf. --- gcc/config/riscv/arch-canonicalize | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/gcc/config/riscv/arch-canonicalize b/gcc/config/riscv/arch-canonicalize index 41bab69193ce..f36a2ca4593b 100755 --- a/gcc/config/riscv/arch-canonicalize +++ b/gcc/config/riscv/arch-canonicalize @@ -70,10 +70,8 @@ def arch_canonicalize(arch, isa_spec): is_isa_spec_2p2 = isa_spec == '2.2' new_arch = "" extra_long_ext = [] - std_exts = [] if arch[:5] in ['rv32e', 'rv32i', 'rv32g', 'rv64i', 'rv64g']: - new_arch = arch[:5].replace("g", "i") - std_exts = ['m', 'a', 'f', 'd'] + new_arch = arch[:5].replace("g", "imafd") if arch[:5] in ['rv32g', 'rv64g']: if not is_isa_spec_2p2: extra_long_ext = ['zicsr', 'zifencei'] @@ -88,10 +86,10 @@ def arch_canonicalize(arch, isa_spec): if long_ext_prefixes_idx: first_long_ext_idx = min(long_ext_prefixes_idx) long_exts = arch[first_long_ext_idx:].split("_") - std_exts += list(arch[5:first_long_ext_idx]) + std_exts = list(arch[5:first_long_ext_idx]) else: long_exts = [] - std_exts += list(arch[5:]) + std_exts = list(arch[5:]) long_exts += extra_long_ext From d7519dbcc3a0bc81bb562feb60afcaac2fed6b9e Mon Sep 17 00:00:00 2001 From: Joe Faulls Date: Mon, 15 Aug 2022 16:54:26 +0100 Subject: [PATCH 2/2] RISC-V: Avoid adding duplicate standard extensions in arch-canonicalize This fixes rv64gcv expanding with duplicate 'fd' extensions. This implements what 4f015efba was trying to fix. --- gcc/config/riscv/arch-canonicalize | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/config/riscv/arch-canonicalize b/gcc/config/riscv/arch-canonicalize index f36a2ca4593b..c6b357b70cfd 100755 --- a/gcc/config/riscv/arch-canonicalize +++ b/gcc/config/riscv/arch-canonicalize @@ -134,7 +134,7 @@ def arch_canonicalize(arch, isa_spec): # Put extensions in canonical order. for ext in CANONICAL_ORDER: - if ext in std_exts: + if ext in std_exts and ext not in new_arch: new_arch += ext # Check every extension is processed.