@@ -178,6 +178,15 @@ int main() {
|
|||||||
return _bzhi_u32(0, 1);
|
return _bzhi_u32(0, 1);
|
||||||
}" SNAPPY_HAVE_BMI2)
|
}" SNAPPY_HAVE_BMI2)
|
||||||
|
|
||||||
|
check_cxx_source_compiles("
|
||||||
|
#include <arm_neon.h>
|
||||||
|
int main() {
|
||||||
|
uint8_t val = 3, dup[8];
|
||||||
|
uint8x16_t v = vld1q_dup_u8(&val);
|
||||||
|
vst1q_u8(dup, v);
|
||||||
|
return 0;
|
||||||
|
}" SNAPPY_HAVE_NEON)
|
||||||
|
|
||||||
include(CheckSymbolExists)
|
include(CheckSymbolExists)
|
||||||
check_symbol_exists("mmap" "sys/mman.h" HAVE_FUNC_MMAP)
|
check_symbol_exists("mmap" "sys/mman.h" HAVE_FUNC_MMAP)
|
||||||
check_symbol_exists("sysconf" "unistd.h" HAVE_FUNC_SYSCONF)
|
check_symbol_exists("sysconf" "unistd.h" HAVE_FUNC_SYSCONF)
|
||||||
|
|||||||
@@ -49,6 +49,9 @@
|
|||||||
/* Define to 1 if you target processors with BMI2+ and have <bmi2intrin.h>. */
|
/* Define to 1 if you target processors with BMI2+ and have <bmi2intrin.h>. */
|
||||||
#cmakedefine01 SNAPPY_HAVE_BMI2
|
#cmakedefine01 SNAPPY_HAVE_BMI2
|
||||||
|
|
||||||
|
/* Define to 1 if you target processors with NEON and have <arm_neon.h>. */
|
||||||
|
#cmakedefine01 SNAPPY_HAVE_NEON
|
||||||
|
|
||||||
/* Define to 1 if your processor stores words with the most significant byte
|
/* Define to 1 if your processor stores words with the most significant byte
|
||||||
first (like Motorola and SPARC, unlike Intel and VAX). */
|
first (like Motorola and SPARC, unlike Intel and VAX). */
|
||||||
#cmakedefine01 SNAPPY_IS_BIG_ENDIAN
|
#cmakedefine01 SNAPPY_IS_BIG_ENDIAN
|
||||||
|
|||||||
@@ -33,13 +33,30 @@
|
|||||||
|
|
||||||
#include "snappy-stubs-internal.h"
|
#include "snappy-stubs-internal.h"
|
||||||
|
|
||||||
|
#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 snappy {
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
#if SNAPPY_HAVE_VECTOR_BYTE_SHUFFLE
|
#if SNAPPY_HAVE_VECTOR_BYTE_SHUFFLE
|
||||||
#if SNAPPY_HAVE_SSSE3
|
#if SNAPPY_HAVE_SSSE3
|
||||||
using V128 = __m128i;
|
using V128 = __m128i;
|
||||||
#else
|
#elif SNAPPY_HAVE_NEON
|
||||||
using V128 = uint8x16_t;
|
using V128 = uint8x16_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -72,7 +89,7 @@ inline V128 V128_Shuffle(V128 input, V128 shuffle_mask) {
|
|||||||
|
|
||||||
inline V128 V128_DupChar(char c) { return _mm_set1_epi8(c); }
|
inline V128 V128_DupChar(char c) { return _mm_set1_epi8(c); }
|
||||||
|
|
||||||
#else
|
#elif SNAPPY_HAVE_NEON
|
||||||
inline V128 V128_Load(const V128* src) {
|
inline V128 V128_Load(const V128* src) {
|
||||||
return vld1q_u8(reinterpret_cast<const uint8_t*>(src));
|
return vld1q_u8(reinterpret_cast<const uint8_t*>(src));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user