aboutsummaryrefslogtreecommitdiff
path: root/C/CpuArch.c
diff options
context:
space:
mode:
Diffstat (limited to 'C/CpuArch.c')
-rw-r--r--C/CpuArch.c24
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
22024-03-02 : Igor Pavlov : Public domain */ 22024-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:
667BoolInt CPU_IsSupported_AVX512F_AVX512VL(void) 666BoolInt 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
684BoolInt CPU_IsSupported_VAES_AVX2(void) 694BoolInt CPU_IsSupported_VAES_AVX2(void)
685{ 695{