summaryrefslogtreecommitdiff
path: root/numpy/core
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2018-12-13 08:53:01 -0800
committerGitHub <noreply@github.com>2018-12-13 08:53:01 -0800
commit90f2c2c075d76541bf963d7fa8fcff11e58ef1e1 (patch)
treec62b14471e29d08a99c080067afaedabdef6f760 /numpy/core
parentc401d5fa8ed0bd0d5b709be621b18a4931dd6bb6 (diff)
parent31bd28c5f243479866ed053323d000172583f0fe (diff)
downloadnumpy-90f2c2c075d76541bf963d7fa8fcff11e58ef1e1.tar.gz
Merge pull request #12526 from mattip/fix-12520
BUG: reorder operations for VS2015
Diffstat (limited to 'numpy/core')
-rw-r--r--numpy/core/src/umath/loops.c.src12
-rw-r--r--numpy/core/src/umath/simd.inc.src9
2 files changed, 14 insertions, 7 deletions
diff --git a/numpy/core/src/umath/loops.c.src b/numpy/core/src/umath/loops.c.src
index f96e621b8..ae3ece77b 100644
--- a/numpy/core/src/umath/loops.c.src
+++ b/numpy/core/src/umath/loops.c.src
@@ -1861,7 +1861,8 @@ NPY_NO_EXPORT void
if (!run_unary_reduce_simd_@kind@_@TYPE@(args, dimensions, steps)) {
BINARY_REDUCE_LOOP(@type@) {
const @type@ in2 = *(@type@ *)ip2;
- io1 = (npy_isnan(io1) || io1 @OP@ in2) ? io1 : in2;
+ /* Order of operations important for MSVC 2015 */
+ io1 = (io1 @OP@ in2 || npy_isnan(io1)) ? io1 : in2;
}
*((@type@ *)iop1) = io1;
}
@@ -1870,7 +1871,8 @@ NPY_NO_EXPORT void
BINARY_LOOP {
@type@ in1 = *(@type@ *)ip1;
const @type@ in2 = *(@type@ *)ip2;
- in1 = (npy_isnan(in1) || in1 @OP@ in2) ? in1 : in2;
+ /* Order of operations important for MSVC 2015 */
+ in1 = (in1 @OP@ in2 || npy_isnan(in1)) ? in1 : in2;
*((@type@ *)op1) = in1;
}
}
@@ -1889,7 +1891,8 @@ NPY_NO_EXPORT void
if (IS_BINARY_REDUCE) {
BINARY_REDUCE_LOOP(@type@) {
const @type@ in2 = *(@type@ *)ip2;
- io1 = (npy_isnan(in2) || io1 @OP@ in2) ? io1 : in2;
+ /* Order of operations important for MSVC 2015 */
+ io1 = (io1 @OP@ in2 || npy_isnan(in2)) ? io1 : in2;
}
*((@type@ *)iop1) = io1;
}
@@ -1897,7 +1900,8 @@ NPY_NO_EXPORT void
BINARY_LOOP {
const @type@ in1 = *(@type@ *)ip1;
const @type@ in2 = *(@type@ *)ip2;
- *((@type@ *)op1) = (npy_isnan(in2) || in1 @OP@ in2) ? in1 : in2;
+ /* Order of operations important for MSVC 2015 */
+ *((@type@ *)op1) = (in1 @OP@ in2 || npy_isnan(in2)) ? in1 : in2;
}
}
npy_clear_floatstatus_barrier((char*)dimensions);
diff --git a/numpy/core/src/umath/simd.inc.src b/numpy/core/src/umath/simd.inc.src
index a3e00b5c1..ee7030855 100644
--- a/numpy/core/src/umath/simd.inc.src
+++ b/numpy/core/src/umath/simd.inc.src
@@ -1029,7 +1029,8 @@ sse2_@kind@_@TYPE@(@type@ * ip, @type@ * op, const npy_intp n)
{
const npy_intp stride = VECTOR_SIZE_BYTES / (npy_intp)sizeof(@type@);
LOOP_BLOCK_ALIGN_VAR(ip, @type@, VECTOR_SIZE_BYTES) {
- *op = (npy_isnan(*op) || *op @OP@ ip[i]) ? *op : ip[i];
+ /* Order of operations important for MSVC 2015 */
+ *op = (*op @OP@ ip[i] || npy_isnan(*op)) ? *op : ip[i];
}
assert(n < (stride) || npy_is_aligned(&ip[i], VECTOR_SIZE_BYTES));
if (i + 3 * stride <= n) {
@@ -1053,11 +1054,13 @@ sse2_@kind@_@TYPE@(@type@ * ip, @type@ * op, const npy_intp n)
}
else {
@type@ tmp = sse2_horizontal_@VOP@_@vtype@(c1);
- *op = (npy_isnan(*op) || *op @OP@ tmp) ? *op : tmp;
+ /* Order of operations important for MSVC 2015 */
+ *op = (*op @OP@ tmp || npy_isnan(*op)) ? *op : tmp;
}
}
LOOP_BLOCKED_END {
- *op = (npy_isnan(*op) || *op @OP@ ip[i]) ? *op : ip[i];
+ /* Order of operations important for MSVC 2015 */
+ *op = (*op @OP@ ip[i] || npy_isnan(*op)) ? *op : ip[i];
}
npy_clear_floatstatus_barrier((char*)op);
}