summaryrefslogtreecommitdiffstats
path: root/src/vppinfra/vector_avx512.h
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2019-04-17 16:05:54 +0200
committerDamjan Marion <dmarion@me.com>2019-04-17 15:49:02 +0000
commit2cd8ad4b680c22e93cf04c036545cf74bafd51d2 (patch)
tree47d0bca0e84fc57999514d5599a79bf8a02c1486 /src/vppinfra/vector_avx512.h
parente4ac48e792f4eebfce296cfde844ee73b1abd62f (diff)
vppinfra: AVX512 interelaave, insert and permute
Change-Id: I26c704ec27b8f5431faef08156778f53ea454269 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vppinfra/vector_avx512.h')
-rw-r--r--src/vppinfra/vector_avx512.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/vppinfra/vector_avx512.h b/src/vppinfra/vector_avx512.h
index 6fd27a3c56b..c54d8cd2499 100644
--- a/src/vppinfra/vector_avx512.h
+++ b/src/vppinfra/vector_avx512.h
@@ -57,6 +57,14 @@ t##s##x##c##_is_all_equal (t##s##x##c v, t##s 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); } \
+\
+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) _mm512_unpacklo_##i ((__m512i) a, (__m512i) 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) _mm512_unpackhi_##i ((__m512i) a, (__m512i) b); } \
foreach_avx512_vec512i foreach_avx512_vec512u
@@ -112,6 +120,25 @@ u32x16_min_scalar (u32x16 v)
u32x16_extract_hi (v)));
}
+static_always_inline u32x16
+u32x16_insert_lo (u32x16 r, u32x8 v)
+{
+ return (u32x16) _mm512_inserti64x4 ((__m512i) r, (__m256i) v, 0);
+}
+
+static_always_inline u32x16
+u32x16_insert_hi (u32x16 r, u32x8 v)
+{
+ return (u32x16) _mm512_inserti64x4 ((__m512i) r, (__m256i) v, 1);
+}
+
+static_always_inline u64x8
+u64x8_permute (u64x8 a, u64x8 b, u64x8 mask)
+{
+ return (u64x8) _mm512_permutex2var_epi64 ((__m512i) a, (__m512i) mask,
+ (__m512i) b);
+}
+
#define u32x16_ternary_logic(a, b, c, d) \
(u32x16) _mm512_ternarylogic_epi32 ((__m512i) a, (__m512i) b, (__m512i) c, d)