@@ -14,12 +14,18 @@ use packed_simd::{u64x4, IntoBits};
1414
1515use backend:: serial:: u64:: field:: FieldElement51 ;
1616
17- #[ allow( improper_ctypes) ]
18- extern "C" {
19- #[ link_name = "llvm.x86.avx512.vpmadd52l.uq.256" ]
20- fn madd52lo ( z : u64x4 , x : u64x4 , y : u64x4 ) -> u64x4 ;
21- #[ link_name = "llvm.x86.avx512.vpmadd52h.uq.256" ]
22- fn madd52hi ( z : u64x4 , x : u64x4 , y : u64x4 ) -> u64x4 ;
17+ /// A wrapper around `vpmadd52luq` that works on `u64x4`.
18+ #[ inline( always) ]
19+ unsafe fn madd52lo ( z : u64x4 , x : u64x4 , y : u64x4 ) -> u64x4 {
20+ use core:: arch:: x86_64:: _mm256_madd52lo_epu64;
21+ _mm256_madd52lo_epu64 ( z. into_bits ( ) , x. into_bits ( ) , y. into_bits ( ) ) . into_bits ( )
22+ }
23+
24+ /// A wrapper around `vpmadd52huq` that works on `u64x4`.
25+ #[ inline( always) ]
26+ unsafe fn madd52hi ( z : u64x4 , x : u64x4 , y : u64x4 ) -> u64x4 {
27+ use core:: arch:: x86_64:: _mm256_madd52hi_epu64;
28+ _mm256_madd52hi_epu64 ( z. into_bits ( ) , x. into_bits ( ) , y. into_bits ( ) ) . into_bits ( )
2329}
2430
2531/// A vector of four field elements in radix 2^51, with unreduced coefficients.
@@ -203,11 +209,7 @@ use subtle::ConditionallySelectable;
203209
204210impl ConditionallySelectable for F51x4Reduced {
205211 #[ inline]
206- fn conditional_select (
207- a : & F51x4Reduced ,
208- b : & F51x4Reduced ,
209- choice : Choice ,
210- ) -> F51x4Reduced {
212+ fn conditional_select ( a : & F51x4Reduced , b : & F51x4Reduced , choice : Choice ) -> F51x4Reduced {
211213 let mask = ( -( choice. unwrap_u8 ( ) as i64 ) ) as u64 ;
212214 let mask_vec = u64x4:: splat ( mask) ;
213215 F51x4Reduced ( [
0 commit comments