summaryrefslogtreecommitdiffstats
path: root/src/vppinfra/vector_avx512.h
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2020-07-15 20:18:39 +0200
committerDamjan Marion <damarion@cisco.com>2020-07-15 20:26:42 +0200
commit94dbf952204e811c5ec7a39600c25f7b40387f45 (patch)
treeafc3b85a7e9ac94e05f4290f49ac2c93db207d30 /src/vppinfra/vector_avx512.h
parent4d119a6f15333e107bd9766112410eaf4ce1a57f (diff)
vppinfra: more vector inlines
Type: improvement Change-Id: Ie0de374b89ec3a17befecf3f08e94951597609ec Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vppinfra/vector_avx512.h')
-rw-r--r--src/vppinfra/vector_avx512.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/vppinfra/vector_avx512.h b/src/vppinfra/vector_avx512.h
index 8a82650e1e8..6eb7c5eaa4d 100644
--- a/src/vppinfra/vector_avx512.h
+++ b/src/vppinfra/vector_avx512.h
@@ -192,6 +192,25 @@ u8x64_reflect_u8x16 (u8x64 x)
}
static_always_inline u8x64
+u8x64_shuffle (u8x64 v, u8x64 m)
+{
+ return (u8x64) _mm512_shuffle_epi8 ((__m512i) v, (__m512i) m);
+}
+
+#define u8x64_align_right(a, b, imm) \
+ (u8x64) _mm512_alignr_epi8 ((__m512i) a, (__m512i) b, imm)
+
+static_always_inline u32
+u32x16_sum_elts (u32x16 sum16)
+{
+ u32x8 sum8;
+ sum16 += (u32x16) u8x64_align_right (sum16, sum16, 8);
+ sum16 += (u32x16) u8x64_align_right (sum16, sum16, 4);
+ sum8 = u32x16_extract_hi (sum16) + u32x16_extract_lo (sum16);
+ return sum8[0] + sum8[4];
+}
+
+static_always_inline u8x64
u8x64_mask_load (u8x64 a, void *p, u64 mask)
{
return (u8x64) _mm512_mask_loadu_epi8 ((__m512i) a, mask, p);