diff options
-rw-r--r-- | numpy/core/include/numpy/mingw_amd64_fenv.h | 105 | ||||
-rw-r--r-- | numpy/core/include/numpy/ufuncobject.h | 17 | ||||
-rw-r--r-- | numpy/core/setup.py | 2 | ||||
-rw-r--r-- | numpy/distutils/mingw32ccompiler.py | 8 |
4 files changed, 5 insertions, 127 deletions
diff --git a/numpy/core/include/numpy/mingw_amd64_fenv.h b/numpy/core/include/numpy/mingw_amd64_fenv.h deleted file mode 100644 index 398e34e68..000000000 --- a/numpy/core/include/numpy/mingw_amd64_fenv.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Those are mostly copies from BSD mlib - */ -#include <inttypes.h> -typedef struct { - struct { - uint32_t __control; - uint32_t __status; - uint32_t __tag; - char __other[16]; - } __x87; - uint32_t __mxcsr; -} npy_fenv_t; - -typedef uint16_t npy_fexcept_t; - -/* Exception flags */ -#define NPY_FE_INVALID 0x01 -#define NPY_FE_DENORMAL 0x02 -#define NPY_FE_DIVBYZERO 0x04 -#define NPY_FE_OVERFLOW 0x08 -#define NPY_FE_UNDERFLOW 0x10 -#define NPY_FE_INEXACT 0x20 -#define NPY_FE_ALL_EXCEPT (NPY_FE_DIVBYZERO | NPY_FE_DENORMAL | \ - NPY_FE_INEXACT | NPY_FE_INVALID | \ - NPY_FE_OVERFLOW | NPY_FE_UNDERFLOW) - -/* Assembly macros */ -#define __fldcw(__cw) __asm __volatile("fldcw %0" : : "m" (__cw)) -#define __fldenv(__env) __asm __volatile("fldenv %0" : : "m" (__env)) -#define __fldenvx(__env) __asm __volatile("fldenv %0" : : "m" (__env) \ - : "st", "st(1)", "st(2)", "st(3)", "st(4)", \ - "st(5)", "st(6)", "st(7)") -#define __fnclex() __asm __volatile("fnclex") -#define __fnstenv(__env) __asm __volatile("fnstenv %0" : "=m" (*(__env))) -#define __fnstcw(__cw) __asm __volatile("fnstcw %0" : "=m" (*(__cw))) -#define __fnstsw(__sw) __asm __volatile("fnstsw %0" : "=am" (*(__sw))) -#define __fwait() __asm __volatile("fwait") -#define __ldmxcsr(__csr) __asm __volatile("ldmxcsr %0" : : "m" (__csr)) -#define __stmxcsr(__csr) __asm __volatile("stmxcsr %0" : "=m" (*(__csr))) - -static __inline int npy_feclearexcept(int __excepts) -{ - npy_fenv_t __env; - - if (__excepts == NPY_FE_ALL_EXCEPT) { - __fnclex(); - } else { - __fnstenv(&__env.__x87); - __env.__x87.__status &= ~__excepts; - __fldenv(__env.__x87); - } - __stmxcsr(&__env.__mxcsr); - __env.__mxcsr &= ~__excepts; - __ldmxcsr(__env.__mxcsr); - return (0); -} - -static __inline int npy_fetestexcept(int __excepts) -{ - int __mxcsr, __status; - - __stmxcsr(&__mxcsr); - __fnstsw(&__status); - return ((__status | __mxcsr) & __excepts); -} - -static __inline int -npy_fesetexceptflag(const npy_fexcept_t *flagp, int excepts) -{ - npy_fenv_t env; - - __fnstenv(&env.__x87); - env.__x87.__status &= ~excepts; - env.__x87.__status |= *flagp & excepts; - __fldenv(env.__x87); - - __stmxcsr(&env.__mxcsr); - env.__mxcsr &= ~excepts; - env.__mxcsr |= *flagp & excepts; - __ldmxcsr(env.__mxcsr); - - return (0); -} - -int npy_feraiseexcept(int excepts) -{ - npy_fexcept_t ex = excepts; - - npy_fesetexceptflag(&ex, excepts); - __fwait(); - return (0); -} - -#undef __fldcw -#undef __fldenv -#undef __fldenvx -#undef __fnclex -#undef __fnstenv -#undef __fnstcw -#undef __fnstsw -#undef __fwait -#undef __ldmxcsr -#undef __stmxcsr - diff --git a/numpy/core/include/numpy/ufuncobject.h b/numpy/core/include/numpy/ufuncobject.h index 05dfcd2d0..9bbedc9e4 100644 --- a/numpy/core/include/numpy/ufuncobject.h +++ b/numpy/core/include/numpy/ufuncobject.h @@ -299,23 +299,6 @@ typedef struct _loop1d_info { (void) fpsetsticky(0); \ } -#elif defined(__MINGW32__) && defined(__amd64__) -#include "mingw_amd64_fenv.h" - -#define UFUNC_CHECK_STATUS(ret) { \ - int fpstatus = (int) npy_fetestexcept(NPY_FE_DIVBYZERO | \ - NPY_FE_OVERFLOW | NPY_FE_UNDERFLOW | NPY_FE_INVALID); \ - ret = ((NPY_FE_DIVBYZERO & fpstatus) ? UFUNC_FPE_DIVIDEBYZERO : 0) \ - | ((NPY_FE_OVERFLOW & fpstatus) ? UFUNC_FPE_OVERFLOW : 0) \ - | ((NPY_FE_UNDERFLOW & fpstatus) ? UFUNC_FPE_UNDERFLOW : 0) \ - | ((NPY_FE_INVALID & fpstatus) ? UFUNC_FPE_INVALID : 0); \ - (void) npy_feclearexcept(NPY_FE_DIVBYZERO | NPY_FE_OVERFLOW | \ - NPY_FE_UNDERFLOW | NPY_FE_INVALID); \ -} - -#define generate_divbyzero_error() npy_feraiseexcept(NPY_FE_DIVBYZERO) -#define generate_overflow_error() npy_feraiseexcept(NPY_FE_OVERFLOW) - #elif defined(__GLIBC__) || defined(__APPLE__) || defined(__CYGWIN__) || defined(__MINGW32__) || (defined(__FreeBSD__) && (__FreeBSD_version >= 502114)) #if defined(__GLIBC__) || defined(__APPLE__) || defined(__MINGW32__) || defined(__FreeBSD__) diff --git a/numpy/core/setup.py b/numpy/core/setup.py index b503eb693..c47d86e6e 100644 --- a/numpy/core/setup.py +++ b/numpy/core/setup.py @@ -9,7 +9,7 @@ from distutils.sysconfig import get_config_var from setup_common import * # Set to True to enable multiple file compilations (experimental) -ENABLE_SEPARATE_COMPILATION = False +ENABLE_SEPARATE_COMPILATION = True # XXX: ugly, we use a class to avoid calling twice some expensive functions in # config.h/numpyconfig.h. I don't see a better way because distutils force diff --git a/numpy/distutils/mingw32ccompiler.py b/numpy/distutils/mingw32ccompiler.py index 62d9cc7d5..d14f487ac 100644 --- a/numpy/distutils/mingw32ccompiler.py +++ b/numpy/distutils/mingw32ccompiler.py @@ -102,10 +102,10 @@ class Mingw32CCompiler(distutils.cygwinccompiler.CygwinCCompiler): # Py_ModuleInit4_64, etc... So we add it here if get_build_architecture() == 'AMD64': self.set_executables( - compiler='gcc -DMS_WIN64 -mno-cygwin -O0 -Wall', - compiler_so='gcc -DMS_WIN64 -mno-cygwin -O0 -Wall -Wstrict-prototypes', - linker_exe='gcc -mno-cygwin', - linker_so='gcc -mno-cygwin -shared') + compiler='gcc -g -DDEBUG -DMS_WIN64 -mno-cygwin -O0 -Wall', + compiler_so='gcc -g -DDEBUG -DMS_WIN64 -mno-cygwin -O0 -Wall -Wstrict-prototypes', + linker_exe='gcc -g -mno-cygwin', + linker_so='gcc -g -mno-cygwin -shared') else: if self.gcc_version <= "3.0.0": self.set_executables(compiler='gcc -mno-cygwin -O2 -w', |