Re-enable aarch64 neon instruction in vlib_buffer_free_inline
[vpp.git] / src / vppinfra / vector_neon.h
index aef8365..9045160 100644 (file)
 #define i16x8_sub_saturate(a,b) vsubq_s16(a,b)
 /* Dummy. Aid making uniform macros */
 #define vreinterpretq_u8_u8(a)  a
+/* Implement the missing intrinsics to make uniform macros */
+#define vminvq_u64(x)   \
+({  \
+  u64 x0 = vgetq_lane_u64(x, 0);    \
+  u64 x1 = vgetq_lane_u64(x, 1);    \
+  x0 < x1 ? x0 : x1;    \
+})
 
 /* Converts all ones/zeros compare mask to bitmap. */
 always_inline u32
@@ -62,11 +69,11 @@ t##s##x##c##_store_unaligned (t##s##x##c v, void *p)                        \
 \
 static_always_inline int                                               \
 t##s##x##c##_is_all_zero (t##s##x##c x)                                        \
-{ return !(vaddvq_##i (x)); }                                          \
+{ return !!(vminvq_u##s (vceqq_##i (vdupq_n_##i(0), x))); }                                            \
 \
 static_always_inline int                                               \
 t##s##x##c##_is_equal (t##s##x##c a, t##s##x##c b)                     \
-{ return t##s##x##c##_is_all_zero (a ^ b); }                           \
+{ return !!(vminvq_u##s (vceqq_##i (a, b))); }                         \
 \
 static_always_inline int                                               \
 t##s##x##c##_is_all_equal (t##s##x##c v, t##s x)                       \