summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2013-09-06 14:58:31 -0700
committerCharles Harris <charlesr.harris@gmail.com>2013-09-06 14:58:31 -0700
commit1ec94198399e91baf562799548c443040532cd0b (patch)
tree6d690dd9626a97e6788e9d1019c071ea091ac864
parentb9b0ea5ee8270364af47d9f66ba1b28c57815d8a (diff)
parent554ee09d07a6dde8534ffacbbccffefab0fb0776 (diff)
downloadnumpy-1ec94198399e91baf562799548c443040532cd0b.tar.gz
Merge pull request #3691 from juliantaylor/windows-fpu-fix
BUG: fix windows fpu flag check for mixed x87 and sse instructions
-rw-r--r--numpy/core/include/numpy/ufuncobject.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/numpy/core/include/numpy/ufuncobject.h b/numpy/core/include/numpy/ufuncobject.h
index 8df96a44f..aab336da8 100644
--- a/numpy/core/include/numpy/ufuncobject.h
+++ b/numpy/core/include/numpy/ufuncobject.h
@@ -370,8 +370,12 @@ typedef struct _loop1d_info {
#define UFUNC_NOFPE _control87(MCW_EM, MCW_EM);
#endif
+/* windows enables sse on 32 bit, so check both flags */
#define UFUNC_CHECK_STATUS(ret) { \
- int fpstatus = (int) _clearfp(); \
+ int fpstatus, fpstatus2; \
+ _statusfp2(&fpstatus, &fpstatus2); \
+ _clearfp(); \
+ fpstatus |= fpstatus2; \
\
ret = ((SW_ZERODIVIDE & fpstatus) ? UFUNC_FPE_DIVIDEBYZERO : 0) \
| ((SW_OVERFLOW & fpstatus) ? UFUNC_FPE_OVERFLOW : 0) \