Rollup merge of #140139 - a4lg:riscv-feature-imply-adjust-1, r=Amanieu
rustc_target: Adjust RISC-V feature implication
This commit adjusts feature implication of the RISC-V ISA for better feature detection from the user perspective.
The main rule is:
* If the feature `A` is a functional superset of the feature `B` (`A ⊃ B`),
`A` is to imply `B`, 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 of `B`".
1. `Zbc` → `Zbkc` (add as a superset)
The `Zbkc` extension is a subset of the `Zbc` extension (`Zbc` minus `clmulr` instruction).
2. `Zkr` → (nothing) (remove dependency to `Zicsr`)
Implication to the `Zicsr` extension is removed because (although nearly harmless), the `Zkr` extension (or the `seed` CSR section) defines its own subset of the `Zicsr` extension (guaranteed to work against the `seed` CSR which needs read/write access).
3. `Zvbb` → `Zvkb` (comment as a superset)
This implication was already there but not denoted as a functional superset. This commit adds the comment.
4. `Zvfh` → `Zvfhmin` (comment as a superset)
This is similar to the case above (`Zvbb` → `Zvkb`).
5. `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 implies `Zve32f` on the current implementation through `Zvfh` → `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).
6. `Zvknhb` → `Zvknha` (add as a superset)
The `Zvknhb` extension (SHA-256 / SHA-512) is a functional superset of the `Zvknha` extension (SHA-256 only).
This commit is contained in:
@@ -516,7 +516,7 @@ static RISCV_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
|
|||||||
("zawrs", Unstable(sym::riscv_target_feature), &[]),
|
("zawrs", Unstable(sym::riscv_target_feature), &[]),
|
||||||
("zba", Stable, &[]),
|
("zba", Stable, &[]),
|
||||||
("zbb", Stable, &[]),
|
("zbb", Stable, &[]),
|
||||||
("zbc", Stable, &[]),
|
("zbc", Stable, &["zbkc"]), // Zbc ⊃ Zbkc
|
||||||
("zbkb", Stable, &[]),
|
("zbkb", Stable, &[]),
|
||||||
("zbkc", Stable, &[]),
|
("zbkc", Stable, &[]),
|
||||||
("zbkx", Stable, &[]),
|
("zbkx", Stable, &[]),
|
||||||
@@ -545,20 +545,20 @@ static RISCV_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
|
|||||||
("zknd", Stable, &[]),
|
("zknd", Stable, &[]),
|
||||||
("zkne", Stable, &[]),
|
("zkne", Stable, &[]),
|
||||||
("zknh", Stable, &[]),
|
("zknh", Stable, &[]),
|
||||||
("zkr", Stable, &["zicsr"]),
|
("zkr", Stable, &[]),
|
||||||
("zks", Stable, &["zbkb", "zbkc", "zbkx", "zksed", "zksh"]),
|
("zks", Stable, &["zbkb", "zbkc", "zbkx", "zksed", "zksh"]),
|
||||||
("zksed", Stable, &[]),
|
("zksed", Stable, &[]),
|
||||||
("zksh", Stable, &[]),
|
("zksh", Stable, &[]),
|
||||||
("zkt", Stable, &[]),
|
("zkt", Stable, &[]),
|
||||||
("ztso", Unstable(sym::riscv_target_feature), &[]),
|
("ztso", Unstable(sym::riscv_target_feature), &[]),
|
||||||
("zvbb", Unstable(sym::riscv_target_feature), &["zvkb"]),
|
("zvbb", Unstable(sym::riscv_target_feature), &["zvkb"]), // Zvbb ⊃ Zvkb
|
||||||
("zvbc", Unstable(sym::riscv_target_feature), &["zve64x"]),
|
("zvbc", Unstable(sym::riscv_target_feature), &["zve64x"]),
|
||||||
("zve32f", Unstable(sym::riscv_target_feature), &["zve32x", "f"]),
|
("zve32f", Unstable(sym::riscv_target_feature), &["zve32x", "f"]),
|
||||||
("zve32x", Unstable(sym::riscv_target_feature), &["zvl32b", "zicsr"]),
|
("zve32x", Unstable(sym::riscv_target_feature), &["zvl32b", "zicsr"]),
|
||||||
("zve64d", Unstable(sym::riscv_target_feature), &["zve64f", "d"]),
|
("zve64d", Unstable(sym::riscv_target_feature), &["zve64f", "d"]),
|
||||||
("zve64f", Unstable(sym::riscv_target_feature), &["zve32f", "zve64x"]),
|
("zve64f", Unstable(sym::riscv_target_feature), &["zve32f", "zve64x"]),
|
||||||
("zve64x", Unstable(sym::riscv_target_feature), &["zve32x", "zvl64b"]),
|
("zve64x", Unstable(sym::riscv_target_feature), &["zve32x", "zvl64b"]),
|
||||||
("zvfh", Unstable(sym::riscv_target_feature), &["zvfhmin", "zfhmin"]),
|
("zvfh", Unstable(sym::riscv_target_feature), &["zvfhmin", "zve32f", "zfhmin"]), // Zvfh ⊃ Zvfhmin
|
||||||
("zvfhmin", Unstable(sym::riscv_target_feature), &["zve32f"]),
|
("zvfhmin", Unstable(sym::riscv_target_feature), &["zve32f"]),
|
||||||
("zvkb", Unstable(sym::riscv_target_feature), &["zve32x"]),
|
("zvkb", Unstable(sym::riscv_target_feature), &["zve32x"]),
|
||||||
("zvkg", Unstable(sym::riscv_target_feature), &["zve32x"]),
|
("zvkg", Unstable(sym::riscv_target_feature), &["zve32x"]),
|
||||||
@@ -567,7 +567,7 @@ static RISCV_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
|
|||||||
("zvkned", Unstable(sym::riscv_target_feature), &["zve32x"]),
|
("zvkned", Unstable(sym::riscv_target_feature), &["zve32x"]),
|
||||||
("zvkng", Unstable(sym::riscv_target_feature), &["zvkn", "zvkg"]),
|
("zvkng", Unstable(sym::riscv_target_feature), &["zvkn", "zvkg"]),
|
||||||
("zvknha", Unstable(sym::riscv_target_feature), &["zve32x"]),
|
("zvknha", Unstable(sym::riscv_target_feature), &["zve32x"]),
|
||||||
("zvknhb", Unstable(sym::riscv_target_feature), &["zve64x"]),
|
("zvknhb", Unstable(sym::riscv_target_feature), &["zvknha", "zve64x"]), // Zvknhb ⊃ Zvknha
|
||||||
("zvks", Unstable(sym::riscv_target_feature), &["zvksed", "zvksh", "zvkb", "zvkt"]),
|
("zvks", Unstable(sym::riscv_target_feature), &["zvksed", "zvksh", "zvkb", "zvkt"]),
|
||||||
("zvksc", Unstable(sym::riscv_target_feature), &["zvks", "zvbc"]),
|
("zvksc", Unstable(sym::riscv_target_feature), &["zvks", "zvbc"]),
|
||||||
("zvksed", Unstable(sym::riscv_target_feature), &["zve32x"]),
|
("zvksed", Unstable(sym::riscv_target_feature), &["zve32x"]),
|
||||||
|
|||||||
Reference in New Issue
Block a user