Skip to content

Commit

Permalink
try building a sample SVE program
Browse files Browse the repository at this point in the history
When configure'd with --enable-sve, try to build a sample SVE program
and abort on failure, otherwise configure successes but make will fail.
  • Loading branch information
ggouaillardet authored and rdolbeau committed Jul 3, 2024
1 parent 8cb2fbd commit ff3dfb0
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
10 changes: 8 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,10 @@ AM_CONDITIONAL(HAVE_GENERIC_SIMD256, test "$have_generic_simd256" = "yes")

AC_ARG_ENABLE(sve, [AC_HELP_STRING([--enable-sve],[enable ARM SVE optimizations])], have_sve=$enableval, have_sve=no)
if test "$have_sve" = "yes"; then
AC_DEFINE(HAVE_SVE,1,[Define to enable ARM SVE optimizations.])
AC_DEFINE(HAVE_SVE,1,[Define to enable ARM SVE optimizations])
fi
AM_CONDITIONAL(HAVE_SVE, test "$have_sve" = "yes")


dnl FIXME:
dnl AC_ARG_ENABLE(mips-ps, [AS_HELP_STRING([--enable-mips-ps],[enable MIPS pair-single optimizations])], have_mips_ps=$enableval, have_mips_ps=no)
dnl if test "$have_mips_ps" = "yes"; then
Expand Down Expand Up @@ -683,6 +682,13 @@ if test "$enable_openmp" = "yes"; then
AX_OPENMP([], [AC_MSG_ERROR([don't know how to enable OpenMP])])
fi

if test "$have_sve" = "yes"; then
ACX_SVE([sve_ok=yes], [sve_ok=no])
if test "$sve_ok" != "yes"; then
AC_MSG_ERROR([Cannot build a SVE program, aborting])
fi
fi

AC_ARG_ENABLE(threads, [AS_HELP_STRING([--enable-threads],[compile FFTW SMP threads library])], enable_threads=$enableval, enable_threads=no)

if test "$enable_threads" = "yes"; then
Expand Down
26 changes: 26 additions & 0 deletions m4/acx_sve.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
dnl @synopsis ACX_SVE([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
dnl @summary figure out whether a simple SVE program can be compiled
dnl @category InstalledPackages
dnl
dnl This macro tries to compile a simple SVE program that uses
dnl the ACLE SVE extensions.
dnl
dnl ACTION-IF-FOUND is a list of shell commands to run if a SVE
dnl program can be compiled, and ACTION-IF-NOT-FOUND is a list of commands
dnl to run it cannot.
dnl
dnl @version 2024-04-15
dnl @license GPLWithACException
dnl @author Gilles Gouaillardet <[email protected]>

AC_DEFUN([ACX_SVE], [
AC_MSG_CHECKING([whether a SVE program can be compiled])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <arm_sve.h>]],
[[#if defined(__GNUC__) && !defined(__ARM_FEATURE_SVE)
#error compiling without SVE support
#endif]])],[AC_MSG_RESULT([yes])
$1],
[AC_MSG_RESULT([no])
$2])
])dnl ACX_SVE

0 comments on commit ff3dfb0

Please sign in to comment.