summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2021-04-16 18:20:59 -0600
committerGitHub <noreply@github.com>2021-04-16 18:20:59 -0600
commita1b8d3c1d54d9e6efb79492754f0744be4c8a353 (patch)
tree6a555f70735d500f71e15a8a2eb15ce67aeb86f6
parenta7a99f4837e021777350dedfe1bd408cc6330f9a (diff)
parent610031c1ae4c496f0f1b747a5ae13667a484f04d (diff)
downloadnumpy-a1b8d3c1d54d9e6efb79492754f0744be4c8a353.tar.gz
Merge pull request #18795 from seiko2plus/fix_cygwin_simd_test
SIMD, TEST: Workaround for misaligned stack GCC BUG ABI on WIN64
-rw-r--r--numpy/core/src/_simd/_simd_vector.inc19
1 files changed, 17 insertions, 2 deletions
diff --git a/numpy/core/src/_simd/_simd_vector.inc b/numpy/core/src/_simd/_simd_vector.inc
index 2a1378f22..d4b6310fd 100644
--- a/numpy/core/src/_simd/_simd_vector.inc
+++ b/numpy/core/src/_simd/_simd_vector.inc
@@ -86,7 +86,22 @@ static PyTypeObject PySIMDVectorType = {
/************************************
** Protected Definitions
************************************/
-static PySIMDVectorObject *
+/*
+ * Force inlining the following functions on CYGWIN to avoid spilling vector
+ * registers into the stack to workaround GCC/WIN64 bug that performs
+ * miss-align load variable of 256/512-bit vector from non-aligned
+ * 256/512-bit stack pointer.
+ *
+ * check the following links for more clearification:
+ * https://github.com/numpy/numpy/pull/18330#issuecomment-821539919
+ * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49001
+ */
+#if defined(__CYGWIN__) || (defined(__GNUC__) && defined(_WIN64))
+ #define CYG_FINLINE NPY_FINLINE
+#else
+ #define CYG_FINLINE static
+#endif
+CYG_FINLINE PySIMDVectorObject *
PySIMDVector_FromData(simd_data data, simd_data_type dtype)
{
const simd_data_info *info = simd_data_getinfo(dtype);
@@ -118,7 +133,7 @@ PySIMDVector_FromData(simd_data data, simd_data_type dtype)
return vec;
}
-static simd_data
+CYG_FINLINE simd_data
PySIMDVector_AsData(PySIMDVectorObject *vec, simd_data_type dtype)
{
const simd_data_info *info = simd_data_getinfo(dtype);