mod elementwise;
mod gather;
mod matrix;
mod scatter;
mod single;
pub use elementwise::{mul_elementwise_assign_avx512, mul_elementwise_avx512};
#[cfg(test)]
pub(crate) use gather::GATHER_PEEL_MIN;
pub use gather::mul_add_gather_avx512;
#[cfg(test)]
pub(crate) use matrix::MATRIX_PEEL_MIN;
pub use matrix::{
mul_add_matrix_at_avx512_with, mul_add_matrix_avx512_with, mul_into_matrix_avx512_with,
};
#[cfg(test)]
pub(crate) use scatter::SCATTER_PEEL_MIN;
pub use scatter::mul_add_scatter_avx512;
pub use single::{mul_add_avx512, mul_assign_avx512, mul_into_avx512};
use super::PeelBody;
use crate::kernel::gf8::Prepared;
#[cfg(target_arch = "x86")]
use core::arch::x86::*;
#[cfg(target_arch = "x86_64")]
use core::arch::x86_64::*;
#[inline]
#[archmage::rite(v4x, import_intrinsics)]
pub(super) fn bfactor_avx512(map: u64) -> __m512i {
_mm512_set1_epi64(map.cast_signed())
}
#[inline]
#[archmage::rite(v4x, import_intrinsics)]
pub(super) fn bmul_avx512(x: __m512i, factor: __m512i) -> __m512i {
_mm512_gf2p8affine_epi64_epi8::<0>(x, factor)
}
#[archmage::rite(v4x, import_intrinsics)]
pub(super) fn brem_avx512(dst: &mut [u8], coeff: Prepared, src: &[u8]) {
single::mul_add_avx512_impl::<PeelBody>(dst, coeff, src);
}
#[inline]
#[archmage::rite(v4x, import_intrinsics)]
pub(super) fn brem_half_avx512(dst: &mut [u8], coeff: Prepared, src: &[u8]) {
super::gfni::mul_add_gfni_impl::<false, PeelBody>(dst, coeff, src);
}
#[inline]
pub(super) fn peel_avx512(ptr: *const u8, len: usize) -> usize {
let head = ptr.align_offset(64);
if head == usize::MAX || head >= len {
0
} else {
head
}
}