Originally, we used an array of `riscv_hwprobe` directly and indexed
using raw numbers, making correspondence between the index and the query
key less obvious.
We also frequently used `out[idx].key != -1` to test whether the key is
supported by the `riscv_hwprobe` system call (on the Linux kernel
version we are testing) but we'd better to integrate with an operation
to retrieve the value.
This commit improves the ergonomics of feature querying by:
1. Utilizing macros to
a. enable indexing by identifier names and
b. encapsulate accesses to the `riscv_hwprobe` array to query and
2. New method `riscv_hwprobe::get()` returning `Option<u64>`,
integrating availability checking and value retrieval.
It also removes `has_ima` for now because it's redundant if we only need
to test for single base behavior.
We don't need to put the length of the `riscv_hwprobe` array into a
variable. This commit removes that variable and gives the length
of the output slice to the `__riscv_hwprobe` directly.
Since [1], this will come automatically from `rustc-std-workspace-core`
and the crates.io dependency should no longer be specified.
[1]: https://github.com/rust-lang/rust/pull/141993
This commit adds support for `riscv_hwprobe` on the Linux kernel 6.15.
It adds feature detection of 8 extensions (4 of them are new in this).
Existing RISC-V Extensions:
1. "Zicntr"
2. "Zihpm"
3. "Zalrsc"
4. "Zaamo"
New RISC-V Extensions:
5. "Zicbom"
6. "Zfbfmin"
7. "Zvfbfmin"
8. "Zvfbfwma"
It seems it returns true when *no* constraints are found, opposite to
the expected behavior of the function name.
This commit reverses condition as the name suggests.
It modernizes the coding style of the crate intrinsic-test by fixing
Clippy warnings.
Clippy: rust version 1.89.0-nightly (6f6971078 2025-05-28)
Number of Fixed Warnings: 36/36
It modernizes the coding style of the crate stdarch_examples (an example
"connect5") by fixing Clippy warnings (except clippy::manual_range_contains
in which "fixing" the warning will complicate the code).
Clippy: rust version 1.89.0-nightly (6f6971078 2025-05-28)
Number of Fixed Warnings: 6/6