Skip to content

Commit 7c189b1

Browse files
committed
cmake: revert commit 5d1bbd9 and change sse4.2 test
clang doesn't support -mcrc32 until version 14.0, therefore drop -mcrc32 use in sse 4.2 test, and change it to check _mm_cmpgt_epi64() instead of _mm_crc32_u32(). without this, sse4.2 check was failing with clang <= 13 Fixes #12223 (cherry picked from commit 8756536)
1 parent a794708 commit 7c189b1

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

CMakeLists.txt

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -761,19 +761,14 @@ if(SDL_ASSEMBLY)
761761
if(SDL_SSE4_2)
762762
cmake_push_check_state()
763763
if(USE_GCC OR USE_CLANG OR USE_INTELCC)
764-
string(APPEND CMAKE_REQUIRED_FLAGS " -msse4.2 -mcrc32")
764+
string(APPEND CMAKE_REQUIRED_FLAGS " -msse4.2")
765765
endif()
766766
check_c_source_compiles("
767767
#include <nmmintrin.h>
768-
unsigned calc_crc32c(const char *text, unsigned len) {
769-
unsigned crc32c = ~0;
770-
for (; len >= 4; len -= 4, text += 4) {
771-
crc32c = (unsigned)_mm_crc32_u32(crc32c, *(unsigned*)text);
772-
}
773-
return crc32c;
774-
}
768+
__m128i bitmask;
769+
char data[16];
775770
int main(int argc, char **argv) {
776-
calc_crc32c(\"SDL_SSE4\",8);
771+
bitmask = _mm_cmpgt_epi64(_mm_set1_epi64x(0), _mm_loadu_si128((void*)data));
777772
return 0;
778773
}" COMPILER_SUPPORTS_SSE4_2)
779774
cmake_pop_check_state()

0 commit comments

Comments
 (0)