Signed-off-by: Christopher M. Riedl <c...@linux.ibm.com>
---
 configure.ac |  9 ++++++++-
 fat-ppc.c    | 12 ++++++++++++
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 253735a7..a0df0cc8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -101,6 +101,10 @@ AC_ARG_ENABLE(power-altivec,
   AC_HELP_STRING([--enable-power-altivec], [Enable POWER altivec and vsx 
extensions. (default=no)]),,
   [enable_power_altivec=no])
 
+AC_ARG_ENABLE(power-isa-30,
+  AC_HELP_STRING([--enable-power-isa-30], [Enable POWER ISA 3.0 (POWER9) 
features. (default=no)]),,
+  [enable_power_isa_30=no])
+
 AC_ARG_ENABLE(mini-gmp,
   AC_HELP_STRING([--enable-mini-gmp], [Enable mini-gmp, used instead of 
libgmp.]),,
   [enable_mini_gmp=no])
@@ -501,8 +505,11 @@ if test "x$enable_assembler" = xyes ; then
        if test "x$enable_fat" = xyes ; then
          asm_path="powerpc64/fat $asm_path"
          OPT_NETTLE_SOURCES="fat-ppc.c $OPT_NETTLE_SOURCES"
-         FAT_TEST_LIST="none crypto_ext altivec"
+         FAT_TEST_LIST="none crypto_ext altivec isa_30"
        else
+         if test "$enable_power_isa_30" = yes ; then
+           asm_path="powerpc64/p9 $asm_path"
+         fi
          if test "$enable_power_crypto_ext" = yes ; then
             asm_path="powerpc64/p8 $asm_path"
          fi
diff --git a/fat-ppc.c b/fat-ppc.c
index 3adbb88c..67ef46ab 100644
--- a/fat-ppc.c
+++ b/fat-ppc.c
@@ -78,11 +78,15 @@
 #ifndef PPC_FEATURE2_VEC_CRYPTO
 #define PPC_FEATURE2_VEC_CRYPTO 0x02000000
 #endif
+#ifndef PPC_FEATURE2_ARCH_3_00
+#define PPC_FEATURE2_ARCH_3_00 0x00800000
+#endif
 
 struct ppc_features
 {
   int have_crypto_ext;
   int have_altivec;
+  int have_isa_30;
 };
 
 #define MATCH(s, slen, literal, llen) \
@@ -94,6 +98,7 @@ get_ppc_features (struct ppc_features *features)
   const char *s;
   features->have_crypto_ext = 0;
   features->have_altivec = 0;
+  features->have_isa_30 = 0;
 
   s = secure_getenv (ENV_OVERRIDE);
   if (s)
@@ -106,6 +111,8 @@ get_ppc_features (struct ppc_features *features)
          features->have_crypto_ext = 1;
        else if (MATCH(s, length, "altivec", 7))
          features->have_altivec = 1;
+       else if (MATCH(s, length, "isa_30", 6))
+         features->have_isa_30 = 1;
        if (!sep)
          break;
        s = sep + 1;
@@ -116,6 +123,8 @@ get_ppc_features (struct ppc_features *features)
       features->have_crypto_ext
        = _system_configuration.implementation >= 0x10000u;
       features->have_altivec = _system_configuration.vmx_version > 1;
+      /* TODO: AIX magic bits to decode ISA 3.0 / POWER9 support */
+      features->have_isa_30 = 0;
 #else
       unsigned long hwcap = 0;
       unsigned long hwcap2 = 0;
@@ -141,6 +150,9 @@ get_ppc_features (struct ppc_features *features)
       features->have_altivec
        = ((hwcap & (PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_VSX))
           == (PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_VSX));
+
+      features->have_isa_30
+        = ((hwcap2 & PPC_FEATURE2_ARCH_3_00) == PPC_FEATURE2_ARCH_3_00);
 #endif
     }
 }
-- 
2.26.1

_______________________________________________
nettle-bugs mailing list
nettle-bugs@lists.lysator.liu.se
http://lists.lysator.liu.se/mailman/listinfo/nettle-bugs

Reply via email to