#[non_exhaustive]#[repr(u8)]pub enum Backend {
Scalar = 0,
Neon = 1,
Sse41 = 2,
Avx2 = 3,
Avx512 = 4,
Wasm128 = 5,
Avx2x12 = 6,
}Expand description
Which bcrypt_lanes implementation to use.
A variant is added every time another ISA is ported, so this is
#[non_exhaustive] — write a _ arm downstream. Backend::ALL is a
slice for the same reason: its length must not be part of the API.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Scalar = 0
Portable scalar code, one lane. Always available.
Neon = 1
AArch64 NEON, 8 lanes.
Sse41 = 2
x86 / x86-64 SSE4.1 (pinsrd/pextrd for lane construction), 4 lanes.
Avx2 = 3
x86-64 AVX2, 8 lanes. Two internal flavours (hardware gather vs load+insert); a one-time shootout picks per CPU — AMD Zen gathers are microcoded and lose.
Avx512 = 4
x86-64 AVX-512F, 16 lanes. Same flavour shootout as AVX2.
Wasm128 = 5
wasm32 fixed-width SIMD128, 8 lanes as two interleaved 4-lane
v128 states (X2). Compile-time selected.
Avx2x12 = 6
x86-64 AVX2, 12 lanes as one 8-lane ymm group plus one 4-lane xmm group in lockstep (48 KiB SoA working set, insert/extract lookup flavours only — no gather). Never in the static fallback order: reachable only through the measured width shootout on hosts whose L1d is at least 48 KiB (Zen 5, Ice Lake+), or by explicit force.
Implementations§
Source§impl Backend
impl Backend
Sourcepub const fn name(self) -> &'static str
pub const fn name(self) -> &'static str
Short lowercase name, handy for bench ids and test output.
Sourcepub const fn lanes(self) -> usize
pub const fn lanes(self) -> usize
Passwords hashed per kernel call — the vector width in 32-bit lanes.
Sourcepub fn is_available(self) -> bool
pub fn is_available(self) -> bool
Whether this CPU can execute this backend right now.
Unlike detect, this asks about one specific backend, so tests and
benches can loop over Backend::ALL and skip what the host cannot run.