Available on x86-64 or x86 or AArch64 only.
Expand description
Optimized feature detection macros.
These macros combine compile-time and runtime feature detection, avoiding redundant runtime checks when features are compile-time known.
§Important Limitation
cfg!(target_feature) is evaluated at crate level, not function level.
This means the compile-time optimization does NOT work inside functions
marked with #[target_feature(enable = "...")] unless the feature is
also enabled globally via -C target-feature or -C target-cpu.
For eliminating checks inside multiversioned functions, use tokens instead - they provide type-level proof that a feature is available.
Functions§
- check_
avx2_ available x86-64 - Helper function for verifying assembly output. When compiled with +avx2, this should contain no cpuid or function calls.
- check_
avx512f_ available x86-64 - Helper function for verifying assembly output. When compiled with +avx512f, this should contain no cpuid or function calls.
- check_
fma_ available x86-64 - Helper function for verifying assembly output. When compiled with +fma, this should contain no cpuid or function calls.