/* Vector types. */
-#if defined (__MMX__) || defined (__IWMMXT__) || defined (__aarch64__)
+#if defined (__MMX__) || defined (__IWMMXT__) || defined (__aarch64__) \
+ || defined (__i686__)
#define CLIB_HAVE_VEC64
#endif
-#if defined (__aarch64__) && defined(__ARM_NEON)
+#if defined (__aarch64__) && defined(__ARM_NEON) || defined (__i686__)
#define CLIB_HAVE_VEC128
#endif
#define CLIB_HAVE_VEC128
#endif
-#if defined (__AVX__)
+#if defined (__AVX2__)
#define CLIB_HAVE_VEC256
+#if defined (__clang__) && __clang_major__ < 4
+#undef CLIB_HAVE_VEC256
+#endif
#endif
#if defined (__AVX512F__)
#endif
#define _vector_size(n) __attribute__ ((vector_size (n)))
+#define _vector_size_unaligned(n) __attribute__ ((vector_size (n), __aligned__ (1)))
#define foreach_vec64i _(i,8,8) _(i,16,4) _(i,32,2)
#define foreach_vec64u _(u,8,8) _(u,16,4) _(u,32,2)
/* Type Definitions */
#define _(t,s,c) \
typedef t##s t##s##x##c _vector_size (s/8*c); \
+typedef t##s t##s##x##c##u _vector_size_unaligned (s/8*c); \
typedef union { \
t##s##x##c as_##t##s##x##c; \
t##s as_##t##s[c]; \
#define VECTOR_WORD_TYPE(t) t##x
#define VECTOR_WORD_TYPE_LEN(t) (sizeof (VECTOR_WORD_TYPE(t)) / sizeof (t))
-/* this series of macros generate _is_equal, _is_greater, _is_zero, _add
- and _sub inline funcitons for each vector type */
-#define _(t, s, c) \
- static_always_inline t##s##x##c \
-t##s##x##c##_is_equal (t##s##x##c v1, t##s##x##c v2) \
-{ return (v1 == v2); } \
- \
-static_always_inline t##s##x##c \
-t##s##x##c##_is_greater (t##s##x##c v1, t##s##x##c v2) \
-{ return (v1 > v2); } \
- \
-static_always_inline t##s##x##c \
-t##s##x##c##_is_zero (t##s##x##c v1) \
-{ t##s##x##c z = {0}; return (v1 == z); } \
- \
-static_always_inline t##s##x##c \
-t##s##x##c##_add (t##s##x##c v1, t##s##x##c v2) \
-{ return (v1 + v2); } \
- \
-static_always_inline t##s##x##c \
-t##s##x##c##_sub (t##s##x##c v1, t##s##x##c v2) \
-{ return (v1 - v2); }
- foreach_vec
-#undef _
-
-/* this macro generate _splat inline funcitons for each scalar vector type */
-#define _(t, s, c) \
- static_always_inline t##s##x##c \
-t##s##x##c##_splat (t##s x) \
-{ \
- t##s##x##c r; \
- int i; \
- \
- for (i = 0; i < c; i++) \
- r[i] = x; \
- \
- return r; \
-}
- foreach_int_vec foreach_uint_vec
-#undef _
-
#if defined (__SSE4_2__) && __GNUC__ >= 4
#include <vppinfra/vector_sse42.h>
#endif
+#if defined (__AVX2__)
+#include <vppinfra/vector_avx2.h>
+#endif
+
+#if defined (__AVX512F__)
+#include <vppinfra/vector_avx512.h>
+#endif
+
#if defined (__ALTIVEC__)
#include <vppinfra/vector_altivec.h>
#endif
#include <vppinfra/vector_funcs.h>
#endif
+/* this macro generate _splat inline functions for each scalar vector type */
+#ifndef CLIB_VEC128_SPLAT_DEFINED
+#define _(t, s, c) \
+ static_always_inline t##s##x##c \
+t##s##x##c##_splat (t##s x) \
+{ \
+ t##s##x##c r; \
+ int i; \
+ \
+ for (i = 0; i < c; i++) \
+ r[i] = x; \
+ \
+ return r; \
+}
+ foreach_vec128i foreach_vec128u
+#undef _
+#endif
+
/* *INDENT-ON* */
#endif /* included_clib_vector_h */