X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvppinfra%2Fvector_sse42.h;h=06952f117dd99449bba9288c30d12e3b37d2561e;hb=e984831e079342865215d5511b535c8900095722;hp=c22e86e7437179893e3ad7a7d67ea667bfba6f2a;hpb=622b5ce61971066917cfba9ae795d9cb926f2700;p=vpp.git diff --git a/src/vppinfra/vector_sse42.h b/src/vppinfra/vector_sse42.h index c22e86e7437..06952f117dd 100644 --- a/src/vppinfra/vector_sse42.h +++ b/src/vppinfra/vector_sse42.h @@ -650,6 +650,14 @@ u32x4_hadd (u32x4 v1, u32x4 v2) return (u32x4) _mm_hadd_epi32 ((__m128i) v1, (__m128i) v2); } +static_always_inline u32 __clib_unused +u32x4_sum_elts (u32x4 sum4) +{ + sum4 += (u32x4) u8x16_align_right (sum4, sum4, 8); + sum4 += (u32x4) u8x16_align_right (sum4, sum4, 4); + return sum4[0]; +} + static_always_inline u8x16 u8x16_shuffle (u8x16 v, u8x16 m) { @@ -668,11 +676,11 @@ u32x4_shuffle (u32x4 v, const int a, const int b, const int c, const int d) #endif } -/* _extend_to_ */ +/* _from_ */ /* *INDENT-OFF* */ #define _(f,t,i) \ static_always_inline t \ -f##_extend_to_##t (f x) \ +t##_from_##f (f x) \ { return (t) _mm_cvt##i ((__m128i) x); } _(u8x16, u16x8, epu8_epi16) @@ -699,7 +707,7 @@ u64x2_gather (void *p0, void *p1) } static_always_inline u32x4 -u32x4_gather (void *p0, void *p1, void *p2, void *p3, void *p4) +u32x4_gather (void *p0, void *p1, void *p2, void *p3) { u32x4 r = { *(u32 *) p0, *(u32 *) p1, *(u32 *) p2, *(u32 *) p3 }; return r; @@ -746,6 +754,15 @@ u8x16_blend (u8x16 v1, u8x16 v2, u8x16 mask) return (u8x16) _mm_blendv_epi8 ((__m128i) v1, (__m128i) v2, (__m128i) mask); } +static_always_inline u8x16 +u8x16_xor3 (u8x16 a, u8x16 b, u8x16 c) +{ +#if __AVX512F__ + return (u8x16) _mm_ternarylogic_epi32 ((__m128i) a, (__m128i) b, + (__m128i) c, 0x96); +#endif + return a ^ b ^ c; +} #endif /* included_vector_sse2_h */