mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-10 16:46:35 +01:00
Fix for conflicting definition of _xgetbv with mingw-w64 >= 5
Simplify the #ifdef logic so it is easier to follow and add exceptions in the future if necessary.
This commit is contained in:
parent
8520312f97
commit
ed09a68f24
1 changed files with 30 additions and 18 deletions
|
|
@ -71,24 +71,18 @@ __cpuid(int regs[4], int cpuid_leaf)
|
||||||
|
|
||||||
#endif /* !PLATFORM_WINDOWS */
|
#endif /* !PLATFORM_WINDOWS */
|
||||||
|
|
||||||
#ifndef COMPILER_MSVC
|
#ifndef HAVE_XGETBV // Allow definition by build system
|
||||||
|
#if defined(__MINGW32__) && defined(__MINGW64_VERSION_MAJOR) && __MINGW64_VERSION_MAJOR >= 5
|
||||||
static uint64_t
|
#define HAVE_XGETBV
|
||||||
_xgetbv (uint32_t xcr)
|
#elif defined(_MSC_VER) && _MSC_VER >= 1600
|
||||||
{
|
// '_xgetbv()' was only available from VC10 onwards
|
||||||
#ifdef __APPLE__
|
#define HAVE_XGETBV
|
||||||
/* it would be nice to make this work on OS X but as long we use veclib,
|
#endif
|
||||||
we don't really need to know about SSE/AVX on that platform.
|
|
||||||
*/
|
|
||||||
return 0;
|
|
||||||
#else
|
|
||||||
uint32_t eax, edx;
|
|
||||||
__asm__ volatile ("xgetbv" : "=a" (eax), "=d" (edx) : "c" (xcr));
|
|
||||||
return (static_cast<uint64_t>(edx) << 32) | eax;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
#elif _MSC_VER < 1600
|
#ifndef HAVE_XGETBV
|
||||||
|
|
||||||
|
#ifdef COMPILER_MSVC
|
||||||
|
|
||||||
// '_xgetbv()' was only available from VC10 onwards
|
// '_xgetbv()' was only available from VC10 onwards
|
||||||
__declspec(noinline) static uint64_t
|
__declspec(noinline) static uint64_t
|
||||||
|
|
@ -105,7 +99,25 @@ _xgetbv (uint32_t xcr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
static uint64_t
|
||||||
|
_xgetbv (uint32_t xcr)
|
||||||
|
{
|
||||||
|
#ifdef __APPLE__
|
||||||
|
/* it would be nice to make this work on OS X but as long we use veclib,
|
||||||
|
we don't really need to know about SSE/AVX on that platform.
|
||||||
|
*/
|
||||||
|
return 0;
|
||||||
|
#else
|
||||||
|
uint32_t eax, edx;
|
||||||
|
__asm__ volatile ("xgetbv" : "=a" (eax), "=d" (edx) : "c" (xcr));
|
||||||
|
return (static_cast<uint64_t>(edx) << 32) | eax;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* !COMPILER_MSVC */
|
#endif /* !COMPILER_MSVC */
|
||||||
|
#endif /* !HAVE_XGETBV */
|
||||||
#endif /* ARCH_X86 */
|
#endif /* ARCH_X86 */
|
||||||
|
|
||||||
#ifndef _XCR_XFEATURE_ENABLED_MASK
|
#ifndef _XCR_XFEATURE_ENABLED_MASK
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue