ref: cf33d7031e3c823791ccd1dbf4eef20ada1039a6
parent: 2453042bf02e8c944105cd760998ff05bb44e22a
parent: b7fb9414c5b0d2afa23db76b58edff4b6a9e804e
author: zhilwang <zhilwang@cisco.com>
date: Tue May 12 20:37:56 EDT 2015
Merge pull request #1937 from brly/feature-detect-avx2 Add detection of AVX2
--- a/codec/common/inc/cpu_core.h
+++ b/codec/common/inc/cpu_core.h
@@ -67,6 +67,7 @@
#define WELS_CPU_MOVBE 0x00008000 /* MOVBE instruction */
#define WELS_CPU_AES 0x00010000 /* AES instruction extensions */
#define WELS_CPU_FMA 0x00020000 /* AVX VEX FMA instruction sets */
+#define WELS_CPU_AVX2 0x00040000 /* AVX2 */
#define WELS_CPU_CACHELINE_16 0x10000000 /* CacheLine Size 16 */
#define WELS_CPU_CACHELINE_32 0x20000000 /* CacheLine Size 32 */
--- a/codec/common/src/cpu.cpp
+++ b/codec/common/src/cpu.cpp
@@ -136,6 +136,15 @@
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