summaryrefslogtreecommitdiffstats
path: root/src/vppinfra/vector_neon.h
diff options
context:
space:
mode:
authorAdrian Oanca <adrian.oanca@enea.com>2018-02-20 17:14:58 +0100
committerDamjan Marion <dmarion.lists@gmail.com>2018-02-21 10:43:06 +0000
commit2b53e4e525472f12ddb9bbe4ae0f6668fbe4e2cd (patch)
tree52f157960de17f0f65b2337af333e2899dd745e7 /src/vppinfra/vector_neon.h
parent76447a740a6989db08dcd0fcbd066b193a875177 (diff)
add 'is_all_zero(x)' for NEON
Change-Id: I5045e0f3ac4698e820b69ad46b96763e404e6fe4 Signed-off-by: Adrian Oanca <adrian.oanca@enea.com>
Diffstat (limited to 'src/vppinfra/vector_neon.h')
-rw-r--r--src/vppinfra/vector_neon.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/vppinfra/vector_neon.h b/src/vppinfra/vector_neon.h
index 6a3e64e946d..6ca9c0b90a0 100644
--- a/src/vppinfra/vector_neon.h
+++ b/src/vppinfra/vector_neon.h
@@ -21,6 +21,30 @@
#define u16x8_sub_saturate(a,b) vsubq_u16(a,b)
#define i16x8_sub_saturate(a,b) vsubq_s16(a,b)
+always_inline int
+u8x16_is_all_zero (u8x16 x)
+{
+ return !(vaddvq_u8 (x));
+}
+
+always_inline int
+u16x8_is_all_zero (u16x8 x)
+{
+ return !(vaddvq_u16 (x));
+}
+
+always_inline int
+u32x4_is_all_zero (u32x4 x)
+{
+ return !(vaddvq_u32 (x));
+}
+
+always_inline int
+u64x2_is_all_zero (u64x2 x)
+{
+ return !(vaddvq_u64 (x));
+}
+
/* Converts all ones/zeros compare mask to bitmap. */
always_inline u32
u8x16_compare_byte_mask (u8x16 x)