diff --git a/cmdline/speed.c b/cmdline/speed.c index fe993bc5..5bc866bc 100644 --- a/cmdline/speed.c +++ b/cmdline/speed.c @@ -119,11 +119,12 @@ void speed(int period, int nd, int size) raid_cpu_info(vendor, &family, &model); - printf("CPU %s, family %u, model %u, flags%s%s%s%s%s%s%s%s\n", vendor, family, model, + printf("CPU %s, family %u, model %u, flags%s%s%s%s%s%s%s%s%s\n", vendor, family, model, raid_cpu_has_sse2() ? " sse2" : "", raid_cpu_has_ssse3() ? " ssse3" : "", raid_cpu_has_crc32() ? " crc32" : "", raid_cpu_has_avx2() ? " avx2" : "", + raid_cpu_has_avx2gfni() ? " avx2gfni" : "", raid_cpu_has_avx512bw() ? " avx512bw" : "", raid_cpu_has_avx512gfni() ? " avx512gfni" : "", raid_cpu_has_slowmult() ? " slowmult" : "", diff --git a/raid/cpu.h b/raid/cpu.h index 886d82eb..e7eee142 100644 --- a/raid/cpu.h +++ b/raid/cpu.h @@ -183,6 +183,22 @@ static inline int raid_cpu_has_avx2(void) 3 << 1); /* XCR0: OS saves XMM and YMM registers */ } +static inline int raid_cpu_has_avx2gfni(void) +{ + /* + * Detection of AVX2 + GFNI: + * 1) Verify OSXSAVE and XGETBV (CPUID.1:ECX[27]) + * 2) Verify XCR0[2:1] = '11b' (XMM and YMM state enabled) + * 3) Verify AVX2 support (CPUID.7.0:EBX[5]) + * 4) Verify GFNI support (CPUID.7.0:ECX[8]) + */ + return raid_cpu_match_avx( + (1 << 27) | (1 << 28), /* Leaf 1, ECX: XSAVE and AVX */ + 1 << 5, /* Leaf 7, EBX: AVX2 */ + 1 << 8, /* Leaf 7, ECX: GFNI */ + 3 << 1); /* XCR0: OS saves XMM and YMM registers */ +} + static inline int raid_cpu_has_avx512bw(void) { /* diff --git a/raid/test/fulltest.c b/raid/test/fulltest.c index 58081fff..b2296393 100644 --- a/raid/test/fulltest.c +++ b/raid/test/fulltest.c @@ -37,6 +37,8 @@ int main(void) printf("Including x86 SSSE3 functions\n"); if (raid_cpu_has_avx2()) printf("Including x86 AVX2 functions\n"); + if (raid_cpu_has_avx512bw()) + printf("Including x86 AVX512BW functions\n"); #endif #ifdef CONFIG_X86_64 printf("Including x64 extended SSE register set\n"); diff --git a/raid/test/speedtest.c b/raid/test/speedtest.c index 60be4b76..cd0aad17 100644 --- a/raid/test/speedtest.c +++ b/raid/test/speedtest.c @@ -1020,8 +1020,6 @@ int main(void) printf("Including x86 AVX2 functions\n"); if (raid_cpu_has_avx512bw()) printf("Including x86 AVX512bw functions\n"); - if (raid_cpu_has_avx512gfni()) - printf("Including x86 AVX512gfni functions\n"); #endif #ifdef CONFIG_X86_64 printf("Including x64 extended SSE register set\n");