summaryrefslogtreecommitdiffstats
path: root/src/vppinfra/vector_avx2.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/vppinfra/vector_avx2.h')
-rw-r--r--src/vppinfra/vector_avx2.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/vppinfra/vector_avx2.h b/src/vppinfra/vector_avx2.h
index 8cc1d77d63c..0511ec7e4e2 100644
--- a/src/vppinfra/vector_avx2.h
+++ b/src/vppinfra/vector_avx2.h
@@ -162,6 +162,23 @@ u16x16_byte_swap (u16x16 v)
return (u16x16) _mm256_shuffle_epi8 ((__m256i) v, (__m256i) swap);
}
+static_always_inline u8x32
+u8x32_shuffle (u8x32 v, u8x32 m)
+{
+ return (u8x32) _mm256_shuffle_epi8 ((__m256i) v, (__m256i) m);
+}
+
+#define u8x32_align_right(a, b, imm) \
+ (u8x32) _mm256_alignr_epi8 ((__m256i) a, (__m256i) b, imm)
+
+static_always_inline u32
+u32x8_sum_elts (u32x8 sum8)
+{
+ sum8 += (u32x8) u8x32_align_right (sum8, sum8, 8);
+ sum8 += (u32x8) u8x32_align_right (sum8, sum8, 4);
+ return sum8[0] + sum8[4];
+}
+
static_always_inline u32x8
u32x8_hadd (u32x8 v1, u32x8 v2)
{
@@ -196,6 +213,14 @@ u16x16_mask_last (u16x16 v, u8 n_last)
return v & masks[16 - n_last];
}
+#ifdef __AVX512F__
+static_always_inline u8x32
+u8x32_mask_load (u8x32 a, void *p, u32 mask)
+{
+ return (u8x32) _mm256_mask_loadu_epi8 ((__m256i) a, mask, p);
+}
+#endif
+
static_always_inline f32x8
f32x8_from_u32x8 (u32x8 v)
{