X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvppinfra%2Fvector_avx2.h;h=bd27db11ef9fa8b5ff5c6dfc607e36fdd07ed592;hb=232b2d55807cfdb89bbad6fc985bd2d94bb2f22a;hp=a95ee5e2b7d880ae5a38d7ea4aa96b37635c53ae;hpb=779c865cc6c7af5bb435d8b3465d80685370edb2;p=vpp.git diff --git a/src/vppinfra/vector_avx2.h b/src/vppinfra/vector_avx2.h index a95ee5e2b7d..bd27db11ef9 100644 --- a/src/vppinfra/vector_avx2.h +++ b/src/vppinfra/vector_avx2.h @@ -21,12 +21,14 @@ /* *INDENT-OFF* */ #define foreach_avx2_vec256i \ - _(i,8,32,epi8) _(i,16,16,epi16) _(i,32,8,epi32) _(i,64,4,epi64x) + _(i,8,32,epi8) _(i,16,16,epi16) _(i,32,8,epi32) _(i,64,4,epi64) #define foreach_avx2_vec256u \ - _(u,8,32,epi8) _(u,16,16,epi16) _(u,32,8,epi32) _(u,64,4,epi64x) + _(u,8,32,epi8) _(u,16,16,epi16) _(u,32,8,epi32) _(u,64,4,epi64) #define foreach_avx2_vec256f \ _(f,32,8,ps) _(f,64,4,pd) +#define _mm256_set1_epi64 _mm256_set1_epi64x + /* splat, load_unaligned, store_unaligned, is_all_zero, is_equal, is_all_equal */ #define _(t, s, c, i) \ @@ -52,7 +54,16 @@ t##s##x##c##_is_equal (t##s##x##c a, t##s##x##c 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)); }; \ +{ return t##s##x##c##_is_equal (v, t##s##x##c##_splat (x)); } \ +\ +static_always_inline t##s##x##c \ +t##s##x##c##_interleave_lo (t##s##x##c a, t##s##x##c b) \ +{ return (t##s##x##c) _mm256_unpacklo_##i ((__m256i) a, (__m256i) b); } \ +\ +static_always_inline t##s##x##c \ +t##s##x##c##_interleave_hi (t##s##x##c a, t##s##x##c b) \ +{ return (t##s##x##c) _mm256_unpackhi_##i ((__m256i) a, (__m256i) b); } \ + foreach_avx2_vec256i foreach_avx2_vec256u #undef _ @@ -165,10 +176,16 @@ u16x16_mask_last (u16x16 v, u8 n_last) return v & masks[16 - n_last]; } +static_always_inline f32x8 +f32x8_from_u32x8 (u32x8 v) +{ + return (f32x8) _mm256_cvtepi32_ps ((__m256i) v); +} + static_always_inline u32x8 -u32x8_blend (u32x8 v0, u32x8 v1, u8 opt) +u32x8_from_f32x8 (f32x8 v) { - return (u32x8) _mm256_blend_epi32 ((__m256i) v0, (__m256i) v1, opt); + return (u32x8) _mm256_cvttps_epi32 ((__m256) v); } #endif /* included_vector_avx2_h */