13
0

can't use xgetbv instruction with apple gcc under OS X Lion

This commit is contained in:
Paul Davis 2015-08-11 23:06:47 -04:00
parent 4d0be2ee2e
commit b6f9bbeb2f

View File

@ -78,9 +78,16 @@ __cpuid(int regs[4], int cpuid_leaf)
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
}
#define _XCR_XFEATURE_ENABLED_MASK 0