1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
//! Runtime CPU feature detection.
//!
//! Uses [`cpufeatures`] for `no_std`-compatible, cached detection of:
//! - x86_64 AVX2 (used by [`crate::sm4::sbox_x8`] / [`crate::sm4::sbox_x32`]).
//! - x86_64 PCLMULQDQ (v0.8 W1; used by `crate::ghash::ghash_mul_clmul`).
//! - aarch64 AES extension a.k.a. PMULL64 (v0.8 W1; used by
//! `crate::ghash::ghash_mul_pmull`).
//!
//! On targets that don't support a feature, the corresponding getter
//! returns a compile-time `false` constant (the `cpufeatures::new!`
//! macro is a no-op on unsupported architectures).
//!
//! Detection is cached after the first call via an internal
//! `Once`-protected static; the per-call cost is one atomic load
//! plus one branch.
new!;
new!;
new!;
/// Returns `true` if the host CPU supports AVX2 and the running
/// translation unit may dispatch into AVX2 intrinsics.
///
/// On non-`x86_64` targets this is always `false` (and the
/// AVX2 path is `cfg`-gated out entirely).
/// Returns `true` if the host CPU supports the PCLMULQDQ carryless-
/// multiply instruction (Intel Westmere+ / AMD Bulldozer+, 2010+).
///
/// On non-`x86_64` targets this is always `false`.
/// Returns `true` if the host aarch64 CPU supports the ARMv8.0 Crypto
/// Extensions PMULL64 instruction (`vmull_p64`).
///
/// The Rust target-feature name for this is `"aes"` (a single feature
/// flag gates AES, PMULL, PMULL2, and PMULL128 on aarch64 per the
/// ARMv8.0 architecture spec). Present on all Apple Silicon and most
/// modern aarch64 server / mobile chips.
///
/// On non-`aarch64` targets this is always `false`.