mirror of
https://github.com/ARMSX2/ARMSX2.git
synced 2026-08-24 16:50:16 -07:00
x86emitter: Don't use xgetbv
All OSes now support AVX
This commit is contained in:
@@ -34,7 +34,6 @@
|
||||
|
||||
#define cpuid __cpuid
|
||||
#define cpuidex __cpuidex
|
||||
#define xgetbv _xgetbv
|
||||
|
||||
#else
|
||||
|
||||
@@ -50,21 +49,6 @@ static __inline__ __attribute__((always_inline)) void cpuid(int CPUInfo[], const
|
||||
__cpuid(InfoType, CPUInfo[0], CPUInfo[1], CPUInfo[2], CPUInfo[3]);
|
||||
}
|
||||
|
||||
#if defined(__clang__) || __GNUC__ < 8 || (__GNUC__ == 8 && __GNUC_MINOR__ < 2)
|
||||
// _xgetbv on gcc 8.1 is broken (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85684).
|
||||
// It also isn't present on clang and earlier versions of gcc.
|
||||
static __inline__ __attribute__((always_inline)) unsigned long long xgetbv(unsigned int index)
|
||||
{
|
||||
unsigned int eax, edx;
|
||||
__asm__ __volatile__("xgetbv"
|
||||
: "=a"(eax), "=d"(edx)
|
||||
: "c"(index));
|
||||
return ((unsigned long long)edx << 32) | eax;
|
||||
}
|
||||
#else
|
||||
#define xgetbv _xgetbv
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
// Rotate instruction
|
||||
|
||||
@@ -297,12 +297,12 @@ void x86capabilities::Identify()
|
||||
|
||||
if ((Flags2 >> 27) & 1) // OSXSAVE
|
||||
{
|
||||
if ((xgetbv(0) & 6) == 6) // XFEATURE_ENABLED_MASK[2:1] = '11b' (XMM state and YMM state are enabled by OS).
|
||||
{
|
||||
hasAVX = (Flags2 >> 28) & 1; //avx
|
||||
hasFMA = (Flags2 >> 12) & 1; //fma
|
||||
hasAVX2 = (SEFlag >> 5) & 1; //avx2
|
||||
}
|
||||
// Note: In theory, we should use xgetbv to check OS support
|
||||
// but all OSes we officially run under support it
|
||||
// and its intrinsic requires extra compiler flags
|
||||
hasAVX = (Flags2 >> 28) & 1; //avx
|
||||
hasFMA = (Flags2 >> 12) & 1; //fma
|
||||
hasAVX2 = (SEFlag >> 5) & 1; //avx2
|
||||
}
|
||||
|
||||
hasBMI1 = (SEFlag >> 3) & 1;
|
||||
|
||||
Reference in New Issue
Block a user