use super::super::{X86Proof, x86, x86_proof};
pub(crate) fn expand(dst: &mut [u8], one_w: u64, src: &[u8], bits: usize, bytes: usize) -> bool {
match x86_proof() {
#[cfg(feature = "simd512")]
X86Proof::V4x(token)
if matches!(bytes, 1 | 2 | 4 | 8) && bits.saturating_mul(bytes) >= 64 =>
{
x86::gf1::expand_avx512(token, dst, one_w, src, bits, bytes);
true
}
#[cfg(feature = "simd512")]
X86Proof::V4x(token)
if matches!(bytes, 1 | 2 | 4 | 8) && bits.saturating_mul(bytes) >= 32 =>
{
x86::gf1::expand_avx2(token.v3(), dst, one_w, src, bits, bytes);
true
}
#[cfg(feature = "simd512")]
X86Proof::V4x(token)
if matches!(bytes, 1 | 2 | 4 | 8) && bits.saturating_mul(bytes) >= 16 =>
{
x86::gf1::expand_sse42(token.v3().v2(), dst, one_w, src, bits, bytes);
true
}
X86Proof::V3GfniCrypto(token)
if matches!(bytes, 1 | 2 | 4 | 8) && bits.saturating_mul(bytes) >= 32 =>
{
x86::gf1::expand_avx2(token.v3(), dst, one_w, src, bits, bytes);
true
}
X86Proof::V3(token)
if matches!(bytes, 1 | 2 | 4 | 8) && bits.saturating_mul(bytes) >= 32 =>
{
x86::gf1::expand_avx2(token, dst, one_w, src, bits, bytes);
true
}
X86Proof::V2(token)
if matches!(bytes, 1 | 2 | 4 | 8) && bits.saturating_mul(bytes) >= 16 =>
{
x86::gf1::expand_sse42(token, dst, one_w, src, bits, bytes);
true
}
_ => false,
}
}
pub(crate) fn compress(
dst: &mut [u8],
src: &[u8],
bits: usize,
bytes: usize,
test: &super::LaneTest,
) -> bool {
match x86_proof() {
#[cfg(feature = "simd512")]
X86Proof::V4x(token)
if matches!(bytes, 1 | 2 | 4 | 8) && bits.saturating_mul(bytes) >= 64 =>
{
x86::gf1::compress_avx512(token, dst, src, bits, bytes, test);
true
}
#[cfg(feature = "simd512")]
X86Proof::V4x(token)
if matches!(bytes, 1 | 2 | 4 | 8) && bits.saturating_mul(bytes) >= 32 =>
{
x86::gf1::compress_avx2(token.v3(), dst, src, bits, bytes, test);
true
}
#[cfg(feature = "simd512")]
X86Proof::V4x(token)
if matches!(bytes, 1 | 2 | 4 | 8) && bits.saturating_mul(bytes) >= 16 =>
{
x86::gf1::compress_sse42(token.v3().v2(), dst, src, bits, bytes, test);
true
}
X86Proof::V3GfniCrypto(token)
if matches!(bytes, 1 | 2 | 4 | 8) && bits.saturating_mul(bytes) >= 32 =>
{
x86::gf1::compress_avx2(token.v3(), dst, src, bits, bytes, test);
true
}
X86Proof::V3(token)
if matches!(bytes, 1 | 2 | 4 | 8) && bits.saturating_mul(bytes) >= 32 =>
{
x86::gf1::compress_avx2(token, dst, src, bits, bytes, test);
true
}
X86Proof::V2(token)
if matches!(bytes, 1 | 2 | 4 | 8) && bits.saturating_mul(bytes) >= 16 =>
{
x86::gf1::compress_sse42(token, dst, src, bits, bytes, test);
true
}
_ => false,
}
}
#[allow(clippy::too_many_arguments)]
pub(crate) fn restrict(
dst: &mut [u8],
valid: &mut [u8],
one_w: u64,
src: &[u8],
bits: usize,
bytes: usize,
) -> bool {
match x86_proof() {
#[cfg(feature = "simd512")]
X86Proof::V4x(token)
if matches!(bytes, 1 | 2 | 4 | 8) && bits.saturating_mul(bytes) >= 64 =>
{
x86::gf1::restrict_avx512(token, dst, valid, one_w, src, bits, bytes);
true
}
#[cfg(feature = "simd512")]
X86Proof::V4x(token)
if matches!(bytes, 1 | 2 | 4 | 8) && bits.saturating_mul(bytes) >= 32 =>
{
x86::gf1::restrict_avx2(token.v3(), dst, valid, one_w, src, bits, bytes);
true
}
#[cfg(feature = "simd512")]
X86Proof::V4x(token)
if matches!(bytes, 1 | 2 | 4 | 8) && bits.saturating_mul(bytes) >= 16 =>
{
x86::gf1::restrict_sse42(token.v3().v2(), dst, valid, one_w, src, bits, bytes);
true
}
X86Proof::V3GfniCrypto(token)
if matches!(bytes, 1 | 2 | 4 | 8) && bits.saturating_mul(bytes) >= 32 =>
{
x86::gf1::restrict_avx2(token.v3(), dst, valid, one_w, src, bits, bytes);
true
}
X86Proof::V3(token)
if matches!(bytes, 1 | 2 | 4 | 8) && bits.saturating_mul(bytes) >= 32 =>
{
x86::gf1::restrict_avx2(token, dst, valid, one_w, src, bits, bytes);
true
}
X86Proof::V2(token)
if matches!(bytes, 1 | 2 | 4 | 8) && bits.saturating_mul(bytes) >= 16 =>
{
x86::gf1::restrict_sse42(token, dst, valid, one_w, src, bits, bytes);
true
}
_ => false,
}
}