8000 BUG: fix windows fpu flag check for mixed x87 and sse instructions · juliantaylor/numpy@554ee09 · GitHub
[go: up one dir, main page]

Skip to content

Commit 554ee09

Browse files
committed
BUG: fix windows fpu flag check for mixed x87 and sse instructions
windows enables sse intrinsics also on 32 bit by default so we need to check both the x87 and sse fpu flags. closes numpy#3680
1 parent 573b3b0 commit 554ee09

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

numpy/core/include/numpy/ufuncobject.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,8 +370,12 @@ typedef struct _loop1d_info {
370370
#define UFUNC_NOFPE _control87(MCW_EM, MCW_EM);
371371
#endif
372372

373+
/* windows enables sse on 32 bit, so check both flags */
373374
#define UFUNC_CHECK_STATUS(ret) { \
374-
int fpstatus = (int) _clearfp(); \
375+
int fpstatus, fpstatus2; \
376+
_statusfp2(&fpstatus, &fpstatus2); \
377+
_clearfp(); \
378+
fpstatus |= fpstatus2; \
375379
\
376380
ret = ((SW_ZERODIVIDE & fpstatus) ? UFUNC_FPE_DIVIDEBYZERO : 0) \
377381
| ((SW_OVERFLOW & fpstatus) ? UFUNC_FPE_OVERFLOW : 0) \

0 commit comments

Comments
 (0)
0