Skip to content

Commit 7a23680

Browse files
gongminminpitrou
authored andcommitted
bpo-35758: Fix building on ARM + MSVC (gh-11531)
* Disable x87 control word for non-x86 targets On msvc, x87 control word is only available on x86 target. Need to disable it for other targets to prevent compiling problems. * Include immintrin.h on x86 and x64 only Immintrin.h is only available on x86 and x64. Need to disable it for other targets to prevent compiling problems.
1 parent 2433a2a commit 7a23680

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

Include/internal/pycore_atomic.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ extern "C" {
1919

2020
#if defined(_MSC_VER)
2121
#include <intrin.h>
22-
#include <immintrin.h>
22+
#if defined(_M_IX86) || defined(_M_X64)
23+
# include <immintrin.h>
24+
#endif
2325
#endif
2426

2527
/* This is modeled after the atomics interface from C1x, according to

Include/pyport.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ extern "C" {
406406
#endif
407407

408408
/* get and set x87 control word for VisualStudio/x86 */
409-
#if defined(_MSC_VER) && !defined(_WIN64) /* x87 not supported in 64-bit */
409+
#if defined(_MSC_VER) && defined(_M_IX86) /* x87 only supported in x86 */
410410
#define HAVE_PY_SET_53BIT_PRECISION 1
411411
#define _Py_SET_53BIT_PRECISION_HEADER \
412412
unsigned int old_387controlword, new_387controlword, out_387controlword
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Allow building on ARM with MSVC.

0 commit comments

Comments
 (0)