mirror of
https://git.tukaani.org/xz.git
synced 2024-04-04 12:36:23 +02:00
CMake: Add ALLOW_CLMUL_CRC option to enable/disable CLMUL.
The option is enabled by default, but will only be visible to a user listing cache variables or using a CMake GUI application if the immintrin.h header file is found. This mirrors our Autotools build --disable-clmul-crc functionality.
This commit is contained in:
parent
5056bc5107
commit
1695021e4a
1 changed files with 23 additions and 17 deletions
|
@ -802,23 +802,29 @@ if(HAVE_IMMINTRIN_H)
|
||||||
tuklib_add_definition_if(liblzma HAVE__MM_MOVEMASK_EPI8)
|
tuklib_add_definition_if(liblzma HAVE__MM_MOVEMASK_EPI8)
|
||||||
|
|
||||||
# CLMUL intrinsic:
|
# CLMUL intrinsic:
|
||||||
check_c_source_compiles("
|
option(ALLOW_CLMUL_CRC "Allow carryless multiplication for CRC \
|
||||||
#include <immintrin.h>
|
calculation if supported by the system" ON)
|
||||||
#if defined(__e2k__) && __iset__ < 6
|
|
||||||
# error
|
if(ALLOW_CLMUL_CRC)
|
||||||
#endif
|
check_c_source_compiles("
|
||||||
#if (defined(__GNUC__) || defined(__clang__)) && !defined(__EDG__)
|
#include <immintrin.h>
|
||||||
__attribute__((__target__(\"ssse3,sse4.1,pclmul\")))
|
#if defined(__e2k__) && __iset__ < 6
|
||||||
#endif
|
# error
|
||||||
__m128i my_clmul(__m128i a)
|
#endif
|
||||||
{
|
#if (defined(__GNUC__) || defined(__clang__)) \
|
||||||
const __m128i b = _mm_set_epi64x(1, 2);
|
&& !defined(__EDG__)
|
||||||
return _mm_clmulepi64_si128(a, b, 0);
|
__attribute__((__target__(\"ssse3,sse4.1,pclmul\")))
|
||||||
}
|
#endif
|
||||||
int main(void) { return 0; }
|
__m128i my_clmul(__m128i a)
|
||||||
"
|
{
|
||||||
HAVE_USABLE_CLMUL)
|
const __m128i b = _mm_set_epi64x(1, 2);
|
||||||
tuklib_add_definition_if(liblzma HAVE_USABLE_CLMUL)
|
return _mm_clmulepi64_si128(a, b, 0);
|
||||||
|
}
|
||||||
|
int main(void) { return 0; }
|
||||||
|
"
|
||||||
|
HAVE_USABLE_CLMUL)
|
||||||
|
tuklib_add_definition_if(liblzma HAVE_USABLE_CLMUL)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Support -fvisiblity=hidden when building shared liblzma.
|
# Support -fvisiblity=hidden when building shared liblzma.
|
||||||
|
|
Loading…
Reference in a new issue