From cc86b445549b8088db8f240885927e220ed92b6e Mon Sep 17 00:00:00 2001 From: Pengyu Lee Date: Sun, 4 Oct 2026 02:36:01 +0800 Subject: [PATCH] gh-157906: fix an incorrect architecture macro check in free-threaded GC (gh-157907) Fix typo in free-threaded GC prefetch check for 32-bit x86 MSVC. (cherry picked from commit 1b015e66f058f29de4d97031b465587ec15cace9) Co-authored-by: Pengyu Lee --- .../next/Windows/2026-09-21-20-54-37.gh-issue-157906.RlyLkY.rst | 2 ++ Python/gc_free_threading.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Windows/2026-09-21-20-54-37.gh-issue-157906.RlyLkY.rst diff --git a/Misc/NEWS.d/next/Windows/2026-09-21-20-54-37.gh-issue-157906.RlyLkY.rst b/Misc/NEWS.d/next/Windows/2026-09-21-20-54-37.gh-issue-157906.RlyLkY.rst new file mode 100644 index 00000000000000..3e0ca08a58abec --- /dev/null +++ b/Misc/NEWS.d/next/Windows/2026-09-21-20-54-37.gh-issue-157906.RlyLkY.rst @@ -0,0 +1,2 @@ +Fix an incorrect architecture macro check that prevented CPU prefetching in +the free-threaded garbage collector on 32-bit Windows builds. diff --git a/Python/gc_free_threading.c b/Python/gc_free_threading.c index 285f24806e8fd4..abc69c924654ae 100644 --- a/Python/gc_free_threading.c +++ b/Python/gc_free_threading.c @@ -566,7 +566,7 @@ static_assert(BUFFER_HI < BUFFER_SIZE && #define PREFETCH_T1(ptr) __builtin_prefetch(ptr, 0, 2) #define PREFETCH_T2(ptr) __builtin_prefetch(ptr, 0, 1) #define PREFETCH_NTA(ptr) __builtin_prefetch(ptr, 0, 0) -#elif defined(_MSC_VER) && (defined(_M_X64) || defined(_M_I86)) && !defined(_M_ARM64EC) +#elif defined(_MSC_VER) && (defined(_M_X64) || defined(_M_IX86)) && !defined(_M_ARM64EC) #include #define PREFETCH_T0(ptr) _mm_prefetch((const char*)(ptr), _MM_HINT_T0) #define PREFETCH_T1(ptr) _mm_prefetch((const char*)(ptr), _MM_HINT_T1)