use byte code instead of xgetvb for gcc 4.2 on mac

This commit is contained in:
MITSUNARI Shigeo 2012-03-15 10:50:47 +09:00
parent 378526931e
commit f8a3c66c1f

View file

@ -74,12 +74,12 @@ public:
{
#ifdef _MSC_VER
return __xgetbv(0);
#elif __GNUC_PREREQ(4, 3)
unsigned int eax, edx;
__asm__ volatile("xgetbv" : "=a"(eax), "=d"(edx) : "c"(0));
return ((uint64)edx << 32) | eax;
#else
return 0;
unsigned int eax, edx;
// xgetvb is not support on gcc 4.2
// __asm__ volatile("xgetbv" : "=a"(eax), "=d"(edx) : "c"(0));
__asm__ volatile(".byte 0x0f, 0x01, 0xd0" : "=a"(eax), "=d"(edx) : "c"(0));
return ((uint64)edx << 32) | eax;
#endif
}
enum Type {