rustc_target: Adjust RISC-V feature implication #140139
Open
+5
−5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit adjusts feature implication of the RISC-V ISA for better feature detection from the user perspective.
The main rule is:
A
is a functional superset of the featureB
(A ⊃ B
),A
is to implyB
, even if this implication is not on the manual.Such implications (not directly written in the ISA manual) are commented as
A ⊃ B
which means "
A
is a (functional) superset ofB
".Zbc
→Zbkc
(add as a superset)The
Zbkc
extension is a subset of theZbc
extension (Zbc
minusclmulr
instruction).Zkr
→ (nothing) (remove dependency toZicsr
)Implication to the
Zicsr
extension is removed because (although nearly harmless), theZkr
extension (or theseed
CSR section) defines its own subset of theZicsr
extension (guaranteed to work against theseed
CSR which needs read/write access).Zvbb
→Zvkb
(comment as a superset)This implication was already there but not denoted as a functional superset. This commit adds the comment.
Zvfh
→Zvfhmin
(comment as a superset)This is similar to the case above (
Zvbb
→Zvkb
).Zvfh
→Zve32f
(add implication per the ISA specification)This dependency is on the ISA manual but was missing (due to the fact that
Zvfh
indirectly impliesZve32f
on the current implementation throughZvfh
→Zvfhmin
which is a functional relation). This commit ensures that this is also ISA-compliant in the source code level (there's no functional changes though).Zvknhb
→Zvknha
(add as a superset)The
Zvknhb
extension (SHA-256 / SHA-512) is a functional superset of theZvknha
extension (SHA-256 only).Related:
#[target_feature]
#44839(
riscv_target_feature
)riscv_hwprobe
-based feature detection on Linux / Android stdarch#1770(synchronized with
stdarch
's latest RISC-V implication logic)@rustbot r? @Amanieu
@rustbot label +T-compiler +O-riscv +A-target-feature