]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Use GCC cpuid intrinsics with MinGW
authorCameron Cawley <ccawley2011@gmail.com>
Fri, 19 May 2023 14:16:24 +0000 (15:16 +0100)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Sat, 16 Sep 2023 09:08:25 +0000 (11:08 +0200)
arch/x86/x86_features.c
cmake/detect-intrinsics.cmake
configure

index 3272e3fdd9721cb84442645030ef29bac1b8ac6f..8d11564c24f94ba72bf7307b60406bf8e83c8b44 100644 (file)
@@ -10,7 +10,7 @@
 #include "../../zbuild.h"
 #include "x86_features.h"
 
-#ifdef _WIN32
+#ifdef _MSC_VER
 #  include <intrin.h>
 #else
 // Newer versions of GCC and clang come with cpuid.h
@@ -20,7 +20,7 @@
 #include <string.h>
 
 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;
index 2358c5788c8feed8c39a2dded4f95b61e216923a..a4a28b445aec78b3c921d60ecdffcde31ce57c6f 100644 (file)
@@ -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 <intrin.h>
         #else
         #  include <x86gprintrin.h>
index 46180548721521054e92346691a9f3d35b82b143..d96455e6c1eaccede0812cdef6c250f8cd17bb10 100755 (executable)
--- 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 <intrin.h>
 #else
 #  include <x86gprintrin.h>