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 https://github.com/libsdl-org/SDL/pull/12223

(cherry picked from commit 875653658a)
This commit is contained in:
Ozkan Sezer
2025-08-31 03:20:20 +03:00
parent a7947080c0
commit 7c189b1f17
+4 -9
View File
@@ -761,19 +761,14 @@ if(SDL_ASSEMBLY)
if(SDL_SSE4_2) if(SDL_SSE4_2)
cmake_push_check_state() cmake_push_check_state()
if(USE_GCC OR USE_CLANG OR USE_INTELCC) if(USE_GCC OR USE_CLANG OR USE_INTELCC)
string(APPEND CMAKE_REQUIRED_FLAGS " -msse4.2 -mcrc32") string(APPEND CMAKE_REQUIRED_FLAGS " -msse4.2")
endif() endif()
check_c_source_compiles(" check_c_source_compiles("
#include <nmmintrin.h> #include <nmmintrin.h>
unsigned calc_crc32c(const char *text, unsigned len) { __m128i bitmask;
unsigned crc32c = ~0; char data[16];
for (; len >= 4; len -= 4, text += 4) {
crc32c = (unsigned)_mm_crc32_u32(crc32c, *(unsigned*)text);
}
return crc32c;
}
int main(int argc, char **argv) { int main(int argc, char **argv) {
calc_crc32c(\"SDL_SSE4\",8); bitmask = _mm_cmpgt_epi64(_mm_set1_epi64x(0), _mm_loadu_si128((void*)data));
return 0; return 0;
}" COMPILER_SUPPORTS_SSE4_2) }" COMPILER_SUPPORTS_SSE4_2)
cmake_pop_check_state() cmake_pop_check_state()