57#if defined(__i386__) || defined(__x86_64__)
58#define SIMDVEC_INTEL_ENABLE 1
62#define _SIMD_VEC_64_AVAIL_
65#define _SIMD_VEC_64_FULL_AVAIL_
71#define _SIMD_VEC_32_AVAIL_
74#define _SIMD_VEC_32_FULL_AVAIL_
79#define _SIMD_VEC_16_AVAIL_
83#ifdef _SIMD_VEC_64_AVAIL_
84#define NATIVE_SIMD_WIDTH 64
85#elif defined(_SIMD_VEC_32_AVAIL_)
86#define NATIVE_SIMD_WIDTH 32
88#define NATIVE_SIMD_WIDTH 16
99#if defined(__arm__) || defined(__aarch64__) || defined(__ARM_NEON__) || \
100 defined(__ARM_NEON) || defined(_M_ARM) || defined(_M_ARM64)
101#define SIMDVEC_NEON_ENABLE 1
103#define _SIMD_VEC_16_AVAIL_
106#define NATIVE_SIMD_WIDTH 16
112#ifndef _SIMD_VEC_16_AVAIL_
113#error "no SIMD support detected"
117#if defined(SIMDVEC_INTEL_ENABLE) || defined(__aarch64__)
118#define SIMD_64BIT_TYPES 1
123#if NATIVE_SIMD_WIDTH > MAX_SIMD_WIDTH
124#undef NATIVE_SIMD_WIDTH
125#if MAX_SIMD_WIDTH >= 64
126#define NATIVE_SIMD_WIDTH 64
127#elif MAX_SIMD_WIDTH >= 32
128#define NATIVE_SIMD_WIDTH 32
129#elif MAX_SIMD_WIDTH >= 16
130#define NATIVE_SIMD_WIDTH 16
132#error "MAX_SIMD_WIDTH must be at least 16"
144#if defined(__GNUC__) || defined(__clang__) || defined(__INTEL_COMPILER)
145#define SIMD_DEFS_DEFINED
146#define SIMD_INLINE inline __attribute__((always_inline))
147#define SIMD_ATTR_ALIGNED(ALIGN) __attribute__((aligned(ALIGN)))
148#define SIMD_ATTR_PACKED_STRUCT struct __attribute__((__packed__))
149#define SIMD_FULL_MEMBARRIER __sync_synchronize()
158#ifndef SIMD_DEFS_DEFINED
159#error "attribute definitions missing for this compiler"
164#ifdef NATIVE_SIMD_WIDTH
165#define SIMD_WIDTH_DEFAULT_NATIVE SIMD_WIDTH = NATIVE_SIMD_WIDTH
167#define SIMD_WIDTH_DEFAULT_NATIVE SIMD_WIDTH
172template <
typename Tout,
typename Tin>
173SIMD_INLINE Tout bit_cast(Tin in)
175 static_assert(std::is_trivially_copyable<Tout>::value,
176 "Tout must be trivially copyable");
177 static_assert(std::is_trivially_copyable<Tin>::value,
178 "Tin must be trivially copyable");
181 std::memset(&out, 0,
sizeof(out));
182 std::memcpy(&out, &in, std::min(
sizeof(in),
sizeof(out)));
191#define SIMD_ENABLE_IF(EXPR) typename = typename std::enable_if<(EXPR)>::type
199#ifdef __cpp_if_constexpr
200#define SIMD_IF_CONSTEXPR if constexpr
202#define SIMD_IF_CONSTEXPR if
213#define SIMD_CHECK_ALIGNMENT(PTR, ALIGN) \
214 if (reinterpret_cast<uintptr_t>(PTR) % (ALIGN) != 0) { \
215 ::std::cerr << "SIMD_CHECK_ALIGNMENT: " << __FILE__ << ":" << __LINE__ \
216 << ": " << __func__ << ": " << #PTR << " = " << (PTR) \
217 << " is not aligned to " << (ALIGN) << " bytes" \
222#define SIMD_CHECK_ALIGNMENT(PTR, ALIGN) ((void) 0)
Namespace for T-SIMD.
Definition time_measurement.H:161