@@ -37,14 +37,15 @@ impl Simd256 {
3737 }
3838
3939 #[ inline]
40- #[ target_feature( enable = "avx2" , enable = "vpclmulqdq" ) ]
41- unsafe fn fold_32 ( & self , coeff : & Self ) -> Self {
42- let result = _mm256_xor_si256 (
40+ #[ target_feature( enable = "avx2,avx512f,avx512vl,vpclmulqdq" ) ]
41+ unsafe fn fold_32 ( & self , coeff : & Self , new_data : & Self ) -> Self {
42+ // XOR3
43+ Self ( _mm256_ternarylogic_epi64 (
4344 _mm256_clmulepi64_epi128 ( self . 0 , coeff. 0 , 0x00 ) ,
4445 _mm256_clmulepi64_epi128 ( self . 0 , coeff. 0 , 0x11 ) ,
45- ) ;
46-
47- Self ( result )
46+ new_data . 0 ,
47+ 0x96 ,
48+ ) )
4849 }
4950
5051 #[ inline]
@@ -118,7 +119,7 @@ impl Simd256 {
118119impl VpclmulqdqOps {
119120 /// Process aligned blocks using VPCLMULQDQ
120121 #[ inline]
121- #[ target_feature( enable = "avx2,vpclmulqdq,sse2,sse4.1,pclmulqdq" ) ]
122+ #[ target_feature( enable = "avx2,vpclmulqdq,sse2,sse4.1,pclmulqdq,avx512f,avx512vl " ) ]
122123 unsafe fn process_vpclmulqdq_blocks < W : EnhancedCrcWidth > (
123124 & self ,
124125 state : & mut CrcState < <VpclmulqdqOps as ArchOps >:: Vector > ,
@@ -165,7 +166,7 @@ impl VpclmulqdqOps {
165166 Simd256 :: from_m128i_pair ( block[ i * 2 + 1 ] , block[ i * 2 ] ) ,
166167 ) ;
167168
168- * chunk = chunk. fold_32 ( & coeff) . xor ( & reflected_chunk) ;
169+ * chunk = chunk. fold_32 ( & coeff, & reflected_chunk) ;
169170 }
170171 }
171172
@@ -325,7 +326,7 @@ impl ArchOps for VpclmulqdqOps {
325326 type Vector = __m128i ;
326327
327328 #[ inline]
328- #[ target_feature( enable = "avx2,vpclmulqdq,sse2,sse4.1,pclmulqdq" ) ]
329+ #[ target_feature( enable = "avx2,vpclmulqdq,sse2,sse4.1,pclmulqdq,avx512f,avx512vl " ) ]
329330 unsafe fn process_enhanced_simd_blocks < W : EnhancedCrcWidth > (
330331 & self ,
331332 state : & mut CrcState < Self :: Vector > ,
@@ -535,4 +536,15 @@ impl ArchOps for VpclmulqdqOps {
535536 unsafe fn carryless_mul_11 ( & self , a : Self :: Vector , b : Self :: Vector ) -> Self :: Vector {
536537 self . 0 . carryless_mul_11 ( a, b)
537538 }
539+
540+ #[ inline]
541+ #[ target_feature( enable = "avx2,vpclmulqdq,avx512f,avx512vl" ) ]
542+ unsafe fn xor3_vectors (
543+ & self ,
544+ a : Self :: Vector ,
545+ b : Self :: Vector ,
546+ c : Self :: Vector ,
547+ ) -> Self :: Vector {
548+ self . 0 . xor3_vectors ( a, b, c)
549+ }
538550}
0 commit comments