#cpuid #target-feature

no-std cpufeatures

Lightweight runtime CPU feature detection for x86/x86_64 and aarch64 with no_std support and support for mobile targets including Android and iOS

8 releases

new 0.2.6 Mar 25, 2023
0.2.5 Sep 4, 2022
0.2.4 Aug 22, 2022
0.2.2 Mar 18, 2022
0.1.5 Jun 22, 2021

#3 in Hardware support

Download history 710009/week @ 2022-12-08 688033/week @ 2022-12-15 447677/week @ 2022-12-22 489683/week @ 2022-12-29 722758/week @ 2023-01-05 741134/week @ 2023-01-12 776479/week @ 2023-01-19 848880/week @ 2023-01-26 818705/week @ 2023-02-02 829216/week @ 2023-02-09 823535/week @ 2023-02-16 936605/week @ 2023-02-23 868913/week @ 2023-03-02 944940/week @ 2023-03-09 933856/week @ 2023-03-16 995664/week @ 2023-03-23

3,913,113 downloads per month
Used in 12,633 crates (16 directly)

MIT/Apache

19KB
264 lines

RustCrypto: CPU Feature Detection

crate Docs Apache2/MIT licensed Rust Version Project Chat Build Status

Lightweight and efficient runtime CPU feature detection for aarch64 and x86/x86_64 targets.

Supports no_std as well as mobile targets including iOS and Android, providing an alternative to the std-dependent is_x86_feature_detected! macro.

Documentation

Supported architectures

Supported target architectures

*NOTE: target features with an asterisk are unstable (nightly-only) and subject to change to match upstream name changes in the Rust standard library.

aarch64

Linux, iOS, and macOS/ARM only (ARM64 does not support OS-independent feature detection)

Target features:

  • aes*
  • sha2*
  • sha3*

x86/x86_64

OS independent and no_std-friendly

Target features:

  • adx
  • aes
  • avx
  • avx2
  • avx512bw*
  • avx512cd*
  • avx512dq*
  • avx512er*
  • avx512f*
  • avx512ifma*
  • avx512pf*
  • avx512vl*
  • bmi1
  • bmi2
  • fma,
  • mmx
  • pclmulqdq
  • popcnt
  • rdrand
  • rdseed
  • sgx
  • sha
  • sse
  • sse2
  • sse3
  • sse4.1
  • sse4.2
  • ssse3

If you would like detection support for a target feature which is not on this list, please open a GitHub issue.

License

Licensed under either of:

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies