summaryrefslogtreecommitdiffstats
path: root/src/vppinfra
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2018-07-16 14:18:23 +0200
committerFlorin Coras <florin.coras@gmail.com>2018-07-16 14:55:07 +0000
commit4fce7f73e7585c070dde50e18f64ac91d9314f63 (patch)
tree219ab44372204ddb3f2d5d9cbe5796f234c848e4 /src/vppinfra
parentcd2fc207cfd052de2b57fe0bb32d6376829c0324 (diff)
vppinfra: AVX2 interleave functions
Change-Id: I8688f700fccd87484da3e202ca3a070cc14eb267 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vppinfra')
-rw-r--r--src/vppinfra/vector_avx2.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/vppinfra/vector_avx2.h b/src/vppinfra/vector_avx2.h
index 66c46f226aa..04b312be9fa 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 _