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
c60b25569d
commit
1397571704
1 changed files with 25 additions and 19 deletions
|
@ -829,12 +829,17 @@ 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:
|
||||||
|
option(ALLOW_CLMUL_CRC "Allow carryless multiplication for CRC \
|
||||||
|
calculation if supported by the system" ON)
|
||||||
|
|
||||||
|
if(ALLOW_CLMUL_CRC)
|
||||||
check_c_source_compiles("
|
check_c_source_compiles("
|
||||||
#include <immintrin.h>
|
#include <immintrin.h>
|
||||||
#if defined(__e2k__) && __iset__ < 6
|
#if defined(__e2k__) && __iset__ < 6
|
||||||
# error
|
# error
|
||||||
#endif
|
#endif
|
||||||
#if (defined(__GNUC__) || defined(__clang__)) && !defined(__EDG__)
|
#if (defined(__GNUC__) || defined(__clang__)) \
|
||||||
|
&& !defined(__EDG__)
|
||||||
__attribute__((__target__(\"ssse3,sse4.1,pclmul\")))
|
__attribute__((__target__(\"ssse3,sse4.1,pclmul\")))
|
||||||
#endif
|
#endif
|
||||||
__m128i my_clmul(__m128i a)
|
__m128i my_clmul(__m128i a)
|
||||||
|
@ -850,6 +855,7 @@ if(HAVE_IMMINTRIN_H)
|
||||||
target_sources(liblzma PRIVATE src/liblzma/check/crc_clmul.c)
|
target_sources(liblzma PRIVATE src/liblzma/check/crc_clmul.c)
|
||||||
target_compile_definitions(liblzma PRIVATE HAVE_USABLE_CLMUL)
|
target_compile_definitions(liblzma PRIVATE HAVE_USABLE_CLMUL)
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Support -fvisiblity=hidden when building shared liblzma.
|
# Support -fvisiblity=hidden when building shared liblzma.
|
||||||
|
|
Loading…
Reference in a new issue