summaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2024-09-16 04:23:05 (GMT)
committerGitHub <noreply@github.com>2024-09-16 04:23:05 (GMT)
commitef530ce7c61dc16387fb68d48aebfbbbfe02adbb (patch)
tree9471d5ed39fa9dd9166b8255b54a11a85c011b52 /configure.ac
parent56470004e58911b146c016fc9fec4461b8f69454 (diff)
downloadcpython-ef530ce7c61dc16387fb68d48aebfbbbfe02adbb.zip
cpython-ef530ce7c61dc16387fb68d48aebfbbbfe02adbb.tar.gz
cpython-ef530ce7c61dc16387fb68d48aebfbbbfe02adbb.tar.bz2
gh-123748: Add conditional compilation rules for HACL SIMD256 and SIMD128 on macOS (#123989)
Add conditional compilation rules to allow HACL SIMD256 and SIMD128 to be ignored on the ARM64 pass of universal2 macOS builds.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac29
1 files changed, 27 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index 9284350..ab39f46 100644
--- a/configure.ac
+++ b/configure.ac
@@ -7805,8 +7805,21 @@ AC_SUBST([LIBHACL_CFLAGS])
dnl This can be extended here to detect e.g. Power8, which HACL* should also support.
AX_CHECK_COMPILE_FLAG([-msse -msse2 -msse3 -msse4.1 -msse4.2],[
[LIBHACL_SIMD128_FLAGS="-msse -msse2 -msse3 -msse4.1 -msse4.2"]
- [LIBHACL_SIMD128_OBJS="Modules/_hacl/Hacl_Hash_Blake2s_Simd128.o"]
+
AC_DEFINE([HACL_CAN_COMPILE_SIMD128], [1], [HACL* library can compile SIMD128 implementations])
+
+ # macOS universal2 builds *support* the -msse etc flags because they're
+ # available on x86_64. However, performance of the HACL SIMD128 implementation
+ # isn't great, so it's disabled on ARM64.
+ AC_MSG_CHECKING([for HACL* SIMD128 implementation])
+ if test "$UNIVERSAL_ARCHS" == "universal2"; then
+ [LIBHACL_SIMD128_OBJS="Modules/_hacl/Hacl_Hash_Blake2s_Simd128_universal2.o"]
+ AC_MSG_RESULT([universal2])
+ else
+ [LIBHACL_SIMD128_OBJS="Modules/_hacl/Hacl_Hash_Blake2s_Simd128.o"]
+ AC_MSG_RESULT([standard])
+ fi
+
], [], [-Werror])
AC_SUBST([LIBHACL_SIMD128_FLAGS])
@@ -7814,8 +7827,20 @@ AC_SUBST([LIBHACL_SIMD128_OBJS])
AX_CHECK_COMPILE_FLAG([-mavx2],[
[LIBHACL_SIMD256_FLAGS="-mavx2"]
- [LIBHACL_SIMD256_OBJS="Modules/_hacl/Hacl_Hash_Blake2b_Simd256.o"]
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
+ # implementation requires symbols that aren't available on ARM64. Use a
+ # wrapped implementation if we're building for universal2.
+ AC_MSG_CHECKING([for HACL* SIMD256 implementation])
+ if test "$UNIVERSAL_ARCHS" == "universal2"; then
+ [LIBHACL_SIMD256_OBJS="Modules/_hacl/Hacl_Hash_Blake2b_Simd256_universal2.o"]
+ AC_MSG_RESULT([universal2])
+ else
+ [LIBHACL_SIMD256_OBJS="Modules/_hacl/Hacl_Hash_Blake2b_Simd256.o"]
+ AC_MSG_RESULT([standard])
+ fi
], [], [-Werror])
AC_SUBST([LIBHACL_SIMD256_FLAGS])