diff options
author | Lasse Collin <lasse.collin@tukaani.org> | 2023-01-07 19:31:15 +0200 |
---|---|---|
committer | Lasse Collin <lasse.collin@tukaani.org> | 2023-01-08 00:20:42 +0200 |
commit | ceb805011747d04a915f3f39e4bed9eed151c634 (patch) | |
tree | 5321f59f5e5ee96791e3977b8009be7ef7832588 | |
parent | CI/CD: Split CMake Linux and MacOS build phase to build and test. (diff) | |
download | xz-ceb805011747d04a915f3f39e4bed9eed151c634.tar.xz |
Build: Require that _mm_set_epi64x() is usable to enable CLMUL support.
VS2013 doesn't have _mm_set_epi64x() so this way CLMUL gets
disabled with VS2013.
Thanks to Iouri Kharon for the bug report.
Diffstat (limited to '')
-rw-r--r-- | CMakeLists.txt | 3 | ||||
-rw-r--r-- | configure.ac | 8 |
2 files changed, 8 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 3a58d740..ef17563e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -434,8 +434,9 @@ if(HAVE_IMMINTRIN_H) #if (defined(__GNUC__) || defined(__clang__)) && !defined(__EDG__) __attribute__((__target__(\"ssse3,sse4.1,pclmul\"))) #endif - __m128i my_clmul(__m128i a, __m128i b) + __m128i my_clmul(__m128i a) { + const __m128i b = _mm_set_epi64x(1, 2); return _mm_clmulepi64_si128(a, b, 0); } int main(void) { return 0; } diff --git a/configure.ac b/configure.ac index a595cd98..07cff50b 100644 --- a/configure.ac +++ b/configure.ac @@ -938,6 +938,8 @@ AC_CHECK_DECL([_mm_movemask_epi8], # For faster CRC on 32/64-bit x86 and E2K (see also crc64_fast.c): # # - Check for the CLMUL intrinsic _mm_clmulepi64_si128 in <immintrin.h>. +# Check also for _mm_set_epi64x for consistency with CMake build +# where it's needed to disable CLMUL with VS2013. # # - Check that __attribute__((__target__("ssse3,sse4.1,pclmul"))) works # together with _mm_clmulepi64_si128 from <immintrin.h>. The attribute @@ -965,13 +967,15 @@ else #if (defined(__GNUC__) || defined(__clang__)) && !defined(__EDG__) __attribute__((__target__("ssse3,sse4.1,pclmul"))) #endif -__m128i my_clmul(__m128i a, __m128i b) +__m128i my_clmul(__m128i a) { + const __m128i b = _mm_set_epi64x(1, 2); return _mm_clmulepi64_si128(a, b, 0); } ]])], [ AC_DEFINE([HAVE_USABLE_CLMUL], [1], - [Define to 1 if _mm_clmulepi64_si128 is usable. + [Define to 1 if _mm_set_epi64x and + _mm_clmulepi64_si128 are usable. See configure.ac for details.]) AC_MSG_RESULT([yes]) ], [ |