aboutsummaryrefslogtreecommitdiffstats
path: root/src/vppinfra
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2018-05-17 12:44:00 +0200
committerDave Barach <openvpp@barachs.net>2018-05-17 19:17:05 +0000
commitafe56de947822bb981bd30242f4e3c2c469f9ecc (patch)
tree2d4792318b31d6ffbe62b3d5957eff45f0bcb47c /src/vppinfra
parented984e0b3ba8480123b0406926337b1045407f75 (diff)
Add buffer pointer-to-index and index-to-pointer array functions
Change-Id: Ib3fcc3ceb7f315389bcdecbb7d9632540a5dd6ba Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vppinfra')
-rw-r--r--src/vppinfra/vector_avx2.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/vppinfra/vector_avx2.h b/src/vppinfra/vector_avx2.h
index 9c1ce4700c5..f651392559b 100644
--- a/src/vppinfra/vector_avx2.h
+++ b/src/vppinfra/vector_avx2.h
@@ -81,6 +81,28 @@ u32x8_insert_hi (u32x8 v1, u32x4 v2)
return (u32x8) _mm256_inserti128_si256 ((__m256i) v1, (__m128i) v2, 1);
}
+/* _extend_to_ */
+/* *INDENT-OFF* */
+#define _(f,t,i) \
+static_always_inline t \
+f##_extend_to_##t (f x) \
+{ return (t) _mm256_cvt##i ((__m128i) x); }
+
+_(u16x8, u32x8, epu16_epi32)
+_(u16x8, u64x4, epu16_epi64)
+_(u32x4, u64x4, epu32_epi64)
+_(u8x16, u16x16, epu8_epi64)
+_(u8x16, u32x8, epu8_epi32)
+_(u8x16, u64x4, epu8_epi64)
+_(i16x8, i32x8, epi16_epi32)
+_(i16x8, i64x4, epi16_epi64)
+_(i32x4, i64x4, epi32_epi64)
+_(i8x16, i16x16, epi8_epi64)
+_(i8x16, i32x8, epi8_epi32)
+_(i8x16, i64x4, epi8_epi64)
+#undef _
+/* *INDENT-ON* */
+
#endif /* included_vector_avx2_h */
/*