diff options
author | Igor Pavlov <87184205+ip7z@users.noreply.github.com> | 2024-05-26 00:00:00 +0000 |
---|---|---|
committer | Igor Pavlov <87184205+ip7z@users.noreply.github.com> | 2024-05-27 12:41:10 +0500 |
commit | 89a73b901229c8550c172c9556ff8442ae7ac4b8 (patch) | |
tree | 00bf950adf3b20f36efe4ffa1065676869b040a5 /C/CpuArch.c | |
parent | fc662341e6f85da78ada0e443f6116b978f79f22 (diff) | |
download | 7zip-24.06.tar.gz 7zip-24.06.tar.bz2 7zip-24.06.zip |
24.0624.06
Diffstat (limited to 'C/CpuArch.c')
-rw-r--r-- | C/CpuArch.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/C/CpuArch.c b/C/CpuArch.c index d51b38a..c131a68 100644 --- a/C/CpuArch.c +++ b/C/CpuArch.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* CpuArch.c -- CPU specific code | 1 | /* CpuArch.c -- CPU specific code |
2 | 2024-03-02 : Igor Pavlov : Public domain */ | 2 | 2024-05-18 : Igor Pavlov : Public domain */ |
3 | 3 | ||
4 | #include "Precomp.h" | 4 | #include "Precomp.h" |
5 | 5 | ||
@@ -638,7 +638,7 @@ BoolInt CPU_IsSupported_AVX(void) | |||
638 | 638 | ||
639 | { | 639 | { |
640 | const UInt32 bm = (UInt32)x86_xgetbv_0(MY_XCR_XFEATURE_ENABLED_MASK); | 640 | const UInt32 bm = (UInt32)x86_xgetbv_0(MY_XCR_XFEATURE_ENABLED_MASK); |
641 | // printf("\n=== XGetBV=%d\n", bm); | 641 | // printf("\n=== XGetBV=0x%x\n", bm); |
642 | return 1 | 642 | return 1 |
643 | & (BoolInt)(bm >> 1) // SSE state is supported (set by OS) for storing/restoring | 643 | & (BoolInt)(bm >> 1) // SSE state is supported (set by OS) for storing/restoring |
644 | & (BoolInt)(bm >> 2); // AVX state is supported (set by OS) for storing/restoring | 644 | & (BoolInt)(bm >> 2); // AVX state is supported (set by OS) for storing/restoring |
@@ -662,8 +662,7 @@ BoolInt CPU_IsSupported_AVX2(void) | |||
662 | } | 662 | } |
663 | } | 663 | } |
664 | 664 | ||
665 | /* | 665 | #if 0 |
666 | // fix it: | ||
667 | BoolInt CPU_IsSupported_AVX512F_AVX512VL(void) | 666 | BoolInt CPU_IsSupported_AVX512F_AVX512VL(void) |
668 | { | 667 | { |
669 | if (!CPU_IsSupported_AVX()) | 668 | if (!CPU_IsSupported_AVX()) |
@@ -672,14 +671,25 @@ BoolInt CPU_IsSupported_AVX512F_AVX512VL(void) | |||
672 | return False; | 671 | return False; |
673 | { | 672 | { |
674 | UInt32 d[4]; | 673 | UInt32 d[4]; |
674 | BoolInt v; | ||
675 | z7_x86_cpuid(d, 7); | 675 | z7_x86_cpuid(d, 7); |
676 | // printf("\ncpuid(7): ebx=%8x ecx=%8x\n", d[1], d[2]); | 676 | // printf("\ncpuid(7): ebx=%8x ecx=%8x\n", d[1], d[2]); |
677 | v = 1 | ||
678 | & (BoolInt)(d[1] >> 16) // avx512f | ||
679 | & (BoolInt)(d[1] >> 31); // avx512vl | ||
680 | if (!v) | ||
681 | return False; | ||
682 | } | ||
683 | { | ||
684 | const UInt32 bm = (UInt32)x86_xgetbv_0(MY_XCR_XFEATURE_ENABLED_MASK); | ||
685 | // printf("\n=== XGetBV=0x%x\n", bm); | ||
677 | return 1 | 686 | return 1 |
678 | & (BoolInt)(d[1] >> 16) // avx512-f | 687 | & (BoolInt)(bm >> 5) // OPMASK |
679 | & (BoolInt)(d[1] >> 31); // avx512-Vl | 688 | & (BoolInt)(bm >> 6) // ZMM upper 256-bit |
689 | & (BoolInt)(bm >> 7); // ZMM16 ... ZMM31 | ||
680 | } | 690 | } |
681 | } | 691 | } |
682 | */ | 692 | #endif |
683 | 693 | ||
684 | BoolInt CPU_IsSupported_VAES_AVX2(void) | 694 | BoolInt CPU_IsSupported_VAES_AVX2(void) |
685 | { | 695 | { |