Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Address review comments
Check for SIMD -m flags before checking for header issues. Clarify
comment.
  • Loading branch information
jmroot committed Feb 23, 2025
commit 9f6d5a452baf0b20cb1a7097f5fce4d5c43431c3
105 changes: 53 additions & 52 deletions configure

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 24 additions & 23 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -7849,15 +7849,15 @@ if test "$ac_sys_system" != "Linux-android" -a "$ac_sys_system" != "WASI" || tes
dnl This can be extended here to detect e.g. Power8, which HACL* should also support.
# Older versions of the mmintrin headers shipped with clang may error if they are
# included without using the corresponding -msse* option. See GH issue #130213.
AC_MSG_CHECKING([if __m128i can be used without -msse*])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([#include <emmintrin.h>
#include <tmmintrin.h>
#include <smmintrin.h>],
[__m128i testvar;])],
[AC_MSG_RESULT([yes])
AX_CHECK_COMPILE_FLAG([-msse -msse2 -msse3 -msse4.1 -msse4.2],[
[LIBHACL_SIMD128_FLAGS="-msse -msse2 -msse3 -msse4.1 -msse4.2"]
AX_CHECK_COMPILE_FLAG([-msse -msse2 -msse3 -msse4.1 -msse4.2],[
[LIBHACL_SIMD128_FLAGS="-msse -msse2 -msse3 -msse4.1 -msse4.2"]
AC_MSG_CHECKING([if __m128i can be used without -msse*])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([#include <emmintrin.h>
#include <tmmintrin.h>
#include <smmintrin.h>],
[__m128i testvar;])],
[AC_MSG_RESULT([yes])

AC_DEFINE([HACL_CAN_COMPILE_SIMD128], [1], [HACL* library can compile SIMD128 implementations])

Expand All @@ -7873,8 +7873,8 @@ if test "$ac_sys_system" != "Linux-android" -a "$ac_sys_system" != "WASI" || tes
AC_MSG_RESULT([standard])
fi

], [], [-Werror])
], [AC_MSG_RESULT([no])])
], [AC_MSG_RESULT([no])])
], [], [-Werror])
fi
AC_SUBST([LIBHACL_SIMD128_FLAGS])
AC_SUBST([LIBHACL_SIMD128_OBJS])
Expand All @@ -7887,16 +7887,17 @@ AC_SUBST([LIBHACL_SIMD128_OBJS])
# (https://developer.android.com/ndk/guides/abis#86-64), this is safe because we do a
# runtime CPUID check.
if test "$ac_sys_system" != "Linux-android" -a "$ac_sys_system" != "WASI" || test "$ANDROID_API_LEVEL" -ge 28; then
# Some versions of immintrin.h may not provide the __m256i type if no -mavx*
# option is used. See GH issue #130213.
AC_MSG_CHECKING([if __m256i can be used without -mavx2])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([#include <immintrin.h>],
[__m256i testvar;])],
[AC_MSG_RESULT([yes])
AX_CHECK_COMPILE_FLAG([-mavx2],[
[LIBHACL_SIMD256_FLAGS="-mavx2"]
AC_DEFINE([HACL_CAN_COMPILE_SIMD256], [1], [HACL* library can compile SIMD256 implementations])
# Some versions of immintrin.h require -mavx* to provide the __m256i type
# but blake2module.c must not be compiled with those options and may
# include libintvector.h which contains __m256i. See GH issue #130213.
AX_CHECK_COMPILE_FLAG([-mavx2],[
[LIBHACL_SIMD256_FLAGS="-mavx2"]
AC_MSG_CHECKING([if __m256i can be used without -mavx2])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([#include <immintrin.h>],
[__m256i testvar;])],
[AC_MSG_RESULT([yes])
AC_DEFINE([HACL_CAN_COMPILE_SIMD256], [1], [HACL* library can compile SIMD256 implementations])

# macOS universal2 builds *support* the -mavx2 compiler flag because it's
# available on x86_64; but the HACL SIMD256 build then fails because the
Expand All @@ -7910,8 +7911,8 @@ if test "$ac_sys_system" != "Linux-android" -a "$ac_sys_system" != "WASI" || tes
[LIBHACL_SIMD256_OBJS="Modules/_hacl/Hacl_Hash_Blake2b_Simd256.o"]
AC_MSG_RESULT([standard])
fi
], [], [-Werror])
], [AC_MSG_RESULT([no])])
], [AC_MSG_RESULT([no])])
], [], [-Werror])
fi
AC_SUBST([LIBHACL_SIMD256_FLAGS])
AC_SUBST([LIBHACL_SIMD256_OBJS])
Expand Down