Skip to content

Fix intrin_compat.h to work for MinGW #671

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 13, 2025

Conversation

zzambers
Copy link

@zzambers zzambers commented Apr 13, 2025

Fixes of problems in intrin_compat (with MinGW):

  • added check for definition of _rdtsc after inclusion of <intrin.h>, before defining it as inline func. (GCC/Mingw header already defines _rdtsc as alias for __rdtsc)
  • use of intrin.h should be consistent and depend _WIN32 everywhere (rather than on _MSC_VER in some places) to avoid problems on MinGW

This was extracted from bigger change-set fixing build on MinGW: #547

@@ -132,17 +133,20 @@ static inline uint64_t _rdtsc()
#endif

#ifndef cpuid
#if defined(_MSC_VER)
#if (defined _M_IX86 || defined _M_X64 || defined __i386__ || defined __amd64__)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the goal of this condition?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Goal was to use dummy implementation on architectures other than x86 and x86_64. (As cpuid is instruction specific to x86) Condition was previously only used only for GCC and clang, but same applies to MSVC.

@zzambers zzambers force-pushed the intrin-compat-fixes branch from 36370c0 to 32a5d0f Compare April 13, 2025 17:22
@zzambers zzambers force-pushed the intrin-compat-fixes branch from 32a5d0f to 4b3448e Compare April 13, 2025 17:23
@zzambers
Copy link
Author

just fixed comment

@xezon xezon added this to the Code foundation build up milestone Apr 13, 2025
@xezon xezon added Minor Severity: Minor < Major < Critical < Blocker Build Anything related to building, compiling labels Apr 13, 2025
@xezon xezon changed the title Fixes to intrin_compat.h to work with MinGW Fix intrin_compat.h to work for MinGW Apr 13, 2025
@xezon xezon merged commit adf9c71 into TheSuperHackers:main Apr 13, 2025
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Build Anything related to building, compiling Minor Severity: Minor < Major < Critical < Blocker
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants