From: Cameron Cawley Date: Fri, 19 May 2023 14:16:24 +0000 (+0100) Subject: Use GCC cpuid intrinsics with MinGW X-Git-Tag: 2.1.4~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1c1e728637025cf1d13d99718ccb2d5cb1e9dfaa;p=thirdparty%2Fzlib-ng.git Use GCC cpuid intrinsics with MinGW --- diff --git a/arch/x86/x86_features.c b/arch/x86/x86_features.c index 3272e3fdd..8d11564c2 100644 --- a/arch/x86/x86_features.c +++ b/arch/x86/x86_features.c @@ -10,7 +10,7 @@ #include "../../zbuild.h" #include "x86_features.h" -#ifdef _WIN32 +#ifdef _MSC_VER # include #else // Newer versions of GCC and clang come with cpuid.h @@ -20,7 +20,7 @@ #include static inline void cpuid(int info, unsigned* eax, unsigned* ebx, unsigned* ecx, unsigned* edx) { -#ifdef _WIN32 +#ifdef _MSC_VER unsigned int registers[4]; __cpuid((int *)registers, info); @@ -34,7 +34,7 @@ static inline void cpuid(int info, unsigned* eax, unsigned* ebx, unsigned* ecx, } static inline void cpuidex(int info, int subinfo, unsigned* eax, unsigned* ebx, unsigned* ecx, unsigned* edx) { -#ifdef _WIN32 +#ifdef _MSC_VER unsigned int registers[4]; __cpuidex((int *)registers, info, subinfo); @@ -48,7 +48,7 @@ static inline void cpuidex(int info, int subinfo, unsigned* eax, unsigned* ebx, } static inline uint64_t xgetbv(unsigned int xcr) { -#ifdef _WIN32 +#ifdef _MSC_VER return _xgetbv(xcr); #else uint32_t eax, edx; diff --git a/cmake/detect-intrinsics.cmake b/cmake/detect-intrinsics.cmake index 2358c5788..a4a28b445 100644 --- a/cmake/detect-intrinsics.cmake +++ b/cmake/detect-intrinsics.cmake @@ -502,7 +502,7 @@ macro(check_xsave_intrinsics) endif() set(CMAKE_REQUIRED_FLAGS "${XSAVEFLAG} ${NATIVEFLAG}") check_c_source_compiles( - "#ifdef _WIN32 + "#ifdef _MSC_VER # include #else # include diff --git a/configure b/configure index 461805487..d96455e6c 100755 --- a/configure +++ b/configure @@ -1217,7 +1217,7 @@ EOF check_xsave_intrinsics() { # Check whether compiler supports XSAVE intrinsics cat > $test.c << EOF -#ifdef _WIN32 +#ifdef _MSC_VER # include #else # include