From: Sirshak Das Date: Fri, 27 Jul 2018 06:13:33 +0000 (-0500) Subject: Add support for shuffle vector intrinsic via Neon in ARM X-Git-Tag: v18.10-rc1~508 X-Git-Url: https://gerrit.fd.io/r/gitweb?a=commitdiff_plain;ds=sidebyside;h=afc725afaed47f90f48f148c5c8f74348e0aaf23;p=vpp.git Add support for shuffle vector intrinsic via Neon in ARM This adds byte_swap (variant of shuffle) and shuffle vector intrinsic for ARM based on Neon, concuring with same signature as SSE vector intrinsic. Change-Id: I386fd2b1dcc83654e4ad9f90a6065d7736e4ce5c Signed-off-by: Sirshak Das --- diff --git a/src/vppinfra/vector_neon.h b/src/vppinfra/vector_neon.h index 7ca3c2c4221..451c531d52d 100644 --- a/src/vppinfra/vector_neon.h +++ b/src/vppinfra/vector_neon.h @@ -118,6 +118,22 @@ foreach_neon_vec128i foreach_neon_vec128u #undef _ /* *INDENT-ON* */ +static_always_inline u16x8 +u16x8_byte_swap (u16x8 v) +{ + const u8 swap_pattern[] = { + 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14, + }; + u8x16 swap = vld1q_u8 (swap_pattern); + return (u16x8) vqtbl1q_u8 ((u8x16) v, swap); +} + +static_always_inline u8x16 +u8x16_shuffle (u8x16 v, u8x16 m) +{ + return (u8x16) vqtbl1q_u8 (v, m); +} + #define CLIB_HAVE_VEC128_UNALIGNED_LOAD_STORE #define CLIB_VEC128_SPLAT_DEFINED #endif /* included_vector_neon_h */