diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-01-13 03:18:33 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-01-13 03:18:33 +0300 |
commit | ba212fef9f998b7ed6be9834313c46087ba30c98 (patch) | |
tree | 4e4ea58244ea88b246d18a39db6c05313fc5773b /src | |
parent | 811479d52ba27e62a07f4a0c3a3d8d7ddae38ee7 (diff) | |
download | manaplus-ba212fef9f998b7ed6be9834313c46087ba30c98.tar.gz manaplus-ba212fef9f998b7ed6be9834313c46087ba30c98.tar.bz2 manaplus-ba212fef9f998b7ed6be9834313c46087ba30c98.tar.xz manaplus-ba212fef9f998b7ed6be9834313c46087ba30c98.zip |
Add into detected cpu features avx and avx2.
Diffstat (limited to 'src')
-rw-r--r-- | src/utils/cpu.cpp | 12 | ||||
-rw-r--r-- | src/utils/cpu.h | 4 |
2 files changed, 15 insertions, 1 deletions
diff --git a/src/utils/cpu.cpp b/src/utils/cpu.cpp index 6737b5261..e57956c06 100644 --- a/src/utils/cpu.cpp +++ b/src/utils/cpu.cpp @@ -51,6 +51,10 @@ void Cpu::detect() mCpuFlags |= FEATURE_SSE4; if (__builtin_cpu_supports ("sse4.2")) mCpuFlags |= FEATURE_SSE42; + if (__builtin_cpu_supports ("avx")) + mCpuFlags |= FEATURE_AVX; + if (__builtin_cpu_supports ("avx2")) + mCpuFlags |= FEATURE_AVX2; printFlags(); #elif defined(__linux__) || defined(__linux) FILE *file = fopen("/proc/cpuinfo", "r"); @@ -84,6 +88,10 @@ void Cpu::detect() mCpuFlags |= FEATURE_SSE4; else if (flag == "sse4_2") mCpuFlags |= FEATURE_SSE42; + else if (flag == "avx") + mCpuFlags |= FEATURE_AVX; + else if (flag == "avx2") + mCpuFlags |= FEATURE_AVX2; } fclose(file); printFlags(); @@ -114,5 +122,9 @@ void Cpu::printFlags() str.append(" sse4"); if (mCpuFlags & FEATURE_SSE42) str.append(" sse4_2"); + if (mCpuFlags & FEATURE_AVX) + str.append(" avx"); + if (mCpuFlags & FEATURE_AVX2) + str.append(" avx2"); logger->log(str); } diff --git a/src/utils/cpu.h b/src/utils/cpu.h index 1a81ca788..2780795bd 100644 --- a/src/utils/cpu.h +++ b/src/utils/cpu.h @@ -33,7 +33,9 @@ namespace Cpu FEATURE_SSE2 = 4, FEATURE_SSSE3 = 8, FEATURE_SSE4 = 16, - FEATURE_SSE42 = 32 + FEATURE_SSE42 = 32, + FEATURE_AVX = 64, + FEATURE_AVX2 = 128 }; void detect(); |