rust/library/stdarch
Tsukasa OI db188b33b3 RISC-V: OS-independent implication logic
This commit adds the OS-independent extension implication logic for RISC-V.
It implements:

1.  Regular implication (A → B)
    a.  "the extension A implies the extension B"
    b.  "the extension A requires the extension B"
    c.  "the extension A depends on the extension B"
2.  Extension group or shorthand (A == B1 & B2...)
    a.  "the extension A is shorthand for other extensions: B1, B2..."
    b.  "the extension A comprises instructions provided by B1, B2..."
    This is implemented as (A → B1 & B2... + B1 & B2... → A)
    where the former is a regular implication as required by specifications
    and the latter is a "reverse" implication to improve usability.

and prepares for:

3.  Implication with multiple requirements (A1 & A2... → B)
    a.  "A1 + A2 implies B"
    b.  (implicitly used to implement reverse implication of case 2)

Although it uses macros and iterators, good optimizers turn the series of
implications into fast bit-manipulation operations.

In the case 2 (extension group or shorthand; where a superset extension
is just a collection of other subextensions and provides no features by
a superset itself), specifications do specify that an extension group
implies its members but not vice versa.  However, implying an extension
group from its members would improve usability on the feature detection
(especially when the feature provider does not provide existence of such
extension group but provides existence of its members).

Similar "reverse implication" on RISC-V is implemented on LLVM.

Case 3 is implicitly used to implement reverse implication of case 2 but
there's another use case: implication with multiple requirements like
"Zcf" and "Zcd" extensions (not yet implemented in this crate for now).

To handle extension groups perfectly, we need to loop implication several
times (until they converge; normally 2 times and up to 4 times when we add
most of `riscv_hwprobe`-based features).
To make implementation of that loop possible, `cache::Initializer` is
modified to implement `PartialEq` and `Eq`.
2025-04-16 00:56:48 +00:00
..
.github/workflows Add PowerPC (32-bit) to CI 2024-12-21 10:12:32 +00:00
ci hmm 2025-04-11 11:30:32 +00:00
crates RISC-V: OS-independent implication logic 2025-04-16 00:56:48 +00:00
examples Remove some allow(unsafe_op_in_unsafe_fn)s and use target_feature 1.1 in examples 2025-02-25 01:11:47 +00:00
intrinsics_data feat - FEAT_LUT neon instrinsics 2025-03-05 14:54:05 +00:00
.cirrus.yml Update CI to FreeBSD 13.4 2025-02-14 16:40:26 +00:00
.git-blame-ignore-revs Add .git-blame-ignore-revs 2025-02-09 12:57:14 -08:00
.gitignore Add intrinsic code generator for LoongArch 2024-02-28 08:43:52 +00:00
.gitmodules Remove ACLE submodule 2023-05-15 17:34:11 +02:00
Cargo.toml PR feedback & pipeline 2025-01-16 14:29:19 +00:00
CONTRIBUTING.md Recommend using run-docker.sh instead of run.sh in CONTRIBUTING.md 2024-11-27 09:30:19 +08:00
LICENSE-APACHE Add license files 2017-09-25 12:43:06 -07:00
LICENSE-MIT Add license files 2017-09-25 12:43:06 -07:00
README.md Use SPDX license format and update packed_simd crate link (#1297) 2022-03-17 10:55:51 +00:00
rustfmt.toml Update the intrinsic checker tool (#1258) 2021-12-04 13:03:30 +00:00
triagebot.toml Enable feature detection on all Apple/Darwin targets 2024-09-14 04:25:01 +01:00
vendor.yml Add SVE support to stdarch-verify 2025-01-16 14:29:19 +00:00

stdarch - Rust's standard library SIMD components

Actions Status

Crates

This repository contains two main crates:

  • core_arch implements core::arch - Rust's core library architecture-specific intrinsics, and

  • std_detect implements std::detect - Rust's standard library run-time CPU feature detection.

The std::simd component now lives in the packed_simd_2 crate.