[PATCH 1/3] Add the recognization for Zhaoxin processors

DylanFan-oc DylanFan-oc at zhaoxin.com
Thu May 13 11:52:41 UTC 2021


I applied patch [Add Zhaoxin x86 processor support] with modifications.
And submit the following three patches.

This patch adds the detection for Zhaoxin CPU Vendor ID("CentaurHauls" and "  Shanghai  ")
and  adds the stepping information to distinguish between zxc and nano.

 acinclude.m4 |   2 +-
 config.guess |  20 +++++++++++++++++---
 config.sub   |   2 +-
 configure.ac |  18 ++++++++++++++++++
 4 files changed, 37 insertions(+), 5 deletions(-)

diff -r 632506b00743 acinclude.m4
--- a/acinclude.m4    Sat May 08 19:34:05 2021 +0200
+++ b/acinclude.m4    Wed May 12 14:45:12 2021 +0800
@@ -63,7 +63,7 @@
 [[i?86*-*-* | k[5-8]*-*-* | pentium*-*-* | athlon-*-* | viac3*-*-* | geode*-*-* | atom-*-*]])

 define(X86_64_PATTERN,
-[[athlon64-*-* | k8-*-* | k10-*-* | bobcat-*-* | jaguar*-*-* | bulldozer*-*-* | piledriver*-*-* | steamroller*-*-* | excavator*-*-* | zen*-*-* | pentium4-*-* | atom-*-* | silvermont-*-* | goldmont-*-* | core2-*-* | corei*-*-* | x86_64-*-* | nano-*-* | nehalem*-*-* | westmere*-*-* | sandybridge*-*-* | ivybridge*-*-* | haswell*-*-* | broadwell*-*-* | skylake*-*-* | kabylake*-*-* | icelake*-*-* | tigerlake*-*-* | rocketlake*-*-*]])
+[[athlon64-*-* | k8-*-* | k10-*-* | bobcat-*-* | jaguar*-*-* | bulldozer*-*-* | piledriver*-*-* | steamroller*-*-* | excavator*-*-* | zen*-*-* | pentium4-*-* | atom-*-* | silvermont-*-* | goldmont-*-* | core2-*-* | corei*-*-* | x86_64-*-* | nano-*-* | nehalem*-*-* | westmere*-*-* | sandybridge*-*-* | ivybridge*-*-* | haswell*-*-* | broadwell*-*-* | skylake*-*-* | kabylake*-*-* | icelake*-*-* | tigerlake*-*-* | rocketlake*-*-* | zxc-*-* | kx5000-*-* | kx6000-*-*]])

 dnl  GMP_FAT_SUFFIX(DSTVAR, DIRECTORY)
 dnl  ---------------------------------
diff -r 632506b00743 config.guess
--- a/config.guess    Sat May 08 19:34:05 2021 +0200
+++ b/config.guess    Wed May 12 14:45:12 2021 +0800
@@ -847,7 +847,7 @@
   char vendor_string[13];
   char feature_string[12];
   long fms;
-  int family, model;
+  int family, model, stepping;
   const char *modelstr, *suffix;
   int cpu_64bit = 0, cpu_avx = 0;
   int cpuid_64bit, cpuid_avx, cpuid_osxsave;
@@ -859,6 +859,7 @@

   family = ((fms >> 8) & 0xf) + ((fms >> 20) & 0xff);
   model = ((fms >> 4) & 0xf) + ((fms >> 12) & 0xf0);
+  stepping = (fms & 0xf);

   cpuid_avx     = (feature_string[11] >> 4) & 1;
   cpuid_osxsave = (feature_string[11] >> 3) & 1;
@@ -1023,14 +1024,27 @@
     {
       /* Should recognize Cyrix' processors too.  */
     }
-  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 < 9)    modelstr = "viac3";
       else if (model < 15)    modelstr = "viac32";
-      else            cpu_64bit = 1, modelstr = "nano";
+          else if (model == 15)
+            {
+              if (stepping < 0xE)
+                cpu_64bit=1, modelstr = "nano";
+              else cpu_64bit = 1, modelstr = "zxc";
+            }
+          else cpu_64bit=1, modelstr = "zxc";
+          break;
+        case 7:
+          if(model < 0x3B)
+            cpu_64bit = 1, cpu_avx = 1, modelstr = "kx5000";
+          else
+            cpu_64bit = 1, cpu_avx = 1, modelstr = "kx6000";
       break;
     }
     }
diff -r 632506b00743 config.sub
--- a/config.sub    Sat May 08 19:34:05 2021 +0200
+++ b/config.sub    Wed May 12 14:45:12 2021 +0800
@@ -102,7 +102,7 @@
   test_cpu=ia64 ;;
 pentium | pentiummmx | pentiumpro | pentium[234m] | k[567] | k6[23] | geode | athlon | viac3*)
   test_cpu=i386 ;;
-athlon64 | atom | silvermont | goldmont | core2 | corei* | opteron | k[89] | k10 | bobcat | jaguar* | bulldozer* | piledriver* | steamroller* | excavator* | zen* | nano | nehalem | westmere | sandybridge* | ivybridge* | haswell* | broadwell* | skylake* | kabylake* | icelake* | rocketlake* | tigerlake* | knightslanding)
+athlon64 | atom | silvermont | goldmont | core2 | corei* | opteron | k[89] | k10 | bobcat | jaguar* | bulldozer* | piledriver* | steamroller* | excavator* | zen* | nano | nehalem | westmere | sandybridge* | ivybridge* | haswell* | broadwell* | skylake* | kabylake* | icelake* | rocketlake* | tigerlake* | knightslanding | zxc | kx5000 | kx6000)
   test_cpu=x86_64 ;;
 power[2-9] | power2sc)
   test_cpu=power ;;
diff -r 632506b00743 configure.ac
--- a/configure.ac    Sat May 08 19:34:05 2021 +0200
+++ b/configure.ac    Wed May 12 14:45:12 2021 +0800
@@ -2000,6 +2000,24 @@
     path="x86/nano x86/mmx x86"
     path_64="x86_64/nano x86_64"
     ;;
+      zxc)
+        gcc_cflags_cpu="-mtune=k8"
+        gcc_cflags_arch="-march=k8"
+        path="x86/mmx x86"
+        path_64="x86_64/zxc x86_64/nano x86_64"
+        ;;
+      kx5000)
+        gcc_cflags_cpu="-mtune=k8"
+        gcc_cflags_arch="-march=k8"
+        path="x86/mmx x86"
+        path_64="x86_64/kx5000 x86_64/zxc x86_64/nano x86_64"
+        ;;
+      kx6000)
+        gcc_cflags_cpu="-mtune=k8"
+        gcc_cflags_arch="-march=k8"
+        path="x86/mmx x86"
+        path_64="x86_64/kx6000 x86_64/zxc x86_64/nano x86_64"
+        ;;
       *)
     gcc_cflags_cpu="-mtune=i486 -mcpu=i486 -m486"
     gcc_cflags_arch="-march=i486"





More information about the gmp-devel mailing list