Skip to content

Commit 1649e52

Browse files
committed
rustc_target: Sync with stdarch (important parts)
Of RISC-V features defined in stdarch, this commit adds extensions satisfying following criteria: * Formerly a part of the "I" extension and splitted thereafter (now ratified as "I" + "Zifencei" + "Zicsr" + "Zicntr" + "Zihpm") or * Dicoverable from newer versions of the Linux kernel ("Zihintpause"). This is based on the latest ratified ISA Manuals (version 20240411). One of those, "Zicsr", is a dependency of many other ISA extensions and this commit adds correct dependencies to "Zicsr" except "V" (due to an ongoing PR).
1 parent 48b36c9 commit 1649e52

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

compiler/rustc_target/src/target_features.rs

+8-3
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ static RISCV_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
488488
("c", Stable, &[]),
489489
("d", Unstable(sym::riscv_target_feature), &["f"]),
490490
("e", Unstable(sym::riscv_target_feature), &[]),
491-
("f", Unstable(sym::riscv_target_feature), &[]),
491+
("f", Unstable(sym::riscv_target_feature), &["zicsr"]),
492492
(
493493
"forced-atomics",
494494
Stability::Forbidden { reason: "unsound because it changes the ABI of atomic operations" },
@@ -516,15 +516,20 @@ static RISCV_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
516516
("zdinx", Unstable(sym::riscv_target_feature), &["zfinx"]),
517517
("zfh", Unstable(sym::riscv_target_feature), &["zfhmin"]),
518518
("zfhmin", Unstable(sym::riscv_target_feature), &["f"]),
519-
("zfinx", Unstable(sym::riscv_target_feature), &[]),
519+
("zfinx", Unstable(sym::riscv_target_feature), &["zicsr"]),
520520
("zhinx", Unstable(sym::riscv_target_feature), &["zhinxmin"]),
521521
("zhinxmin", Unstable(sym::riscv_target_feature), &["zfinx"]),
522+
("zicntr", Unstable(sym::riscv_target_feature), &["zicsr"]),
523+
("zicsr", Unstable(sym::riscv_target_feature), &[]),
524+
("zifencei", Unstable(sym::riscv_target_feature), &[]),
525+
("zihintpause", Unstable(sym::riscv_target_feature), &[]),
526+
("zihpm", Unstable(sym::riscv_target_feature), &["zicsr"]),
522527
("zk", Stable, &["zkn", "zkr", "zkt"]),
523528
("zkn", Stable, &["zbkb", "zbkc", "zbkx", "zkne", "zknd", "zknh"]),
524529
("zknd", Stable, &[]),
525530
("zkne", Stable, &[]),
526531
("zknh", Stable, &[]),
527-
("zkr", Stable, &[]),
532+
("zkr", Stable, &["zicsr"]),
528533
("zks", Stable, &["zbkb", "zbkc", "zbkx", "zksed", "zksh"]),
529534
("zksed", Stable, &[]),
530535
("zksh", Stable, &[]),

tests/ui/check-cfg/target_feature.stderr

+5
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,11 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
317317
`zfinx`
318318
`zhinx`
319319
`zhinxmin`
320+
`zicntr`
321+
`zicsr`
322+
`zifencei`
323+
`zihintpause`
324+
`zihpm`
320325
`zk`
321326
`zkn`
322327
`zknd`

0 commit comments

Comments
 (0)