https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100758

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #14 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Given the above dumps, wouldn't it be just a matter of:
--- gcc/common/config/i386/cpuinfo.h.jj 2023-01-16 11:52:15.910736614 +0100
+++ gcc/common/config/i386/cpuinfo.h    2023-02-09 12:30:31.430185107 +0100
@@ -601,8 +601,8 @@ get_intel_cpu (struct __processor_model

 static inline const char *
 get_zhaoxin_cpu (struct __processor_model *cpu_model,
-               struct __processor_model2 *cpu_model2,
-               unsigned int *cpu_features2)
+                struct __processor_model2 *cpu_model2,
+                unsigned int *cpu_features2)
 {
   const char *cpu = NULL;
   unsigned int family = cpu_model2->__cpu_family;
@@ -1057,24 +1057,27 @@ cpu_indicator_init (struct __processor_m
       cpu_model->__cpu_vendor = VENDOR_AMD;
     }
   else if (vendor == signature_CENTAUR_ebx && family < 0x07)
-    cpu_model->__cpu_vendor = VENDOR_CENTAUR;
+    {
+      /* Find available features. */
+      get_available_features (cpu_model, cpu_model2, cpu_features2,
+                             ecx, edx);
+      cpu_model->__cpu_vendor = VENDOR_CENTAUR;
+    }
   else if (vendor == signature_SHANGHAI_ebx
-               || vendor == signature_CENTAUR_ebx)
+          || vendor == signature_CENTAUR_ebx)
     {
       /* Adjust model and family for ZHAOXIN CPUS.  */
       if (family == 0x07)
-       {
-         model += extended_model;
-       }
+       model += extended_model;

       cpu_model2->__cpu_family = family;
       cpu_model2->__cpu_model = model;

       /* Find available features.  */
       get_available_features (cpu_model, cpu_model2, cpu_features2,
-                                 ecx, edx);
+                             ecx, edx);
       /* Get CPU type.  */
-      get_zhaoxin_cpu (cpu_model, cpu_model2,cpu_features2);
+      get_zhaoxin_cpu (cpu_model, cpu_model2, cpu_features2);
       cpu_model->__cpu_vendor = VENDOR_ZHAOXIN;
     }
   else if (vendor == signature_CYRIX_ebx)

The important part just adding get_available_features for the VENDOR_CENTAUR
case (otherwise I've just fixed up the messed up formatting of the Zhaoxin
stuff).
In fact, I wonder why get_available_features isn't called unconditionally for
all CPUs that support at least max level >= 1.  Or is the worry that
some CPUs might misbehave on CPUID 0x80000000 leaf?

Reply via email to