diff --git a/common_audio/resampler/sinc_resampler.cc b/common_audio/resampler/sinc_resampler.cc index fac11aa362..66a99b6190 100644 --- a/common_audio/resampler/sinc_resampler.cc +++ b/common_audio/resampler/sinc_resampler.cc @@ -126,8 +126,8 @@ void SincResampler::InitializeCPUSpecificFeatures() { #if defined(WEBRTC_HAS_NEON) convolve_proc_ = Convolve_NEON; #elif defined(WEBRTC_ARCH_X86_FAMILY) - // Using AVX2 instead of SSE2 when AVX2 supported. - if (GetCPUInfo(kAVX2)) + // Using AVX2 instead of SSE2 when AVX2/FMA3 supported. + if (GetCPUInfo(kAVX2) && GetCPUInfo(kFMA3)) convolve_proc_ = Convolve_AVX2; else if (GetCPUInfo(kSSE2)) convolve_proc_ = Convolve_SSE; diff --git a/system_wrappers/include/cpu_features_wrapper.h b/system_wrappers/include/cpu_features_wrapper.h index 612b4a5d6b..254e2d8dda 100644 --- a/system_wrappers/include/cpu_features_wrapper.h +++ b/system_wrappers/include/cpu_features_wrapper.h @@ -16,7 +16,7 @@ namespace webrtc { // List of features in x86. -typedef enum { kSSE2, kSSE3, kAVX2 } CPUFeature; +typedef enum { kSSE2, kSSE3, kAVX2, kFMA3 } CPUFeature; // List of features in ARM. enum { diff --git a/system_wrappers/source/cpu_features.cc b/system_wrappers/source/cpu_features.cc index b676339eea..8cd701eb41 100644 --- a/system_wrappers/source/cpu_features.cc +++ b/system_wrappers/source/cpu_features.cc @@ -103,6 +103,9 @@ int GetCPUInfo(CPUFeature feature) { (cpu_info7[1] & 0x00000100) != 0 /* BMI2 */; } #endif // WEBRTC_ENABLE_AVX2 + if (feature == kFMA3) { + return 0 != (cpu_info[2] & 0x00001000); + } return 0; } #else