Commit ee6b4fce authored by Daniel M. Weeks's avatar Daniel M. Weeks Committed by facebook-github-bot-1

Limit use of hardware crc32 check to SSE 4.2

Summary: Fixes compiling crc32c function on older hardware. (I believe this problem was introduced by 7ec1fc0e).

Also ensures is in final library since the API suggests it should be. This should correct a number of build problems for other projects like wdt and hhvm when they are compiled using a shared folly library rather than borrowing sources at compile time.
Closes #296

Reviewed By: @yfeldblum

Differential Revision: D2340699

Pulled By: @sgolemon
parent cd69a53a
...@@ -29,10 +29,11 @@ namespace detail { ...@@ -29,10 +29,11 @@ namespace detail {
#define __has_builtin(x) 0 #define __has_builtin(x) 0
#endif #endif
#if (__has_builtin(__builtin_ia32_crc32qi) && \ #if __SSE4_2__ && \
((__has_builtin(__builtin_ia32_crc32qi) && \
__has_builtin(__builtin_ia32_crc32di)) || \ __has_builtin(__builtin_ia32_crc32di)) || \
(FOLLY_X64 && defined(__GNUC__) && defined(__GNUC_MINOR__) && \ (FOLLY_X64 && defined(__GNUC__) && defined(__GNUC_MINOR__) && \
(((__GNUC__ * 100) + __GNUC_MINOR__) >= 407)) (((__GNUC__ * 100) + __GNUC_MINOR__) >= 407)))
// Fast SIMD implementation of CRC-32C for x86 with SSE 4.2 // Fast SIMD implementation of CRC-32C for x86 with SSE 4.2
uint32_t crc32c_hw(const uint8_t *data, size_t nbytes, uint32_t crc32c_hw(const uint8_t *data, size_t nbytes,
......
...@@ -310,6 +310,7 @@ libfollybase_la_SOURCES = \ ...@@ -310,6 +310,7 @@ libfollybase_la_SOURCES = \
libfolly_la_SOURCES = \ libfolly_la_SOURCES = \
Bits.cpp \ Bits.cpp \
Checksum.cpp \
detail/CacheLocality.cpp \ detail/CacheLocality.cpp \
dynamic.cpp \ dynamic.cpp \
File.cpp \ File.cpp \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment