-
Notifications
You must be signed in to change notification settings - Fork 262
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
Substitution for MemoryBarrier() to avoid including <windows.h> #1199
Conversation
Edit: Nevermind, missed a branch: #if defined(__aarch64__) || defined(_M_ARM64)
#define simde_MemoryBarrier __faststorefence |
Thank you @Epixu !! Did you see this MSVC-aarch64 build failure? And the appveyor windows builds are also failing |
Yes, I'm aware, but my time budget went a bit constrained. I'll eventually finish it, but I'll appreciate any help. I think these are mostly technical mistakes. One of the previous runs had only one failing build (referenced via my previous comment with strikethrough) |
simde/x86/sse.h
Outdated
simde_InterlockedOr(&dummy, 0); | ||
} | ||
#else | ||
#error "should simde_MemoryBarrier be defined as no-op in this case?" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, for when SIMDE_X86_SSE_NO_NATIVE
is defined on x86-64 systems; at least
Tests passed here, but all my x86 builds still failed, so you probably don't cover some of these cases in tests for MSVC: #elif defined(SIMDE_ARCH_X86) || defined(SIMDE_ARCH_AMD64) || defined(SIMDE_ARCH_E2K)
#if !defined(SIMDE_X86_SSE_NO_NATIVE)
#include <intrin.h>
#endif
HEDLEY_ALWAYS_INLINE
void simde_MemoryBarrier(void) {
#if defined(SIMDE_X86_SSE_NO_NATIVE)
((void)0); // intentionally no-op
#elif defined(SIMDE_ARCH_AMD64)
__faststorefence();
#elif defined(SIMDE_ARCH_IA64)
__mf();
#else
// This case is definitely not convered
long Barrier;
__asm { xchg Barrier, eax }
#endif
}
#else |
I believe it is ready for merge @mr-c |
Thank you @Epixu ! I squashed your commit and made some other small changes |
Preprocessor checks should probably be substituted with SIMDE_* alternatives, but I'm not very familiar with these, so it could use a review. #1193