Add detection of AVX2

This commit is contained in:
brly
2015-05-10 20:03:41 +09:00
parent f1d1af0d34
commit b7fb9414c5
2 changed files with 10 additions and 0 deletions

View File

@@ -136,6 +136,15 @@ uint32_t WelsCPUFeatureDetect (int32_t* pNumberOfLogicProcessors) {
uiCPU |= WELS_CPU_MOVBE;
}
if (uiMaxCpuidLevel >= 7) {
uiFeatureC = 0;
WelsCPUId (7, &uiFeatureA, &uiFeatureB, &uiFeatureC, &uiFeatureD);
if ((uiCPU & WELS_CPU_AVX) && (uiFeatureB & 0x00000020)) {
/* AVX2 supported */
uiCPU |= WELS_CPU_AVX2;
}
}
if (pNumberOfLogicProcessors != NULL) {
if (uiCPU & WELS_CPU_HTT) {
*pNumberOfLogicProcessors = (uiFeatureB & 0x00ff0000) >> 16; // feature bits: 23-16 on returned EBX