From: Tsukasa OI <research_trasio@irq.a4lg.com>
To: Tsukasa OI <research_trasio@irq.a4lg.com>,
Nelson Chu <nelson@rivosinc.com>,
Kito Cheng <kito.cheng@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>
Cc: binutils@sourceware.org
Subject: [PATCH 1/2] RISC-V: Simplify riscv_csr_address logic on state enable extensions
Date: Thu, 29 Dec 2022 03:55:05 +0000 [thread overview]
Message-ID: <c509db05e4f1500736f4de994ed2aede544234d5.1672286099.git.research_trasio@irq.a4lg.com> (raw)
From: Tsukasa OI <research_trasio@irq.a4lg.com>
This commit makes CSR class handling for 'Smstateen' and 'Ssstateen'
extensions simpler using fall-throughs (as used in CSR_CLASS_I{,_32}).
gas/ChangeLog:
* config/tc-riscv.c (riscv_csr_address): Simplify the logic for
'Smstateen' and 'Ssstateen' extensions.
---
gas/config/tc-riscv.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c
index 77c0d2e32abf..cc0d74921027 100644
--- a/gas/config/tc-riscv.c
+++ b/gas/config/tc-riscv.c
@@ -1049,9 +1049,10 @@ riscv_csr_address (const char *csr_name,
case CSR_CLASS_SMAIA:
extension = "smaia";
break;
- case CSR_CLASS_SMSTATEEN:
case CSR_CLASS_SMSTATEEN_32:
- is_rv32_only = (csr_class == CSR_CLASS_SMSTATEEN_32);
+ is_rv32_only = true;
+ /* Fall through. */
+ case CSR_CLASS_SMSTATEEN:
extension = "smstateen";
break;
case CSR_CLASS_SSAIA:
@@ -1064,12 +1065,13 @@ riscv_csr_address (const char *csr_name,
|| csr_class == CSR_CLASS_SSAIA_AND_H_32);
extension = "ssaia";
break;
- case CSR_CLASS_SSSTATEEN:
- case CSR_CLASS_SSSTATEEN_AND_H:
case CSR_CLASS_SSSTATEEN_AND_H_32:
- is_rv32_only = (csr_class == CSR_CLASS_SSSTATEEN_AND_H_32);
- is_h_required = (csr_class == CSR_CLASS_SSSTATEEN_AND_H
- || csr_class == CSR_CLASS_SSSTATEEN_AND_H_32);
+ is_rv32_only = true;
+ /* Fall through. */
+ case CSR_CLASS_SSSTATEEN_AND_H:
+ is_h_required = true;
+ /* Fall through. */
+ case CSR_CLASS_SSSTATEEN:
extension = "ssstateen";
break;
case CSR_CLASS_SSCOFPMF_32:
base-commit: dc20b8f00abb74e2c26846c615ec5ba3a62f8677
--
2.39.0
next reply other threads:[~2022-12-29 3:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-29 3:55 Tsukasa OI [this message]
2022-12-29 3:55 ` [PATCH 2/2] RISC-V: Reorder CSR classes related to 'Ssstateen' Tsukasa OI
2022-12-29 5:19 ` Nelson Chu
2022-12-29 6:24 ` Tsukasa OI
2022-12-29 5:14 ` [PATCH 1/2] RISC-V: Simplify riscv_csr_address logic on state enable extensions 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=c509db05e4f1500736f4de994ed2aede544234d5.1672286099.git.research_trasio@irq.a4lg.com \
--to=research_trasio@irq.a4lg.com \
--cc=binutils@sourceware.org \
--cc=kito.cheng@sifive.com \
--cc=nelson@rivosinc.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).