liboqs/config/cpu_features.m4
Nir Drucker d3ff24cd31 Add BIKE to master and some autotools/Makefiles changes (#333)
* Supporting BIKE KEM reference code

* Hiding print global symbol when VERBOSE!=2

* Supporting USE_OPENSSL + OPENSSL_DIR

* - The file config/.gitkeep is no longer needed its purpose was to allow git having an empty folder (config).
- Moved the file acinclude.m4 to the config directory (where all the *.m4 files are).
- Added .travis/defs.sh - this file holds common definitions used by travis scripts.
- Changed style-check to first check for clang-format only then handle modified files.
- Sodium support is no longer required.
- Breaked configure.ac into sub m4 files
- Sorted the flags list.
- Changed FrodoKEM to Frodo for consistency with SIKE and BIKE. Note that it is already under the KEM directory.
- Chaned USE_* protocl flags to ENABLE_* for consistency
- Adjaust most of the makefile to have a consistent compilation flags
- Added some more compilation warnings.

* Rename functions by using a legend instead of the FN() macro

* prettyprint

* 1) Some more Makefiles cleanup 2)Adding OQS_API defnition - hidding other symbols

* Reverting frodo renaming

* Reverting the checks order.

* Removing NEW_API.md

* pretty print

* 1)Disable bad warnings on gcc4.8/4.9 2) Disable all warnings on SIKE

* Disable the cast-align warning for now

* Documentation

* 1) Reenable BIKE error messages
2) Auto detection of AVX/AVX2/BMI features.

* Enable AVX features only on X86_64 Linux platforms

* Adding BIKE additional implementation for Linux(x86_64) and GCC

* Fixing configure.ac when OpenSSL is disabled

* Enabling BIKE's AVX512 implementation

* Wrap AVX512 code with ifdef

* Changes from code review

* Prettyprint

* Fix typo

* Rename symbol
2018-08-14 13:07:16 -04:00

55 lines
1.5 KiB
Plaintext

AC_DEFUN([AX_X86_CPU_SUPPORTS],
[AC_REQUIRE([AC_PROG_CC])
AM_COND_IF([X86_64],[
AC_LANG_PUSH([C])
AS_VAR_PUSHDEF([x86_feature], [AS_TR_SH([ax_cv_x86_cpu_supports_$1])])
AC_CACHE_CHECK([for x86 $1 instruction support],
[x86_feature],
[AC_RUN_IFELSE(
[AC_LANG_PROGRAM( [#include <stdlib.h> ],
[ #if defined(__GNUC__) && !defined(__clang__)
__builtin_cpu_init ();
#endif
if (__builtin_cpu_supports("$1"))
{
return 0;
}
return 1;
])],
[x86_feature=yes],
[x86_feature=no]
)]
)
AC_LANG_POP([C])
AM_CONDITIONAL(m4_toupper([USE_$1_INSTRUCTIONS]), [test x$x86_feature = xyes])
AS_VAR_IF([x86_feature],[yes],
[AC_DEFINE(
AS_TR_CPP([USE_$1_INSTRUCTIONS]),
[1],
[Define if $1 instructions are supported])
$2],
[$3]
)
AS_VAR_POPDEF([x86_feature])
],
[AM_CONDITIONAL(m4_toupper([USE_$1_INSTRUCTIONS]), [false])]
)
])
AC_DEFUN([AX_CHECK_X86_FEATURES],
[m4_foreach_w(
[ax_x86_feature],
[mmx popcnt sse sse2 sse3 sse4a sse5 avx avx2 avx512f fma fma4 bmi bmi2
avx512bw avx512cd avx512dq avx512er avx512ifma avx512pf avx512vbmi],
[AX_X86_CPU_SUPPORTS(ax_x86_feature,
[X86_FEATURE_CFLAGS="$X86_FEATURE_CFLAGS -m[]ax_x86_feature"],
[])
])
AC_SUBST([X86_FEATURE_CFLAGS])
m4_ifval([$1],[$1],
[CFLAGS="$CFLAGS $X86_FEATURE_CFLAGS"])
$2
])