binius_field/arch/x86_64/packed_ghash_sq_256.rs
1// Copyright 2026 The Binius Developers
2
3//! x86_64 strategy selection for the `PackedGhashSq1x256b` packing.
4
5/// Widening-multiply wrapper used by the `PackedGhashSq1x256b` packing: batch the Karatsuba
6/// diagonal into a single 256-bit carry-less multiply when VPCLMULQDQ is available, otherwise the
7/// sliced Karatsuba multiply, which trades that batching for one fewer GHASH reduction.
8///
9/// AVX2 is part of the condition because without it `PackedBinaryGhash2x128b` is backed by the
10/// scaled `M256`, whose widening multiply is two independent 128-bit multiplies — exactly what the
11/// batching is meant to avoid.
12#[cfg(all(target_feature = "vpclmulqdq", target_feature = "avx2"))]
13pub type GhashSqWideMul1x<T> = super::arithmetic::ghash_sq::GhashSqHybridWideMul<T>;
14#[cfg(not(all(target_feature = "vpclmulqdq", target_feature = "avx2")))]
15pub type GhashSqWideMul1x<T> = crate::arch::portable::arithmetic::ghash_sq::GhashSqSlicedWideMul<T>;