From: Tsukasa OI <research_trasio@irq.a4lg.com>
To: Tsukasa OI <research_trasio@irq.a4lg.com>,
Kito Cheng <kito.cheng@sifive.com>,
Nelson Chu <nelson.chu@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>
Cc: binutils@sourceware.org
Subject: [PATCH v3 1/4] RISC-V: Add new CSR feature gate handling (RV32,H)
Date: Fri, 24 Jun 2022 11:51:53 +0900 [thread overview]
Message-ID: <40ba935168e64739fce9e57a532bcfe5a62b431b.1656038939.git.research_trasio@irq.a4lg.com> (raw)
In-Reply-To: <cover.1656038939.git.research_trasio@irq.a4lg.com>
To support feature gate like Smstateen && H, this commit adds certain
CSR feature gate handling. It also changes how RV32-only CSRs are
handled for cleanliness.
gas/ChangeLog:
* config/tc-riscv.c (riscv_csr_address): Add CSR feature gate
handling for H. Change handling on RV32.
---
gas/config/tc-riscv.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c
index 6b04dc98b76..6c5938b5596 100644
--- a/gas/config/tc-riscv.c
+++ b/gas/config/tc-riscv.c
@@ -899,20 +899,21 @@ riscv_csr_address (const char *csr_name,
struct riscv_csr_extra *saved_entry = entry;
enum riscv_csr_class csr_class = entry->csr_class;
bool need_check_version = false;
- bool rv32_only = true;
+ bool is_rv32_only = false;
+ bool is_h_required = false;
const char* extension = NULL;
switch (csr_class)
{
case CSR_CLASS_I_32:
- rv32_only = (xlen == 32);
+ is_rv32_only = true;
/* Fall through. */
case CSR_CLASS_I:
need_check_version = true;
extension = "i";
break;
case CSR_CLASS_H_32:
- rv32_only = (xlen == 32);
+ is_rv32_only = true;
/* Fall through. */
case CSR_CLASS_H:
extension = "h";
@@ -934,8 +935,10 @@ riscv_csr_address (const char *csr_name,
if (riscv_opts.csr_check)
{
- if (!rv32_only)
+ if (is_rv32_only && xlen != 32)
as_warn (_("invalid CSR `%s', needs rv32i extension"), csr_name);
+ if (is_h_required && !riscv_subset_supports (&riscv_rps_as, "h"))
+ as_warn (_("invalid CSR `%s', needs `h' extension"), csr_name);
if (extension != NULL
&& !riscv_subset_supports (&riscv_rps_as, extension))
--
2.34.1
next prev parent reply other threads:[~2022-06-24 2:52 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-11 10:59 [PATCH 0/6] RISC-V: Add Privileged Arch 1.12 and More CSRs Tsukasa OI
2022-01-11 10:59 ` [PATCH 1/6] RISC-V: Reorganize testcases for CFI directives Tsukasa OI
2022-02-23 6:58 ` Nelson Chu
2022-01-11 10:59 ` [PATCH 2/6] RISC-V: Add Privileged Architecture 1.12 CSRs Tsukasa OI
2022-02-23 6:58 ` Nelson Chu
2022-02-24 2:35 ` Tsukasa OI
2022-02-24 6:05 ` Nelson Chu
2022-01-11 10:59 ` [PATCH 3/6] RISC-V: Add Privileged Arch 1.12 CSR testcases Tsukasa OI
2022-02-23 6:58 ` Nelson Chu
2022-01-11 10:59 ` [PATCH 4/6] RISC-V: Add 'Smstateen' extension and its CSRs Tsukasa OI
2022-01-11 10:59 ` [PATCH 5/6] RISC-V: Add 'Sscofpmf' extension with " Tsukasa OI
2022-01-11 10:59 ` [PATCH 6/6] RISC-V: Add 'Sstc' extension and " Tsukasa OI
2022-02-24 12:10 ` [PATCH 0/3] RISC-V: Add CSRs for several supervisor extensions Tsukasa OI
2022-02-24 12:10 ` [PATCH 1/3] RISC-V: Add 'Smstateen' extension and its CSRs Tsukasa OI
2022-02-25 6:32 ` Nelson Chu
2022-02-25 6:35 ` Tsukasa OI
2022-02-25 10:51 ` Tsukasa OI
2022-03-02 4:34 ` Nelson Chu
2022-02-24 12:10 ` [PATCH 2/3] RISC-V: Add 'Sscofpmf' extension with " Tsukasa OI
2022-02-24 12:10 ` [PATCH 3/3] RISC-V: Add 'Sstc' extension and " Tsukasa OI
2022-05-24 9:35 ` [PATCH v2 0/3] RISC-V: Add CSRs for several supervisor extensions Tsukasa OI
2022-05-24 9:35 ` [PATCH v2 1/3] RISC-V: Add 'Smstateen' extension and its CSRs Tsukasa OI
2022-05-24 9:35 ` [PATCH v2 2/3] RISC-V: Add 'Sscofpmf' extension with " Tsukasa OI
2022-05-24 9:35 ` [PATCH v2 3/3] RISC-V: Add 'Sstc' extension and " Tsukasa OI
2022-06-24 2:51 ` [PATCH v3 0/4] RISC-V: Add CSRs for several supervisor extensions Tsukasa OI
2022-06-24 2:51 ` Tsukasa OI [this message]
2022-06-24 2:51 ` [PATCH v3 2/4] RISC-V: Add 'Smstateen' extension and its CSRs Tsukasa OI
2022-06-24 2:51 ` [PATCH v3 3/4] RISC-V: Add 'Sscofpmf' extension with " Tsukasa OI
2022-06-24 2:51 ` [PATCH v3 4/4] RISC-V: Add 'Sstc' extension and " Tsukasa OI
2022-06-28 1:40 ` [PATCH v3 0/4] RISC-V: Add CSRs for several supervisor extensions Nelson Chu
2022-06-28 5:33 ` Tsukasa OI
2022-06-28 6:56 ` Nelson Chu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=40ba935168e64739fce9e57a532bcfe5a62b431b.1656038939.git.research_trasio@irq.a4lg.com \
--to=research_trasio@irq.a4lg.com \
--cc=binutils@sourceware.org \
--cc=kito.cheng@sifive.com \
--cc=nelson.chu@sifive.com \
--cc=palmer@dabbelt.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).