Line data Source code
1 : #ifndef HEADER_fd_src_util_simd_fd_avx512_h 2 : #error "Do not include this directly; use fd_avx512.h" 3 : #endif 4 : 5 : /* Vector ushort API **************************************************/ 6 : 7 : /* A wwh_t is a vector where each 16-bit wide lane holds an unsigned 8 : 16-bit integer (a "ushort"). 9 : 10 : These mirror the other APIs as much as possible. Macros are 11 : preferred over static inlines when it is possible to do it robustly 12 : to reduce the risk of the compiler mucking it up. */ 13 : 14 : #define wwh_t __m512i 15 : 16 : /* Predefined constants */ 17 : 18 : #define wwh_zero() _mm512_setzero_si512() /* wwh(0, 0, ... 0) */ 19 : #define wwh_one() _mm512_set1_epi32( 1 ) /* wwh(1, 1, ... 1) */ 20 : 21 : /* Memory operations */ 22 : /* Note: wwh_{ld,st} assume m is 64-byte aligned while wwh_{ldu,stu} 23 : allow m to have arbitrary alignment */ 24 : 25 0 : static inline wwh_t wwh_ld( ushort const * m ) { return _mm512_load_epi32( m ); } /* wwh( m[0], m[1], ... m[15] ) */ 26 6403232 : static inline void wwh_st( ushort * m, wwh_t x ) { _mm512_store_epi32( m, x ); } /* does m[0] = x0, m[1] = x1, ... m[15] = xf */ 27 : 28 0 : static inline wwh_t wwh_ldu( void const * m ) { return _mm512_loadu_epi32( m ); } /* wwh( m[0], m[1], ... m[15]) */ 29 0 : static inline void wwh_stu( void * m, wwh_t x ) { _mm512_storeu_epi32( m, x ); } /* does m[0] = x0, m[1] = x1, ... m[15] = xf */ 30 : 31 : /* Arithmetic operations */ 32 : 33 96048480 : #define wwh_add(x,y) _mm512_add_epi16( (x), (y) ) /* wwh( x0+y0, x1+y1, ... xf+y31 ) */ 34 : #define wwh_sub(x,y) _mm512_sub_epi16( (x), (y) ) /* wwh( x0-y0, x1-y1, ... xf-y31 ) */