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.
This commit is contained in:
Minmin Gong 2019-01-21 12:49:40 -08:00 committed by Antoine Pitrou
parent 2433a2ab70
commit 7a2368063f
3 changed files with 5 additions and 2 deletions

View File

@ -19,7 +19,9 @@ extern "C" {
#if defined(_MSC_VER)
#include <intrin.h>
#include <immintrin.h>
#if defined(_M_IX86) || defined(_M_X64)
# include <immintrin.h>
#endif
#endif
/* This is modeled after the atomics interface from C1x, according to

View File

@ -406,7 +406,7 @@ extern "C" {
#endif
/* get and set x87 control word for VisualStudio/x86 */
#if defined(_MSC_VER) && !defined(_WIN64) /* x87 not supported in 64-bit */
#if defined(_MSC_VER) && defined(_M_IX86) /* x87 only supported in x86 */
#define HAVE_PY_SET_53BIT_PRECISION 1
#define _Py_SET_53BIT_PRECISION_HEADER \
unsigned int old_387controlword, new_387controlword, out_387controlword

View File

@ -0,0 +1 @@
Allow building on ARM with MSVC.