[PATCH 2/4] config.guess, configure.ac: Add detection of IBM z13

Marius Hillenbrand mhillen at linux.ibm.com
Wed Feb 17 10:19:57 UTC 2021


Detect IBM z13 and newer CPU generations by searching for the vector
facility's feature flag in /proc/cpuinfo.
---
 acinclude.m4 | 4 ++--
 config.guess | 8 +++++++-
 config.sub   | 4 ++--
 configure.ac | 9 +++++++++
 4 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/acinclude.m4 b/acinclude.m4
index 86175ce42..f69bea23f 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -54,10 +54,10 @@ define(POWERPC64_PATTERN,
 [[powerpc64-*-* | powerpc64le-*-* | powerpc620-*-* | powerpc630-*-* | powerpc970-*-* | power[3-9]-*-*]])
 
 define(S390_PATTERN,
-[[s390-*-* | z900esa-*-* | z990esa-*-* | z9esa-*-* | z10esa-*-* | z196esa-*-*]])
+[[s390-*-* | z900esa-*-* | z990esa-*-* | z9esa-*-* | z10esa-*-* | z196esa-*-* | z13esa-*-* ]])
 
 define(S390X_PATTERN,
-[[s390x-*-* | z900-*-* | z990-*-* | z9-*-* | z10-*-* | z196-*-*]])
+[[s390x-*-* | z900-*-* | z990-*-* | z9-*-* | z10-*-* | z196-*-* | z13-*-* ]])
 
 define(X86_PATTERN,
 [[i?86*-*-* | k[5-8]*-*-* | pentium*-*-* | athlon-*-* | viac3*-*-* | geode*-*-* | atom-*-*]])
diff --git a/config.guess b/config.guess
index c28e14080..d9513f8d2 100755
--- a/config.guess
+++ b/config.guess
@@ -1138,8 +1138,14 @@ s390*-*-*)
       2097 | 2098) zcpu="z10"  ;;
       2817 | 2818 | *) zcpu="z196" ;;
     esac
+    if grep -q "^features.* vx" /proc/cpuinfo; then
+      zcpu="z13"
+    fi
+
     case "$guess_full" in
-      s390x-*-*) exact_cpu=${zcpu}    ;;
+      s390x-*-*)
+	exact_cpu=${zcpu}
+      ;;
       s390-*-*)  exact_cpu=${zcpu}esa ;;
     esac
   fi
diff --git a/config.sub b/config.sub
index d1b76f765..9ce624ce6 100755
--- a/config.sub
+++ b/config.sub
@@ -122,9 +122,9 @@ ultrasparc | ultrasparc2 | ultrasparc2i | ultrasparc3 | ultrasparct[12345])
 sh2)
   test_cpu=sh ;;
 
-z900 | z990 | z9 | z10 | z196)
+z900 | z990 | z9 | z10 | z196 | z13)
   test_cpu=s390x;;
-z900esa | z990esa | z9esa | z10esa | z196esa)
+z900esa | z990esa | z9esa | z10esa | z196esa | z13esa)
   test_cpu=s390;;
 
 armsa1 | armxscale | arm9tdmi | arm9te |				\
diff --git a/configure.ac b/configure.ac
index e520df942..ab899fec2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -347,6 +347,7 @@ AH_VERBATIM([HAVE_HOST_CPU_1],
 #undef HAVE_HOST_CPU_s390_z9
 #undef HAVE_HOST_CPU_s390_z10
 #undef HAVE_HOST_CPU_s390_z196
+#undef HAVE_HOST_CPU_s390_z13
 
 /* Define to 1 iff we have a s390 with 64-bit registers.  */
 #undef HAVE_HOST_CPU_s390_zarch])
@@ -1395,6 +1396,11 @@ case $host in
 	gccarch="z196"
 	extra_functions=""
         ;;
+      z13)
+        cpu="z13"
+	gccarch="z13"
+	extra_functions=""
+	;;
       esac
 
       if test x"$cpu" != x ; then
@@ -1414,6 +1420,9 @@ case $host in
 	gcc_64_cflags="$gcc_cflags -m64"
 	path_64="s390_64/$host_cpu s390_64"
 	extra_functions=""
+	if test "$cpu" = "z13"; then
+	  gcc_64_cflags="$gcc_64_cflags -mzvector"
+	fi
 	;;
       esac
     ;;
-- 
2.26.2



More information about the gmp-devel mailing list