| x86.rs |
This module implements minimal run-time feature detection for x86.
The features are detected using the `detect_features` function below.
This function uses the CPUID instruction to read the feature flags from the
CPU and encodes them in an `usize` where each bit position represents
whether a feature is available (bit is set) or unavaiable (bit is cleared).
The enum `Feature` is used to map bit positions to feature names, and the
the `__crate::detect::check_for!` macro is used to map string literals (e.g.,
"avx") to these bit positions (e.g., `Feature::avx`).
The run-time feature detection is performed by the
`__crate::detect::check_for(Feature) -> bool` function. On its first call,
this functions queries the CPU for the available features and stores them
in a global `AtomicUsize` variable. The query is performed by just checking
whether the feature bit in this global variable is set or cleared. |
7433 |
- |