public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-6836] RISC-V: Do not emit zcisr and zifencei if i-ext is 2.0
@ 2022-01-24 9:49 Kito Cheng
0 siblings, 0 replies; only message in thread
From: Kito Cheng @ 2022-01-24 9:49 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:ca2bbb88f999f4d3cc40e89bc1aba712505dd598
commit r12-6836-gca2bbb88f999f4d3cc40e89bc1aba712505dd598
Author: Kito Cheng <kito.cheng@sifive.com>
Date: Mon Jan 24 15:46:10 2022 +0800
RISC-V: Do not emit zcisr and zifencei if i-ext is 2.0
I-ext 2.0 already included zicsr and zifencei, skip that prevent
confusing binutils.
gcc/ChangeLog
* common/config/riscv/riscv-common.cc (riscv_subset_list::to_string):
Skip zicsr and zifencei if I-ext is 2.0.
Diff:
---
gcc/common/config/riscv/riscv-common.cc | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/gcc/common/config/riscv/riscv-common.cc b/gcc/common/config/riscv/riscv-common.cc
index 25f56707d94..a904893b9ed 100644
--- a/gcc/common/config/riscv/riscv-common.cc
+++ b/gcc/common/config/riscv/riscv-common.cc
@@ -488,6 +488,7 @@ riscv_subset_list::to_string (bool version_p) const
bool skip_zifencei = false;
bool skip_zicsr = false;
+ bool i2p0 = false;
/* For RISC-V ISA version 2.2 or earlier version, zicsr and zifencei is
included in the base ISA. */
@@ -497,6 +498,13 @@ riscv_subset_list::to_string (bool version_p) const
skip_zicsr = true;
}
+ for (subset = m_head; subset != NULL; subset = subset->next)
+ if (subset->name == "i")
+ {
+ i2p0 = subset->major_version == 2 && subset->minor_version == 0;
+ break;
+ }
+
#ifndef HAVE_AS_MISA_SPEC
/* Skip since older binutils doesn't recognize zicsr. */
skip_zicsr = true;
@@ -509,10 +517,12 @@ riscv_subset_list::to_string (bool version_p) const
for (subset = m_head; subset != NULL; subset = subset->next)
{
- if (subset->implied_p && skip_zifencei && subset->name == "zifencei")
+ if (((subset->implied_p && skip_zifencei) || i2p0) &&
+ subset->name == "zifencei")
continue;
- if (subset->implied_p && skip_zicsr && subset->name == "zicsr")
+ if (((subset->implied_p && skip_zicsr) || i2p0) &&
+ subset->name == "zicsr")
continue;
/* For !version_p, we only separate extension with underline for
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-01-24 9:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-24 9:49 [gcc r12-6836] RISC-V: Do not emit zcisr and zifencei if i-ext is 2.0 Kito Cheng
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).