rustc_target: RISC-V: feature addition batch 2 #139440
Open
+25
−2
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.
Of ratified RISC-V extensions, this commit adds ones satisfying following criteria:
riscv_hwprobe
system call on Linux 6.14or should be very helpful even on basic needs (the
B
extension) andDue to 2., the author excluded
Zcf
(RV32 only) andZcd
from the list despite that they are discoverable from Linux 6.14.This is based on those two specifications:
Linux Definition: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/riscv/include/uapi/asm/hwprobe.h
LLVM Definitions:
B
Zca
Zcb
Zcmop
Zfa
Zicboz
Zicond
Zihintntl
Zimop
Ztso
Supm
(LLVM 19 (experimental) / LLVM 20 (non-experimental and enabled on Rust side through this PR))The author also adds required implication:
C
impliesZca
.Android RISC-V target is also updated to include the
B
extension (this is just a shorthand combination ofZba
,Zbb
andZbs
extensions but possibly simplifiestarget_feature
handling).Note that absence of non-experimental
Supm
extension on LLVM 19 should not affect the codegen because of this extension's position: unlike most of the RISC-V extensions, theSupm
extension defines some mechanism to control pointer masking behavior but provides none of additional instructions, CSRs nor some architectural behaviors/constraints (i.e. it tells the existence of an external mechanism such like a system call of an operating system which changes the behavior of the pointer masking using features defined bySsnpm
and/orSmnpm
extensions, notSupm
).Related:
#[target_feature]
#44839(
riscv_target_feature
)I
-related important extensions #138823(my previous batch)
-Ctarget-feature
s must be restrained on RISCV #132618(stabilization of the
Zfa
extension is blocked by this)@rustbot r? @Amanieu
@rustbot label +T-compiler +O-riscv +A-target-feature