rustc_target: RISC-V: add base I
-related important extensions by a4lg · Pull Request #138823 · rust-lang/rust (original) (raw)
Of ratified RISC-V features defined, this commit adds extensions satisfying following criteria:
- Formerly a part of the
I
extension and splitted thereafter (now ratified asI
+Zifencei
+Zicsr
+Zicntr
+Zihpm
) or - Dicoverable from newer versions of the Linux kernel and implemented as a part of
std_detect
's feature (Zihintpause
) and - Available on LLVM 18.
This is based on the latest ratified ISA Manuals (version 20240411).
LLVM Definitions:
Additional (1):
One of those, Zicsr
, is a dependency of many other ISA extensions and this commit adds correct dependencies to Zicsr
.
Additional (2):
In RISC-V, G
is an abbreviation of following extensions:
I
M
A
F
D
Zicsr
(although implied byF
)Zifencei
and all RISC-V targets with the G
abbreviation and targets for Android / VxWorks are updated accordingly.
Note:
Android will require RVA22 (likely RVA22U64) and some more extensions, which is a superset of RV64GC. For VxWorks, all BSPs currently distributed by Wind River are for boards with RV64GC (this commit also updates riscv32-wrs-vxworks
though).
This is the version 4.Ztso
in the original proposal is removed on the PR version 2 due to the minimum LLVM version (non-experimental Ztso
requires LLVM 19 while minimum LLVM version of Rust is 18). This is not back in PR version 3 and 4 after noticing adding Ztso
is possible by checking host LLVM version because PR version 3 introduces compiler target changes (and adding more extensions would complicate the problems; sorry Zihintpause
).
Version 4:
- Fixed some commit messages,
- Added Android / VxWorks targets to imply
G
and - Added an implication from
Zve32x
toZicsr
(which makes all vector extension subsets to implyZicsr
)
since rustc_target: Add more RISC-V vector-related features and use zvl*b target features in vector ABI check #138742 is now merged.
Related:
- Tracking issue for RFC 2045: improving #[target_feature] #44839
(riscv_target_feature
) - Tracking Issue for RISC-V Ratified Extensions Intrinsics #114544
(This PR can be a prerequisite of resolving a part of that tracking issue) - rustc_target: Add more RISC-V vector-related features and use zvl*b target features in vector ABI check #138742
(Touches the same place and vector extensions depend onZicsr
)
NOT Related but linked:
- Some -Ctarget-features must be restrained on RISCV #132618
(This PR won't be blocked by this issue since none of those extensions do not change the ABI)
@rustbot r? @Amanieu
@rustbot label +T-compiler +O-riscv +A-target-feature