Skip to content

Commit

Permalink
RISC-V: Simplify riscv_csr_address logic on state enable extensions
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
a4lg committed Dec 29, 2022
1 parent dc20b8f commit c509db0
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions gas/config/tc-riscv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down

0 comments on commit c509db0

Please sign in to comment.