Use the GCC inline assembly when building for MinGW

MinGW has a longstanding problem of providing the MSVC intrinsics that
every Windows developer expects to be there. Other projects have run
into those problems.

So instead just use the GCC inline assembly.

Change-Id: I5651f97f9a4dfbf98ebbf063f91f221eab80b224
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
This commit is contained in:
Thiago Macieira 2013-05-20 14:53:14 -07:00 committed by The Qt Project
parent c11a7d16c7
commit 76d75fd7df

View File

@ -240,14 +240,14 @@ inline quint64 _xgetbv(__int64) { return 0; }
#endif #endif
static void xgetbv(uint in, uint &eax, uint &edx) static void xgetbv(uint in, uint &eax, uint &edx)
{ {
#ifdef Q_OS_WIN #if defined(Q_CC_GNU)
quint64 result = _xgetbv(in);
eax = result;
edx = result >> 32;
#elif defined(Q_CC_GNU)
asm (".byte 0x0F, 0x01, 0xD0" // xgetbv instruction asm (".byte 0x0F, 0x01, 0xD0" // xgetbv instruction
: "=a" (eax), "=d" (edx) : "=a" (eax), "=d" (edx)
: "c" (in)); : "c" (in));
#elif defined(Q_OS_WIN)
quint64 result = _xgetbv(in);
eax = result;
edx = result >> 32;
#endif #endif
} }