From 48b7658c8aa49f5567dce0d4b0699761e206400c Mon Sep 17 00:00:00 2001 From: hrydgard Date: Wed, 26 Jan 2011 21:27:26 +0000 Subject: [PATCH] Detect cpu features AVX and AES, both are present on Sandy Bridge. For future use :P git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6925 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Common/Src/CPUDetect.cpp | 8 ++++++-- Source/Core/Common/Src/CPUDetect.h | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Source/Core/Common/Src/CPUDetect.cpp b/Source/Core/Common/Src/CPUDetect.cpp index 6db24026c6..195ffba249 100644 --- a/Source/Core/Common/Src/CPUDetect.cpp +++ b/Source/Core/Common/Src/CPUDetect.cpp @@ -144,10 +144,12 @@ void CPUInfo::Detect() } if ((cpu_id[3] >> 25) & 1) bSSE = true; if ((cpu_id[3] >> 26) & 1) bSSE2 = true; - if (cpu_id[2] & 1) bSSE3 = true; - if ((cpu_id[2] >> 9) & 1) bSSSE3 = true; + if ((cpu_id[2]) & 1) bSSE3 = true; + if ((cpu_id[2] >> 9) & 1) bSSSE3 = true; if ((cpu_id[2] >> 19) & 1) bSSE4_1 = true; if ((cpu_id[2] >> 20) & 1) bSSE4_2 = true; + if ((cpu_id[2] >> 29) & 1) bAVX = true; + if ((cpu_id[2] >> 25) & 1) bAES = true; } if (max_ex_fn >= 0x80000004) { // Extract brand string @@ -208,6 +210,8 @@ std::string CPUInfo::Summarize() if (bSSSE3) sum += ", SSSE3"; if (bSSE4_1) sum += ", SSE4.1"; if (bSSE4_2) sum += ", SSE4.2"; + if (bAVX) sum += ", AVX"; + if (bAES) sum += ", AES"; if (bLongMode) sum += ", 64-bit support"; return sum; } diff --git a/Source/Core/Common/Src/CPUDetect.h b/Source/Core/Common/Src/CPUDetect.h index e509b8038d..0cddb8d790 100644 --- a/Source/Core/Common/Src/CPUDetect.h +++ b/Source/Core/Common/Src/CPUDetect.h @@ -51,6 +51,8 @@ struct CPUInfo bool bSSE4_2; bool bLZCNT; bool bSSE4A; + bool bAVX; + bool bAES; bool bLAHFSAHF64; bool bLongMode; bool HTT;