Commit 004954c9 authored by Frank Barchard's avatar Frank Barchard Committed by Frank Barchard

cpu disables for AVX 512 and unittest show decimal

Change unittest flags to decimal so they can be used for --libyuv_cpu_info=
Add environment variables to disable AVX 512 bits.

Bug: libyuv:784
Test: LibYUVBaseTest.TestCpuHas
Change-Id: Iea6704368fbe9f6d3395933da7993fb2a3453225
Reviewed-on: https://chromium-review.googlesource.com/957704Reviewed-by: 's avatarrichard winterton <rrwinterton@gmail.com>
parent 1d509f21
......@@ -287,7 +287,24 @@ static SAFEBUFFERS int GetCpuFlags(void) {
if (TestEnv("LIBYUV_DISABLE_AVX512BW")) {
cpu_info &= ~kCpuHasAVX512BW;
}
if (TestEnv("LIBYUV_DISABLE_AVX512VL")) {
cpu_info &= ~kCpuHasAVX512VL;
}
if (TestEnv("LIBYUV_DISABLE_AVX512VBMI")) {
cpu_info &= ~kCpuHasAVX512VBMI;
}
if (TestEnv("LIBYUV_DISABLE_AVX512VBMI2")) {
cpu_info &= ~kCpuHasAVX512VBMI2;
}
if (TestEnv("LIBYUV_DISABLE_AVX512VBITALG")) {
cpu_info &= ~kCpuHasAVX512VBITALG;
}
if (TestEnv("LIBYUV_DISABLE_AVX512VPOPCNTDQ")) {
cpu_info &= ~kCpuHasAVX512VPOPCNTDQ;
}
if (TestEnv("LIBYUV_DISABLE_GFNI")) {
cpu_info &= ~kCpuHasGFNI;
}
#endif
#if defined(__mips__) && defined(__linux__)
#if defined(__mips_msa)
......
......@@ -20,12 +20,12 @@ namespace libyuv {
TEST_F(LibYUVBaseTest, TestCpuHas) {
int cpu_flags = TestCpuFlag(-1);
printf("Cpu Flags %x\n", cpu_flags);
printf("Cpu Flags %d\n", cpu_flags);
#if defined(__arm__) || defined(__aarch64__)
int has_arm = TestCpuFlag(kCpuHasARM);
printf("Has ARM %x\n", has_arm);
printf("Has ARM %d\n", has_arm);
int has_neon = TestCpuFlag(kCpuHasNEON);
printf("Has NEON %x\n", has_neon);
printf("Has NEON %d\n", has_neon);
#endif
int has_x86 = TestCpuFlag(kCpuHasX86);
int has_sse2 = TestCpuFlag(kCpuHasSSE2);
......@@ -44,29 +44,29 @@ TEST_F(LibYUVBaseTest, TestCpuHas) {
int has_avx512vbmi2 = TestCpuFlag(kCpuHasAVX512VBMI2);
int has_avx512vbitalg = TestCpuFlag(kCpuHasAVX512VBITALG);
int has_avx512vpopcntdq = TestCpuFlag(kCpuHasAVX512VPOPCNTDQ);
printf("Has X86 %x\n", has_x86);
printf("Has SSE2 %x\n", has_sse2);
printf("Has SSSE3 %x\n", has_ssse3);
printf("Has SSE4.1 %x\n", has_sse41);
printf("Has SSE4.2 %x\n", has_sse42);
printf("Has AVX %x\n", has_avx);
printf("Has AVX2 %x\n", has_avx2);
printf("Has ERMS %x\n", has_erms);
printf("Has FMA3 %x\n", has_fma3);
printf("Has F16C %x\n", has_f16c);
printf("Has GFNI %x\n", has_gfni);
printf("Has AVX512BW %x\n", has_avx512bw);
printf("Has AVX512VL %x\n", has_avx512vl);
printf("Has AVX512VBMI %x\n", has_avx512vbmi);
printf("Has AVX512VBMI2 %x\n", has_avx512vbmi2);
printf("Has AVX512VBITALG %x\n", has_avx512vbitalg);
printf("Has AVX512VPOPCNTDQ %x\n", has_avx512vpopcntdq);
printf("Has X86 %d\n", has_x86);
printf("Has SSE2 %d\n", has_sse2);
printf("Has SSSE3 %d\n", has_ssse3);
printf("Has SSE41 %d\n", has_sse41);
printf("Has SSE42 %d\n", has_sse42);
printf("Has AVX %d\n", has_avx);
printf("Has AVX2 %d\n", has_avx2);
printf("Has ERMS %d\n", has_erms);
printf("Has FMA3 %d\n", has_fma3);
printf("Has F16C %d\n", has_f16c);
printf("Has GFNI %d\n", has_gfni);
printf("Has AVX512BW %d\n", has_avx512bw);
printf("Has AVX512VL %d\n", has_avx512vl);
printf("Has AVX512VBMI %d\n", has_avx512vbmi);
printf("Has AVX512VBMI2 %d\n", has_avx512vbmi2);
printf("Has AVX512VBITALG %d\n", has_avx512vbitalg);
printf("Has AVX512VPOPCNTDQ %d\n", has_avx512vpopcntdq);
#if defined(__mips__)
int has_mips = TestCpuFlag(kCpuHasMIPS);
printf("Has MIPS %x\n", has_mips);
printf("Has MIPS %d\n", has_mips);
int has_msa = TestCpuFlag(kCpuHasMSA);
printf("Has MSA %x\n", has_msa);
printf("Has MSA %d\n", has_msa);
#endif
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment