Skip to content

Commit ad0f41e

Browse files
authored
[mypyc] lib-rt base64: support pyodide for Python 3.12 (#20342)
Fixes the issue reported at mypyc/librt#14 (comment) For Python 3.12, [the pyodide_2024_0 ABI requires emscripten 3.1.58](https://pyodide.org/en/stable/development/abi.html#pyodide-2024-0), 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, the pyodide_2025_0 ABI, uses emscripten 4.0.9](https://pyodide.org/en/stable/development/abi.html#pyodide-2025-0-under-development) Emscripten versdion 3.1.63 appears to be the first version with the updated SIMDe versions: emscripten-core/emscripten@6223c43
1 parent 25cf74b commit ad0f41e

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

mypyc/lib-rt/base64/config.h

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,15 @@
88
#define HAVE_AVX 1
99
#define HAVE_AVX2 1
1010
#define HAVE_AVX512 0
11+
#elif (defined(__APPLE__) && defined(__aarch64__))
12+
#define HAVE_NEON64 1
13+
#elif (defined(__wasm__) && defined(__wasm_simd128__))
14+
#include "emscripten/version.h"
15+
#if __EMSCRIPTEN_major__ == 3
16+
#define HAVE_NEON32 1
17+
#elif __EMSCRIPTEN_major__ > 3
18+
#define HAVE_NEON64 1
19+
#endif
1120
#endif
1221

13-
#define BASE64_WITH_NEON32 0
14-
#define HAVE_NEON32 BASE64_WITH_NEON32
15-
16-
#if (defined(__APPLE__) && defined(__aarch64__)) || (defined(__wasm__) && defined(__wasm_simd128__))
17-
#define BASE64_WITH_NEON64 1
18-
#else
19-
#define BASE64_WITH_NEON64 0
20-
#endif
21-
22-
#define HAVE_NEON64 BASE64_WITH_NEON64
23-
2422
#endif // BASE64_CONFIG_H

0 commit comments

Comments
 (0)