Summary:
folly/detail/ChecksumDetail.h gets included in Checksum.h and it
unconditionally includes <immintrin.h>. This doesn't compile on
aarch64 platform. Add #ifdefs for this.
Reviewed By: yfeldblum
Differential Revision:
D5048636
fbshipit-source-id:
d2074eb1b01487b02d95f3e2eebe683237d918fe
#include <algorithm>
#include <stdexcept>
#include <algorithm>
#include <stdexcept>
-#if FOLLY_X64 && (__SSE4_2__ || defined(__clang__) || __GNUC_PREREQ(4, 9))
+#if FOLLY_SSE_PREREQ(4, 2)
#include <nmmintrin.h>
#endif
#include <nmmintrin.h>
#endif
uint32_t
crc32c_sw(const uint8_t* data, size_t nbytes, uint32_t startingChecksum);
uint32_t
crc32c_sw(const uint8_t* data, size_t nbytes, uint32_t startingChecksum);
-#if FOLLY_X64 && (__SSE4_2__ || defined(__clang__) || __GNUC_PREREQ(4, 9))
+#if FOLLY_SSE_PREREQ(4, 2)
// Fast SIMD implementation of CRC-32C for x86 with SSE 4.2
FOLLY_TARGET_ATTRIBUTE("sse4.2")
// Fast SIMD implementation of CRC-32C for x86 with SSE 4.2
FOLLY_TARGET_ATTRIBUTE("sse4.2")
throw std::runtime_error("crc32_hw is not implemented on this platform");
}
throw std::runtime_error("crc32_hw is not implemented on this platform");
}
+uint32_t crc32_hw(const uint8_t *data, size_t nbytes,
+ uint32_t startingChecksum) {
+ throw std::runtime_error("crc32_hw is not implemented on this platform");
+}
+
bool crc32c_hw_supported() {
return false;
}
bool crc32c_hw_supported() {
return false;
}
namespace folly {
namespace detail {
namespace folly {
namespace detail {
+#if FOLLY_SSE_PREREQ(4, 2)
+
uint32_t
crc32_hw_aligned(uint32_t remainder, const __m128i* p, size_t vec_count) {
/* Constants precomputed by gen_crc32_multipliers.c. Do not edit! */
uint32_t
crc32_hw_aligned(uint32_t remainder, const __m128i* p, size_t vec_count) {
/* Constants precomputed by gen_crc32_multipliers.c. Do not edit! */
x0 = _mm_clmulepi64_si128(_mm_and_si128(x0, mask32), barrett_reduction_constants, 0x10);
return _mm_cvtsi128_si32(_mm_srli_si128(_mm_xor_si128(x0, x1), 4));
}
x0 = _mm_clmulepi64_si128(_mm_and_si128(x0, mask32), barrett_reduction_constants, 0x10);
return _mm_cvtsi128_si32(_mm_srli_si128(_mm_xor_si128(x0, x1), 4));
}
+#include <folly/Portability.h>
+
+#if FOLLY_SSE_PREREQ(4, 2)
#include <stdint.h>
#include <cstddef>
#include <stdint.h>
#include <cstddef>
uint32_t
crc32_hw(const uint8_t* data, size_t nbytes, uint32_t startingChecksum = ~0U);
uint32_t
crc32_hw(const uint8_t* data, size_t nbytes, uint32_t startingChecksum = ~0U);
+#if FOLLY_SSE_PREREQ(4, 2)
uint32_t
crc32_hw_aligned(uint32_t remainder, const __m128i* p, size_t vec_count);
uint32_t
crc32_hw_aligned(uint32_t remainder, const __m128i* p, size_t vec_count);
/**
* Check whether a hardware-accelerated CRC-32 implementation is
/**
* Check whether a hardware-accelerated CRC-32 implementation is