forked from Jasonysli/tiflash
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix darwin crc64 compiler (pingcap#2721)
1 parent
484d9ef
commit 00f985c
Showing
8 changed files
with
95 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#include <common/crc64.h> | ||
#include <common/crc64_fast.h> | ||
#include <common/crc64_table.h> | ||
#include <common/simd.h> | ||
namespace crc64 | ||
{ | ||
|
||
Digest::Digest(Mode mode) | ||
{ | ||
// clang-format off | ||
#ifdef TIFLASH_CRC64_HAS_SIMD_SUPPORT | ||
using namespace simd_option; | ||
#if TIFLASH_COMPILER_VPCLMULQDQ_SUPPORT | ||
#ifdef TIFLASH_ENABLE_AVX512_SUPPORT | ||
if ((mode == Mode::Auto || mode >= Mode::SIMD_512) && ENABLE_AVX512 | ||
&& __builtin_cpu_supports("vpclmulqdq") && __builtin_cpu_supports("avx512dq")) | ||
{ | ||
update_fn = [](uint64_t _state, const void * _src, size_t _length) { | ||
return crc64::_detail::update_fast<512>(crc64::_detail::update_vpclmulqdq_avx512, _state, _src, _length); | ||
}; | ||
} | ||
else | ||
#endif // TIFLASH_ENABLE_AVX512_SUPPORT | ||
#ifdef TIFLASH_ENABLE_AVX_SUPPORT | ||
if ((mode == Mode::Auto || mode >= Mode::SIMD_256) && ENABLE_AVX | ||
&& __builtin_cpu_supports("vpclmulqdq") && __builtin_cpu_supports("avx2")) | ||
{ | ||
update_fn = [](uint64_t _state, const void * _src, size_t _length) { | ||
return crc64::_detail::update_fast<256>(crc64::_detail::update_vpclmulqdq_avx2, _state, _src, _length); | ||
}; | ||
} | ||
else | ||
#endif // TIFLASH_ENABLE_AVX_SUPPORT | ||
#endif // TIFLASH_COMPILER_VPCLMULQDQ_SUPPORT | ||
if (mode == Mode::Auto || mode >= Mode::SIMD_128) | ||
{ | ||
update_fn = [](uint64_t _state, const void * _src, size_t _length) { | ||
return crc64::_detail::update_fast(crc64::_detail::update_simd, _state, _src, _length); | ||
}; | ||
#ifdef TIFLASH_ENABLE_ASIMD_SUPPORT | ||
if (!ENABLE_ASIMD || !SIMDRuntimeSupport(SIMDFeature::pmull)) | ||
{ | ||
update_fn = _detail::update_table; | ||
} | ||
#else // must be SSE case then | ||
if (!__builtin_cpu_supports("pclmul")) | ||
{ | ||
update_fn = _detail::update_table; | ||
} | ||
#endif // TIFLASH_ENABLE_ASIMD_SUPPORT | ||
} | ||
else | ||
#endif // TIFLASH_CRC64_HAS_SIMD_SUPPORT | ||
{ | ||
update_fn = _detail::update_table; | ||
} | ||
// clang-format on | ||
} | ||
} // namespace crc64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters