summaryrefslogtreecommitdiffstats
path: root/Modules/blake2module.c
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 /Modules/blake2module.c
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 'Modules/blake2module.c')
-rw-r--r--Modules/blake2module.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/Modules/blake2module.c b/Modules/blake2module.c
index 56d1ced..1ec676c 100644
--- a/Modules/blake2module.c
+++ b/Modules/blake2module.c
@@ -41,6 +41,16 @@
#include <stdbool.h>
+// SIMD256 can't be compiled on macOS ARM64, and performance of SIMD128 isn't
+// great; but when compiling a universal2 binary, autoconf will set
+// HACL_CAN_COMPILE_SIMD128 and HACL_CAN_COMPILE_SIMD256 because they *can* be
+// compiled on x86_64. If we're on macOS ARM64, disable these preprocessor
+// symbols.
+#if defined(__APPLE__) && defined(__arm64__)
+# undef HACL_CAN_COMPILE_SIMD128
+# undef HACL_CAN_COMPILE_SIMD256
+#endif
+
// ECX
#define ECX_SSE3 (1 << 0)
#define ECX_SSSE3 (1 << 9)