[PATCH] [X86]: Fix zen6 AVX512BMM cpuid check.

Dipesh Sharma <[email protected]>
Newsgroups gmane.comp.gcc.patches
Message-ID <[email protected]>
Updated cpuid.h to move bit_AVX512BMM to the extended features section.

gcc/ChangeLog:

	* common/config/i386/cpuinfo.h (get_available_features): Detect AVX512BMM from extended features instead of standard leaf.
	* config/i386/cpuid.h (bit_AVX512BMM): Move to extended features
	  section.
---
 gcc/common/config/i386/cpuinfo.h | 12 ++----------
 gcc/config/i386/cpuid.h          |  4 +---
 2 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/gcc/common/config/i386/cpuinfo.h b/gcc/common/config/i386/cpuinfo.h
index fef8f90f94c..153ab194864 100644
--- a/gcc/common/config/i386/cpuinfo.h
+++ b/gcc/common/config/i386/cpuinfo.h
@@ -1110,16 +1110,6 @@ get_available_features (struct __processor_model *cpu_model,
 	}
     }

-  /* Get Advanced Features at level 0x21 (eax = 0x21).  */
-  if (max_cpuid_level >= 0x21)
-    {
-      __cpuid (0x21, eax, ebx, ecx, edx);
-      if (eax & bit_AVX512BMM)
-	{
-	  set_feature (FEATURE_AVX512BMM);
-	}
-    }
-
   /* Get Advanced Features at level 0x24 (eax = 0x24, ecx = 0).  */
   if (avx10_set && max_cpuid_level >= 0x24)
     {
@@ -1205,6 +1195,8 @@ get_available_features (struct __processor_model *cpu_model,
 	{
 	  set_feature (FEATURE_PREFETCHI);
 	}
+      if (eax & bit_AVX512BMM)
+	set_feature (FEATURE_AVX512BMM);
     }

 #undef set_feature
diff --git a/gcc/config/i386/cpuid.h b/gcc/config/i386/cpuid.h
index 5e1aad57d40..4a21672a9be 100644
--- a/gcc/config/i386/cpuid.h
+++ b/gcc/config/i386/cpuid.h
@@ -75,6 +75,7 @@
 /* Extended Features (%eax == 0x80000021) */
 /* %eax */
 #define bit_AMD_PREFETCHI (1 << 20)
+#define bit_AVX512BMM (1 << 23)

 /* Extended Features Leaf (%eax == 7, %ecx == 0) */
 /* %ebx */
@@ -167,9 +168,6 @@
 #define bit_AESKLE	( 1<<0 )
 #define bit_WIDEKL	( 1<<2 )

-/* Sub leaf (%eax == 0x21) */
-#define bit_AVX512BMM	( 1<<23 )
-
 /* AVX10 sub leaf (%eax == 0x24, %ecx == 1) */
 /* %ecx */
 #define bit_AVX10V2AUX	(1 << 3)
--
2.34.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.