diff --git a/Source/Shared/GlobalFunctions.cpp b/Source/Shared/GlobalFunctions.cpp index 5491cc6..770af3d 100644 --- a/Source/Shared/GlobalFunctions.cpp +++ b/Source/Shared/GlobalFunctions.cpp @@ -8,6 +8,9 @@ #ifdef PLATFORM_ANDROID #include #endif +#ifdef __GNUC__ + #include +#endif namespace APE { @@ -118,6 +121,14 @@ bool GetMMXAvailable() if (cpuInfo[3] & CPU_MMX) bMMX = true; } +#elif defined(__GNUC__) + uint eax, ebx, ecx, edx; + + if (__get_cpuid (1, &eax, &ebx, &ecx, &edx)) + { + if (edx & bit_MMX) + bMMX = true; + } #endif return bMMX; #endif @@ -153,6 +164,22 @@ bool GetSSEAvailable(bool bTestForSSE41) bSSE = true; } } +#elif defined(__GNUC__) + uint eax, ebx, ecx, edx; + + if (__get_cpuid (1, &eax, &ebx, &ecx, &edx)) + { + if (bTestForSSE41) + { + if (edx & bit_SSE41) + bSSE = true; + } + else + { + if (edx & bit_SSE2) + bSSE = true; + } + } #endif return bSSE; #endif @@ -166,7 +193,6 @@ bool GetAVX2Available() bool bAVX = false; #if defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64)) #define CPU_AVX2 (1 << 5) - int cpuInfo[4] = { 0 }; __cpuid(cpuInfo, 0); @@ -177,6 +203,14 @@ bool GetAVX2Available() if (cpuInfo[1] & CPU_AVX2) bAVX = true; } +#elif defined(__GNUC__) + uint eax, ebx, ecx, edx; + + if (__get_cpuid (7, &eax, &ebx, &ecx, &edx)) + { + if (ebx & bit_AVX2) + bAVX = true; + } #endif return bAVX; #endif