#include "rtc_base/system/arch.h"
#include "system_wrappers/include/cpu_features_wrapper.h"
#if defined(WEBRTC_ARCH_X86_FAMILY) && defined(_MSC_VER)
#include <intrin.h>
#endif
namespace webrtc {
int GetCPUInfoNoASM(CPUFeature feature) { … }
#if defined(WEBRTC_ARCH_X86_FAMILY)
#if defined(WEBRTC_ENABLE_AVX2)
static uint64_t xgetbv(uint32_t xcr) { … }
#endif
#ifndef _MSC_VER
#if defined(__pic__) && defined(__i386__)
static inline void __cpuid(int cpu_info[4], int info_type) {
__asm__ volatile(
"mov %%ebx, %%edi\n"
"cpuid\n"
"xchg %%edi, %%ebx\n"
: "=a"(cpu_info[0]), "=D"(cpu_info[1]), "=c"(cpu_info[2]),
"=d"(cpu_info[3])
: "a"(info_type));
}
#else
static inline void __cpuid(int cpu_info[4], int info_type) { … }
#endif
#endif
#endif
#if defined(WEBRTC_ARCH_X86_FAMILY)
int GetCPUInfo(CPUFeature feature) { … }
#else
int GetCPUInfo(CPUFeature feature) {
(void)feature;
return 0;
}
#endif
}