From c509db05e4f1500736f4de994ed2aede544234d5 Mon Sep 17 00:00:00 2001 From: Tsukasa OI Date: Tue, 27 Dec 2022 03:31:19 +0000 Subject: [PATCH] RISC-V: Simplify riscv_csr_address logic on state enable extensions 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 77c0d2e32ab..cc0d7492102 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: -- 2.30.2