Add support for shuffle vector intrinsic via Neon in ARM 50/13850/2
authorSirshak Das <sirshak.das@arm.com>
Fri, 27 Jul 2018 06:13:33 +0000 (01:13 -0500)
committerDamjan Marion <dmarion@me.com>
Wed, 1 Aug 2018 10:52:56 +0000 (10:52 +0000)
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 <sirshak.das@arm.com>
src/vppinfra/vector_neon.h

index 7ca3c2c..451c531 100644 (file)
@@ -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 */