summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorJussi Kivilinna <jussi.kivilinna@iki.fi>2013-06-09 16:37:38 +0300
committerJussi Kivilinna <jussi.kivilinna@iki.fi>2013-06-09 16:37:42 +0300
commit3289bca708bdd02c69a331095ac6ca9a1efd74cc (patch)
tree6bbf91993a4566d7c018fa0ee20751d3ed2e7c0a /configure.ac
parentd325ab5d86e6107a46007a4d0131122bbd719f8c (diff)
downloadlibgcrypt-3289bca708bdd02c69a331095ac6ca9a1efd74cc.tar.gz
Add detection for Intel AVX2 instruction set
* configure.ac: Add option --disable-avx2-support. (HAVE_GCC_INLINE_ASM_AVX2): New. (ENABLE_AVX2_SUPPORT): New. * src/g10lib.h (HWF_INTEL_AVX2): New. * src/global.c (hwflist): Add HWF_INTEL_AVX2. * src/hwf-x86.c [__i386__] (get_cpuid): Initialize registers to zero before cpuid. [__x86_64__] (get_cpuid): Initialize registers to zero before cpuid. (detect_x86_gnuc): Store maximum cpuid level. (detect_x86_gnuc) [ENABLE_AVX2_SUPPORT]: Add detection for AVX2. -- Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac35
1 files changed, 35 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 8cb980c4..7fc7935c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -594,6 +594,14 @@ AC_ARG_ENABLE(avx-support,
avxsupport=$enableval,avxsupport=yes)
AC_MSG_RESULT($avxsupport)
+# Implementation of the --disable-avx2-support switch.
+AC_MSG_CHECKING([whether AVX2 support is requested])
+AC_ARG_ENABLE(avx2-support,
+ AC_HELP_STRING([--disable-avx2-support],
+ [Disable support for the Intel AVX2 instructions]),
+ avx2support=$enableval,avx2support=yes)
+AC_MSG_RESULT($avx2support)
+
# Implementation of the --disable-O-flag-munging switch.
AC_MSG_CHECKING([whether a -O flag munging is requested])
AC_ARG_ENABLE([O-flag-munging],
@@ -916,6 +924,23 @@ if test "$gcry_cv_gcc_inline_asm_avx" = "yes" ; then
fi
+#
+# Check whether GCC inline assembler supports AVX2 instructions
+#
+AC_CACHE_CHECK([whether GCC inline assembler supports AVX2 instructions],
+ [gcry_cv_gcc_inline_asm_avx2],
+ [gcry_cv_gcc_inline_asm_avx2=no
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE(
+ [[void a(void) {
+ __asm__("vpbroadcastb %%xmm7,%%ymm1\n\t":::);
+ }]])],
+ [gcry_cv_gcc_inline_asm_avx2=yes])])
+if test "$gcry_cv_gcc_inline_asm_avx2" = "yes" ; then
+ AC_DEFINE(HAVE_GCC_INLINE_ASM_AVX2,1,
+ [Defined if inline assembler supports AVX2 instructions])
+fi
+
+
#######################################
#### Checks for library functions. ####
#######################################
@@ -1165,6 +1190,11 @@ if test x"$avxsupport" = xyes ; then
avxsupport="no (unsupported by compiler)"
fi
fi
+if test x"$avx2support" = xyes ; then
+ if test "$gcry_cv_gcc_inline_asm_avx2" != "yes" ; then
+ avx2support="no (unsupported by compiler)"
+ fi
+fi
if test x"$aesnisupport" = xyes ; then
AC_DEFINE(ENABLE_AESNI_SUPPORT, 1,
@@ -1174,6 +1204,10 @@ if test x"$avxsupport" = xyes ; then
AC_DEFINE(ENABLE_AVX_SUPPORT,1,
[Enable support for Intel AVX instructions.])
fi
+if test x"$avx2support" = xyes ; then
+ AC_DEFINE(ENABLE_AVX2_SUPPORT,1,
+ [Enable support for Intel AVX2 instructions.])
+fi
# Define conditional sources and config.h symbols depending on the
@@ -1513,6 +1547,7 @@ GCRY_MSG_SHOW([Try using Padlock crypto: ],[$padlocksupport])
GCRY_MSG_SHOW([Try using AES-NI crypto: ],[$aesnisupport])
GCRY_MSG_SHOW([Try using DRNG (RDRAND): ],[$drngsupport])
GCRY_MSG_SHOW([Try using Intel AVX: ],[$avxsupport])
+GCRY_MSG_SHOW([Try using Intel AVX2: ],[$avx2support])
GCRY_MSG_SHOW([],[])
if test "$print_egd_notice" = "yes"; then