This source file includes following definitions.
- TEST
#include "base/cpu.h"
#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"
TEST(CPU, RunExtendedInstructions) {
#if defined(ARCH_CPU_X86_FAMILY)
base::CPU cpu;
#if defined(OS_WIN) && !defined(_M_X64)
ASSERT_TRUE(cpu.has_mmx());
__asm emms;
if (cpu.has_sse()) {
__asm xorps xmm0, xmm0;
}
if (cpu.has_sse2()) {
__asm psrldq xmm0, 0;
}
if (cpu.has_sse3()) {
__asm addsubpd xmm0, xmm0;
}
if (cpu.has_ssse3()) {
__asm psignb xmm0, xmm0;
}
if (cpu.has_sse41()) {
__asm pmuldq xmm0, xmm0;
}
if (cpu.has_sse42()) {
__asm crc32 eax, eax;
}
#elif defined(OS_POSIX) && defined(__x86_64__)
ASSERT_TRUE(cpu.has_mmx());
__asm__ __volatile__("emms\n" : : : "mm0");
if (cpu.has_sse()) {
__asm__ __volatile__("xorps %%xmm0, %%xmm0\n" : : : "xmm0");
}
if (cpu.has_sse2()) {
__asm__ __volatile__("psrldq $0, %%xmm0\n" : : : "xmm0");
}
if (cpu.has_sse3()) {
__asm__ __volatile__("addsubpd %%xmm0, %%xmm0\n" : : : "xmm0");
}
if (cpu.has_ssse3()) {
__asm__ __volatile__("psignb %%xmm0, %%xmm0\n" : : : "xmm0");
}
if (cpu.has_sse41()) {
__asm__ __volatile__("pmuldq %%xmm0, %%xmm0\n" : : : "xmm0");
}
if (cpu.has_sse42()) {
__asm__ __volatile__("crc32 %%eax, %%eax\n" : : : "eax");
}
#endif
#endif
}