From 0f6f1d1556848fc2503b88f83999031779d47d10 Mon Sep 17 00:00:00 2001 From: Florian Ballenegger Date: Thu, 6 Aug 2020 17:56:38 +0200 Subject: [PATCH] adjust configure with SLEEF --- configure.ac | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index e2d83fc32..af6e120bc 100644 --- a/configure.ac +++ b/configure.ac @@ -1188,6 +1188,10 @@ fi AC_ARG_ENABLE([modsimd], [AS_HELP_STRING([--enable-modsimd], [Enable simd acceleration in some device models])]) +# --with-sleef: Use SLEEF vector math library. Default is "no". +AC_ARG_WITH([sleef], + [AS_HELP_STRING([--with-sleef[=yes/no]], [Use SLEEF vector math library in SIMD models. Default=no.])]) + if test "x$enable_modsimd" = xyes; then OPENMPSIMD_CFLAGS="-fopenmp-simd" @@ -1227,10 +1231,26 @@ if test "x$enable_modsimd" = xyes; then have_intrinsics=no ]) have_libmvec=no + have_sleef=no fi -# test if we can use libmvec or equivalent +# do we want to use SLEEF ? +if test "x$enable_modsimd" = xyes; then + if test "x$with_sleef" = xyes; then + AC_CHECK_HEADERS([sleef.h]) + AC_CHECK_LIB([sleef], [Sleef_logd4_u35], + [AC_DEFINE([HAVE_LIBSLEEF], [], [Have SLEEF vector math library]) + LIBS="$LIBS -lsleef" + have_sleef=yes + AC_MSG_RESULT([Use SLEEF]) + ], [have_sleef=no] + ) + fi +fi + +# otherwise test if we can use libmvec or equivalent if test "x$have_intrinsics" = xyes; then +if test "x$have_sleef" != xyes; then AC_MSG_CHECKING([vector math library]) AC_LINK_IFELSE( [ @@ -1254,6 +1274,7 @@ if test "x$have_intrinsics" = xyes; then have_libmvec=no ]) fi +fi # adjust compiler flags for MODSIMD if test "x$enable_modsimd" = xyes; then @@ -1294,6 +1315,12 @@ if test "x$enable_modsimd" = xyes; then AC_MSG_RESULT([Use libmvec]) fi + if test "x$have_libmvec" = xno; then + if test "x$have_sleef" = xno; then + AC_MSG_WARN([No math vector library detected (sleef or libmvec). Rely on compiler's auto-vectorization of math functions.]) + fi + fi + AC_MSG_RESULT([MODSIMD feature enabled]) fi