Enable NEON instructions in memcpy_le 35/19135/3
authorLijian.Zhang <Lijian.Zhang@arm.com>
Thu, 4 Apr 2019 07:26:26 +0000 (15:26 +0800)
committerDamjan Marion <dmarion@me.com>
Wed, 1 May 2019 07:44:55 +0000 (07:44 +0000)
Neon version of memcpy_le gives better performance compared with memmove on aarch64

Change-Id: I44b487bb0795a6e70dd1e55bdde4a077773ec859
Signed-off-by: Lijian Zhang <Lijian.Zhang@arm.com>
Reviewed-by: Sirshak Das <sirdas@arm.com>
src/vppinfra/string.h
src/vppinfra/vector_neon.h

index 49848e9..d64df8e 100644 (file)
@@ -239,7 +239,7 @@ clib_memcpy_le (u8 * dst, u8 * src, u8 len, u8 max_len)
   d1 = u8x32_blend (d1, s1, u8x32_is_greater (lv, mask));
   u8x32_store_unaligned (d1, dst + 32);
 
-#elif defined (CLIB_HAVE_VEC128) && !defined (__aarch64__)
+#elif defined (CLIB_HAVE_VEC128)
   u8x16 s0, s1, s2, s3, d0, d1, d2, d3;
   u8x16 mask = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
   u8x16 lv = u8x16_splat (len);
index 9045160..37bd1bb 100644 (file)
@@ -83,6 +83,14 @@ static_always_inline u32                                             \
 t##s##x##c##_zero_byte_mask (t##s##x##c x)                     \
 { uint8x16_t v = vreinterpretq_u8_u##s (vceqq_##i (vdupq_n_##i(0), x));  \
   return u8x16_compare_byte_mask (v); } \
+\
+static_always_inline u##s##x##c                                                \
+t##s##x##c##_is_greater (t##s##x##c a, t##s##x##c b)                   \
+{ return (u##s##x##c) vcgtq_##i (a, b); }                              \
+\
+static_always_inline t##s##x##c                                                \
+t##s##x##c##_blend (t##s##x##c dst, t##s##x##c src, u##s##x##c mask)   \
+{ return (t##s##x##c) vbslq_##i (mask, src, dst); }
 
 foreach_neon_vec128i foreach_neon_vec128u