[Patch 3/3] Add the recognition of Zhaoxin zxc\kx5000\kx6000 by fat

DylanFan-oc DylanFan-oc at zhaoxin.com
Tue Apr 6 02:04:24 UTC 2021


Add the recognition of Zhaoxin zxc\kx5000\kx6000 by fat

diff -r 746da45d51d8 -r 3e5db8cbbdbe configure.ac
--- a/configure.ac    Thu Apr 01 19:37:18 2021 +0800
+++ b/configure.ac    Thu Apr 01 19:38:41 2021 +0800
@@ -2355,7 +2355,8 @@
           x86_64/k8 x86_64/k10 x86_64/bd1 x86_64/bt1 x86_64/bt2 x86_64/zen
           x86_64/pentium4 x86_64/core2 x86_64/coreinhm x86_64/coreisbr
           x86_64/coreihwl x86_64/coreibwl x86_64/skylake x86_64/atom
-          x86_64/silvermont x86_64/goldmont x86_64/nano"
+          x86_64/silvermont x86_64/goldmont x86_64/nano
+                x86_64/zxc x86_64/kx5000 x86_64/kx6000"
     fat_functions="$fat_functions addmul_2 addlsh1_n addlsh2_n sublsh1_n"
       fi

diff -r 746da45d51d8 -r 3e5db8cbbdbe mpn/x86/fat/fat.c
--- a/mpn/x86/fat/fat.c    Thu Apr 01 19:37:18 2021 +0800
+++ b/mpn/x86/fat/fat.c    Thu Apr 01 19:38:41 2021 +0800
@@ -110,6 +110,9 @@
   { "viac3",      "CentaurHauls", MAKE_FMS (6, 0) },
   { "viac32",     "CentaurHauls", MAKE_FMS (6, 9) },
   { "nano",       "CentaurHauls", MAKE_FMS (6, 15) },
+  { "zxc",        "CentaurHauls", 0x000006FE },
+  { "kx5000",     "CentaurHauls", MAKE_FMS (7, 0x1b) },
+  { "kx6000",     "CentaurHauls", MAKE_FMS (7, 0x3b) },
 };

 static int
@@ -242,7 +245,7 @@
       char vendor_string[13];
       char dummy_string[12];
       long fms;
-      int family, model;
+      int family, model, stepping;

       __gmpn_cpuid (vendor_string, 0);
       vendor_string[12] = 0;
@@ -250,6 +253,7 @@
       fms = __gmpn_cpuid (dummy_string, 1);
       family = ((fms >> 8) & 0xf) + ((fms >> 20) & 0xff);
       model = ((fms >> 4) & 0xf) + ((fms >> 12) & 0xf0);
+      stepping = (fms & 0xf);

       if (strcmp (vendor_string, "GenuineIntel") == 0)
         {
@@ -488,7 +492,8 @@
           break;
             }
         }
-      else if (strcmp (vendor_string, "CentaurHauls") == 0)
+      else if (strcmp (vendor_string, "CentaurHauls") == 0 ||
+               strcmp (vendor_string, "  Shanghai  ") == 0)
         {
           switch (family)
             {
@@ -498,11 +503,34 @@
                 {
                   TRACE (printf ("  viac32\n"));
                 }
-          if (model >= 15)
+          if (model == 15)
         {
                   TRACE (printf ("  nano\n"));
           CPUVEC_SETUP_nano;
-        }
+                      if (stepping == 0xE)
+                     {
+                            TRACE(printf("  zxc\n"));
+                      }
+                      else
+                      {
+                            TRACE (printf ("  nano\n"));
+                            CPUVEC_SETUP_nano;
+                      }
+                     }
+                              if (model == 0x19)
+                    {
+                          TRACE(printf("  zxc\n"));
+                    }
+              break;
+              case 7:
+                  if(model == 0x1B)
+                  {
+                      TRACE(printf("  kx5000\n"));
+                  }
+                  else if (model == 0x3B)
+                  {
+                      TRACE(printf("  kx6000\n"));
+                  }
               break;
             }
         }
diff -r 746da45d51d8 -r 3e5db8cbbdbe mpn/x86_64/fat/fat.c
--- a/mpn/x86_64/fat/fat.c    Thu Apr 01 19:37:18 2021 +0800
+++ b/mpn/x86_64/fat/fat.c    Thu Apr 01 19:38:41 2021 +0800
@@ -94,6 +94,9 @@
   { "zen",        "AuthenticAMD", MAKE_FMS (23, 1) },

   { "nano",       "CentaurHauls", MAKE_FMS (6, 15) },
+  { "zxc",        "CentaurHauls", 0x000006FE },
+  { "kx5000",     "CentaurHauls", MAKE_FMS (7, 0x1b) },
+  { "kx6000",     "CentaurHauls", MAKE_FMS (7, 0x3b) },
 };

 static int
@@ -256,7 +259,7 @@
   char vendor_string[13];
   char dummy_string[12];
   long fms;
-  int family, model;
+  int family, model, stepping;

   TRACE (printf ("__gmpn_cpuvec_init:\n"));

@@ -271,6 +274,7 @@
   fms = __gmpn_cpuid (dummy_string, 1);
   family = ((fms >> 8) & 0xf) + ((fms >> 20) & 0xff);
   model = ((fms >> 4) & 0xf) + ((fms >> 12) & 0xf0);
+  stepping = (fms & 0xf);

   /* Check extended feature flags */
   __gmpn_cpuid (dummy_string, 0x80000001);
@@ -445,14 +449,53 @@
       break;
     }
     }
-  else if (strcmp (vendor_string, "CentaurHauls") == 0)
+  else if (strcmp (vendor_string, "CentaurHauls") == 0 ||
+           strcmp (vendor_string, "  Shanghai  ") == 0 )
     {
       switch (family)
     {
     case 6:
       if (model >= 15)
         CPUVEC_SETUP_nano;
+    if (model == 15)
+    {
+      if (stepping == 0xE)
+      {
+        TRACE(printf("  zxc\n"));
+        CPUVEC_SETUP_zen;
+        CPUVEC_SETUP_nano;
+        CPUVEC_SETUP_zxc;
+      }
+      else
+      {
+        TRACE (printf ("  nano\n"));
+        CPUVEC_SETUP_nano;
+      }
+    }
+    if (model == 0x19)
+    {
+      TRACE(printf("  zxc\n"));
+      CPUVEC_SETUP_zen;
+      CPUVEC_SETUP_nano;
+      CPUVEC_SETUP_zxc;
+    }
       break;
+    case 7:
+      if(model == 0x1B)
+      {
+        TRACE(printf("  kx5000\n"));
+        CPUVEC_SETUP_zen;
+        CPUVEC_SETUP_nano;
+        CPUVEC_SETUP_kx5000;
+      }
+      else if (model == 0x3B)
+      {
+        TRACE(printf("  kx6000\n"));
+        CPUVEC_SETUP_zen;
+        CPUVEC_SETUP_nano;
+        CPUVEC_SETUP_kx6000;
+      }
+      break;
     }
     }



More information about the gmp-devel mailing list