diff options
Diffstat (limited to 'snappy-internal.h')
-rw-r--r-- | snappy-internal.h | 39 |
1 files changed, 13 insertions, 26 deletions
diff --git a/snappy-internal.h b/snappy-internal.h index 71d19c0..ae7ab5a 100644 --- a/snappy-internal.h +++ b/snappy-internal.h @@ -33,40 +33,26 @@ #include "snappy-stubs-internal.h" -#if !defined(SNAPPY_HAVE_BMI2) -// __BMI2__ is defined by GCC and Clang. Visual Studio doesn't target BMI2 -// specifically, but it does define __AVX2__ when AVX2 support is available. -// Fortunately, AVX2 was introduced in Haswell, just like BMI2. -// -// BMI2 is not defined as a subset of AVX2 (unlike SSSE3 and AVX above). So, -// GCC and Clang can build code with AVX2 enabled but BMI2 disabled, in which -// case issuing BMI2 instructions results in a compiler error. -#if defined(__BMI2__) || (defined(_MSC_VER) && defined(__AVX2__)) -#define SNAPPY_HAVE_BMI2 1 -#else -#define SNAPPY_HAVE_BMI2 0 -#endif -#endif // !defined(SNAPPY_HAVE_BMI2) - -#if SNAPPY_HAVE_BMI2 -// Please do not replace with <x86intrin.h>. or with headers that assume more -// advanced SSE versions without checking with all the OWNERS. -#include <immintrin.h> -#endif - #if SNAPPY_HAVE_SSSE3 +// Please do not replace with <x86intrin.h> or with headers that assume more +// advanced SSE versions without checking with all the OWNERS. +#include <emmintrin.h> #include <tmmintrin.h> #endif + #if SNAPPY_HAVE_NEON #include <arm_neon.h> #endif +#if SNAPPY_HAVE_SSSE3 || SNAPPY_HAVE_NEON +#define SNAPPY_HAVE_VECTOR_BYTE_SHUFFLE 1 +#else +#define SNAPPY_HAVE_VECTOR_BYTE_SHUFFLE 0 +#endif + namespace snappy { namespace internal { -#if (SNAPPY_HAVE_SSSE3 || SNAPPY_HAVE_NEON) -#define SNAPPY_HAVE_VECTOR_BYTE_SHUFFLE 1 -#endif #if SNAPPY_HAVE_VECTOR_BYTE_SHUFFLE #if SNAPPY_HAVE_SSSE3 using V128 = __m128i; @@ -184,8 +170,9 @@ char* CompressFragment(const char* input, // loading from s2 + n. // // Separate implementation for 64-bit, little-endian cpus. -#if !defined(SNAPPY_IS_BIG_ENDIAN) && \ - (defined(__x86_64__) || defined(_M_X64) || defined(ARCH_PPC) || defined(ARCH_ARM)) +#if !SNAPPY_IS_BIG_ENDIAN && \ + (defined(__x86_64__) || defined(_M_X64) || defined(ARCH_PPC) || \ + defined(ARCH_ARM)) static inline std::pair<size_t, bool> FindMatchLength(const char* s1, const char* s2, const char* s2_limit, |