Skip to content

Commit 2a6b6b3

Browse files
authored
GH-126458: disable SIMD for HACL under WASI (#126512)
Requires an extra `-msimd128` flag and the `*mmintrin.h` header files are exclusive to x86-family CPUs.
1 parent 5dc36dc commit 2a6b6b3

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Disable SIMD support for HACL under WASI.

configure

+4-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

+4-2
Original file line numberDiff line numberDiff line change
@@ -7853,7 +7853,8 @@ AC_SUBST([LIBHACL_CFLAGS])
78537853

78547854
# The SIMD files use aligned_alloc, which is not available on older versions of
78557855
# Android.
7856-
if test "$ac_sys_system" != "Linux-android" || test "$ANDROID_API_LEVEL" -ge 28; then
7856+
# The *mmintrin.h headers are x86-family-specific, so can't be used on WASI.
7857+
if test "$ac_sys_system" != "Linux-android" -a "$ac_sys_system" != "WASI" || test "$ANDROID_API_LEVEL" -ge 28; then
78577858
dnl This can be extended here to detect e.g. Power8, which HACL* should also support.
78587859
AX_CHECK_COMPILE_FLAG([-msse -msse2 -msse3 -msse4.1 -msse4.2],[
78597860
[LIBHACL_SIMD128_FLAGS="-msse -msse2 -msse3 -msse4.1 -msse4.2"]
@@ -7879,11 +7880,12 @@ AC_SUBST([LIBHACL_SIMD128_OBJS])
78797880

78807881
# The SIMD files use aligned_alloc, which is not available on older versions of
78817882
# Android.
7883+
# The *mmintrin.h headers are x86-family-specific, so can't be used on WASI.
78827884
#
78837885
# Although AVX support is not guaranteed on Android
78847886
# (https://developer.android.com/ndk/guides/abis#86-64), this is safe because we do a
78857887
# runtime CPUID check.
7886-
if test "$ac_sys_system" != "Linux-android" || test "$ANDROID_API_LEVEL" -ge 28; then
7888+
if test "$ac_sys_system" != "Linux-android" -a "$ac_sys_system" != "WASI" || test "$ANDROID_API_LEVEL" -ge 28; then
78877889
AX_CHECK_COMPILE_FLAG([-mavx2],[
78887890
[LIBHACL_SIMD256_FLAGS="-mavx2"]
78897891
AC_DEFINE([HACL_CAN_COMPILE_SIMD256], [1], [HACL* library can compile SIMD256 implementations])

0 commit comments

Comments
 (0)