aboutsummaryrefslogtreecommitdiffstats
path: root/src/vppinfra/vector_avx2.h
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2021-04-22 18:08:28 +0200
committerFlorin Coras <florin.coras@gmail.com>2021-04-27 23:40:27 +0000
commitef0bac70995bb225fea8955009b34d5b823285ba (patch)
treedd84620d04a63000a2f613d3cc06383d56a0255e /src/vppinfra/vector_avx2.h
parentd77d379ea6ac065becdf1b2e00351c77c7e1fe47 (diff)
vlib: improve enqueue_to_next buffer indices extraction
Type: improvement Change-Id: Ib7b2fa7d821f6d2708f6dc378a0f36f68c843f57 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vppinfra/vector_avx2.h')
-rw-r--r--src/vppinfra/vector_avx2.h21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/vppinfra/vector_avx2.h b/src/vppinfra/vector_avx2.h
index c24ed728c3c..584bd207b27 100644
--- a/src/vppinfra/vector_avx2.h
+++ b/src/vppinfra/vector_avx2.h
@@ -75,6 +75,10 @@ u32x8_permute (u32x8 v, u32x8 idx)
return (u32x8) _mm256_permutevar8x32_epi32 ((__m256i) v, (__m256i) idx);
}
+#define u64x4_permute(v, m0, m1, m2, m3) \
+ (u64x4) _mm256_permute4x64_epi64 ( \
+ (__m256i) v, ((m0) | (m1) << 2 | (m2) << 4 | (m3) << 6))
+
/* _extract_lo, _extract_hi */
/* *INDENT-OFF* */
#define _(t1,t2) \
@@ -101,8 +105,17 @@ _(u64x2, u64x4)
#undef _
/* *INDENT-ON* */
+always_inline u8x32
+u16x16_pack (u16x16 lo, u16x16 hi)
+{
+ return (u8x32) _mm256_packus_epi16 ((__m256i) lo, (__m256i) hi);
+}
-
+always_inline i8x32
+i16x16_pack (i16x16 lo, i16x16 hi)
+{
+ return (i8x32) _mm256_packs_epi16 ((__m256i) lo, (__m256i) hi);
+}
static_always_inline u32
u8x32_msb_mask (u8x32 v)
@@ -110,6 +123,12 @@ u8x32_msb_mask (u8x32 v)
return _mm256_movemask_epi8 ((__m256i) v);
}
+static_always_inline u32
+i8x32_msb_mask (i8x32 v)
+{
+ return _mm256_movemask_epi8 ((__m256i) v);
+}
+
/* _from_ */
/* *INDENT-OFF* */
#define _(f,t,i) \