X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvppinfra%2Fvector_avx512.h;h=f69c67e697cd42ff091d42e46f92bf8e807ac708;hb=9e829a856fdf88b3ea5770048ea20dcd50d1b4eb;hp=c1b7c42a2608a695eb8643ec6be0c18403c0c197;hpb=8c3f8a29374deed5a67a5fd084f186413f6183d7;p=vpp.git diff --git a/src/vppinfra/vector_avx512.h b/src/vppinfra/vector_avx512.h index c1b7c42a260..f69c67e697c 100644 --- a/src/vppinfra/vector_avx512.h +++ b/src/vppinfra/vector_avx512.h @@ -19,6 +19,7 @@ #include #include +/* *INDENT-OFF* */ #define foreach_avx512_vec512i \ _(i,8,64,epi8) _(i,16,32,epi16) _(i,32,16,epi32) _(i,64,8,epi64) #define foreach_avx512_vec512u \ @@ -26,8 +27,8 @@ #define foreach_avx512_vec512f \ _(f,32,8,ps) _(f,64,4,pd) -/* splat, load_unaligned, store_unaligned */ -/* *INDENT-OFF* */ +/* splat, load_unaligned, store_unaligned, is_all_zero, is_equal, + is_all_equal, is_zero_mask */ #define _(t, s, c, i) \ static_always_inline t##s##x##c \ t##s##x##c##_splat (t##s x) \ @@ -41,6 +42,22 @@ static_always_inline void \ t##s##x##c##_store_unaligned (t##s##x##c v, void *p) \ { _mm512_storeu_si512 ((__m512i *) p, (__m512i) v); } \ \ +static_always_inline int \ +t##s##x##c##_is_all_zero (t##s##x##c v) \ +{ return (_mm512_test_epi64_mask ((__m512i) v, (__m512i) v) == 0); } \ +\ +static_always_inline int \ +t##s##x##c##_is_equal (t##s##x##c a, t##s##x##c b) \ +{ return t##s##x##c##_is_all_zero (a ^ b); } \ +\ +static_always_inline int \ +t##s##x##c##_is_all_equal (t##s##x##c v, t##s x) \ +{ return t##s##x##c##_is_equal (v, t##s##x##c##_splat (x)); } \ +\ +static_always_inline u##c \ +t##s##x##c##_is_zero_mask (t##s##x##c v) \ +{ return _mm512_test_##i##_mask ((__m512i) v, (__m512i) v); } \ + foreach_avx512_vec512i foreach_avx512_vec512u #undef _