diff options
author | alkis <alkis@google.com> | 2017-06-02 10:21:49 -0700 |
---|---|---|
committer | Victor Costan <pwnall@chromium.org> | 2017-06-05 13:54:17 -0700 |
commit | 7b9532b8781c5beaf99eef8ca7535d969a129d78 (patch) | |
tree | ad803b04bba46196c09abe4fe83b69dcd873b5a1 | |
parent | 7dadceea528fcaf33af7f2cf8322d8789e4e9b1d (diff) | |
download | snappy-7b9532b8781c5beaf99eef8ca7535d969a129d78.tar.gz snappy-7b9532b8781c5beaf99eef8ca7535d969a129d78.tar.bz2 snappy-7b9532b8781c5beaf99eef8ca7535d969a129d78.zip |
Improve the SSE2 macro check on Windows.
This lands https://github.com/google/snappy/pull/37
-rw-r--r-- | snappy.cc | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -30,7 +30,16 @@ #include "snappy-internal.h" #include "snappy-sinksource.h" -#ifdef __SSE2__ +#ifndef SNAPPY_HAVE_SSE2 +#if defined(__SSE2__) || defined(_M_X64) || \ + (defined(_M_IX86_FP) && _M_IX86_FP >= 2) +#define SNAPPY_HAVE_SSE2 1 +#else +#define SNAPPY_HAVE_SSE2 0 +#endif +#endif + +#if SNAPPY_HAVE_SSE2 #include <emmintrin.h> #endif #include <stdio.h> @@ -96,7 +105,7 @@ void UnalignedCopy64(const void* src, void* dst) { void UnalignedCopy128(const void* src, void* dst) { // TODO(alkis): Remove this when we upgrade to a recent compiler that emits // SSE2 moves for memcpy(dst, src, 16). -#ifdef __SSE2__ +#if SNAPPY_HAVE_SSE2 __m128i x = _mm_loadu_si128(static_cast<const __m128i*>(src)); _mm_storeu_si128(static_cast<__m128i*>(dst), x); #else |