Skip to content

Commit 9f6d5a4

Browse files
committed
Address review comments
Check for SIMD -m flags before checking for header issues. Clarify comment.
1 parent 2897e64 commit 9f6d5a4

File tree

2 files changed

+77
-75
lines changed

2 files changed

+77
-75
lines changed

configure

Lines changed: 53 additions & 52 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7849,15 +7849,15 @@ if test "$ac_sys_system" != "Linux-android" -a "$ac_sys_system" != "WASI" || tes
78497849
dnl This can be extended here to detect e.g. Power8, which HACL* should also support.
78507850
# Older versions of the mmintrin headers shipped with clang may error if they are
78517851
# included without using the corresponding -msse* option. See GH issue #130213.
7852-
AC_MSG_CHECKING([if __m128i can be used without -msse*])
7853-
AC_COMPILE_IFELSE(
7854-
[AC_LANG_PROGRAM([#include <emmintrin.h>
7855-
#include <tmmintrin.h>
7856-
#include <smmintrin.h>],
7857-
[__m128i testvar;])],
7858-
[AC_MSG_RESULT([yes])
7859-
AX_CHECK_COMPILE_FLAG([-msse -msse2 -msse3 -msse4.1 -msse4.2],[
7860-
[LIBHACL_SIMD128_FLAGS="-msse -msse2 -msse3 -msse4.1 -msse4.2"]
7852+
AX_CHECK_COMPILE_FLAG([-msse -msse2 -msse3 -msse4.1 -msse4.2],[
7853+
[LIBHACL_SIMD128_FLAGS="-msse -msse2 -msse3 -msse4.1 -msse4.2"]
7854+
AC_MSG_CHECKING([if __m128i can be used without -msse*])
7855+
AC_COMPILE_IFELSE(
7856+
[AC_LANG_PROGRAM([#include <emmintrin.h>
7857+
#include <tmmintrin.h>
7858+
#include <smmintrin.h>],
7859+
[__m128i testvar;])],
7860+
[AC_MSG_RESULT([yes])
78617861
78627862
AC_DEFINE([HACL_CAN_COMPILE_SIMD128], [1], [HACL* library can compile SIMD128 implementations])
78637863
@@ -7873,8 +7873,8 @@ if test "$ac_sys_system" != "Linux-android" -a "$ac_sys_system" != "WASI" || tes
78737873
AC_MSG_RESULT([standard])
78747874
fi
78757875
7876-
], [], [-Werror])
7877-
], [AC_MSG_RESULT([no])])
7876+
], [AC_MSG_RESULT([no])])
7877+
], [], [-Werror])
78787878
fi
78797879
AC_SUBST([LIBHACL_SIMD128_FLAGS])
78807880
AC_SUBST([LIBHACL_SIMD128_OBJS])
@@ -7887,16 +7887,17 @@ AC_SUBST([LIBHACL_SIMD128_OBJS])
78877887
# (https://developer.android.com/ndk/guides/abis#86-64), this is safe because we do a
78887888
# runtime CPUID check.
78897889
if test "$ac_sys_system" != "Linux-android" -a "$ac_sys_system" != "WASI" || test "$ANDROID_API_LEVEL" -ge 28; then
7890-
# Some versions of immintrin.h may not provide the __m256i type if no -mavx*
7891-
# option is used. See GH issue #130213.
7892-
AC_MSG_CHECKING([if __m256i can be used without -mavx2])
7893-
AC_COMPILE_IFELSE(
7894-
[AC_LANG_PROGRAM([#include <immintrin.h>],
7895-
[__m256i testvar;])],
7896-
[AC_MSG_RESULT([yes])
7897-
AX_CHECK_COMPILE_FLAG([-mavx2],[
7898-
[LIBHACL_SIMD256_FLAGS="-mavx2"]
7899-
AC_DEFINE([HACL_CAN_COMPILE_SIMD256], [1], [HACL* library can compile SIMD256 implementations])
7890+
# Some versions of immintrin.h require -mavx* to provide the __m256i type
7891+
# but blake2module.c must not be compiled with those options and may
7892+
# include libintvector.h which contains __m256i. See GH issue #130213.
7893+
AX_CHECK_COMPILE_FLAG([-mavx2],[
7894+
[LIBHACL_SIMD256_FLAGS="-mavx2"]
7895+
AC_MSG_CHECKING([if __m256i can be used without -mavx2])
7896+
AC_COMPILE_IFELSE(
7897+
[AC_LANG_PROGRAM([#include <immintrin.h>],
7898+
[__m256i testvar;])],
7899+
[AC_MSG_RESULT([yes])
7900+
AC_DEFINE([HACL_CAN_COMPILE_SIMD256], [1], [HACL* library can compile SIMD256 implementations])
79007901
79017902
# macOS universal2 builds *support* the -mavx2 compiler flag because it's
79027903
# available on x86_64; but the HACL SIMD256 build then fails because the
@@ -7910,8 +7911,8 @@ if test "$ac_sys_system" != "Linux-android" -a "$ac_sys_system" != "WASI" || tes
79107911
[LIBHACL_SIMD256_OBJS="Modules/_hacl/Hacl_Hash_Blake2b_Simd256.o"]
79117912
AC_MSG_RESULT([standard])
79127913
fi
7913-
], [], [-Werror])
7914-
], [AC_MSG_RESULT([no])])
7914+
], [AC_MSG_RESULT([no])])
7915+
], [], [-Werror])
79157916
fi
79167917
AC_SUBST([LIBHACL_SIMD256_FLAGS])
79177918
AC_SUBST([LIBHACL_SIMD256_OBJS])

0 commit comments

Comments
 (0)