From f7441747df3fe28097c0894f13dfd2c6fc5035a6 Mon Sep 17 00:00:00 2001 From: "Michael R. Crusoe" Date: Mon, 1 Dec 2025 14:56:36 +0100 Subject: [PATCH] [mypyc] lib-rt base64: support pyodide for Python 3.12 For Python 3.12, pyodide requires emscripten 3.1.{46,52,58}, which uses an older version of SIMDe that doesn't include all the NEON 64-bit intrinsics we need. So we use the 32-bit NEON intrinsics implementation of base64 for Pyodide on Python 3.12, and use the 64-bit NEON intrinsics implementations of base64 for Pyodide on Python 3.13. Pyodide for Python 3.13 uses emscripten 4.0.{6,8,9} Emscripten versdion 3.1.63 appears to be the first version with the updated SIMDe versions: https://github.com/emscripten-core/emscripten/commit/6223c43516e41d78154f24dd319fc37da3ba1a46 --- mypyc/lib-rt/base64/config.h | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/mypyc/lib-rt/base64/config.h b/mypyc/lib-rt/base64/config.h index 8517c7b87d8c..1988edbef1f7 100644 --- a/mypyc/lib-rt/base64/config.h +++ b/mypyc/lib-rt/base64/config.h @@ -8,17 +8,15 @@ #define HAVE_AVX 1 #define HAVE_AVX2 1 #define HAVE_AVX512 0 +#elif (defined(__APPLE__) && defined(__aarch64__)) + #define HAVE_NEON64 1 +#elif (defined(__wasm__) && defined(__wasm_simd128__)) + #include "emscripten/version.h" + #if __EMSCRIPTEN_major__ == 3 + #define HAVE_NEON32 1 + #elif __EMSCRIPTEN_major__ > 3 + #define HAVE_NEON64 1 + #endif #endif -#define BASE64_WITH_NEON32 0 -#define HAVE_NEON32 BASE64_WITH_NEON32 - -#if (defined(__APPLE__) && defined(__aarch64__)) || (defined(__wasm__) && defined(__wasm_simd128__)) -#define BASE64_WITH_NEON64 1 -#else -#define BASE64_WITH_NEON64 0 -#endif - -#define HAVE_NEON64 BASE64_WITH_NEON64 - #endif // BASE64_CONFIG_H