Skip to content
This repository has been archived by the owner on May 7, 2024. It is now read-only.

Riscv gcc 12.1.0 Fix arch canonicalize #352

Open
wants to merge 2 commits into
base: riscv-gcc-12.1.0
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions gcc/config/riscv/arch-canonicalize
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand All @@ -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

Expand Down Expand Up @@ -136,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.
Expand Down