Skip to content

Commit

Permalink
windows only: better way to get cpuid data with internal facility of …
Browse files Browse the repository at this point in the history
…clang/gcc (also silence warning "<mm3dnow.h> header is deprecated", including <intrin.h>)
  • Loading branch information
sebres committed Dec 29, 2024
1 parent f0a45be commit b5e13d0
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions win/tclWin32Dll.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
*/

#include "tclWinInt.h"
#if defined(HAVE_INTRIN_H)
#if defined (__clang__) || ((__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8))))
# include <cpuid.h>
#elif defined(HAVE_INTRIN_H)
# include <intrin.h>
#endif

Expand Down Expand Up @@ -661,7 +663,12 @@ TclWinCPUID(
{
int status = TCL_ERROR;

#if defined(HAVE_INTRIN_H) && defined(_WIN64) && defined(HAVE_CPUID)
#if defined (__clang__) || ((__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8))))

__get_cpuid(index, &regsPtr[0], &regsPtr[1], &regsPtr[2], &regsPtr[3]);
status = TCL_OK;

#elif defined(HAVE_INTRIN_H) && defined(_WIN64) && defined(HAVE_CPUID)

__cpuid((int *)regsPtr, (int)index);
status = TCL_OK;
Expand Down

0 comments on commit b5e13d0

Please sign in to comment.