diff options
author | Danny Smith <dannysmith@users.sourceforge.net> | 2006-07-03 10:32:58 +0000 |
---|---|---|
committer | Danny Smith <dannysmith@users.sourceforge.net> | 2006-07-03 10:32:58 +0000 |
commit | f34428eb356a001928e1786d51cbfe216ebeef83 (patch) | |
tree | d6319e46a0cc4bdaae18f49f4a4ad821677f895e /winsup/mingw/mingwex/fesetexceptflag.c | |
parent | 69d5f3329f4869d6d0e20f610926934fc0044dce (diff) | |
download | cygnal-f34428eb356a001928e1786d51cbfe216ebeef83.tar.gz cygnal-f34428eb356a001928e1786d51cbfe216ebeef83.tar.bz2 cygnal-f34428eb356a001928e1786d51cbfe216ebeef83.zip |
Support SSE float environment in fenv.h functions.
* cpu_features.c: New file.
* cpu_features.h: New file.
* crt1.c: Include "cpu_features.h".
(__mingw_CRTStartup): Call cpu_features_init().
* Makefile.in (MING_OBJS): Add cpu_features.c.
(SRCDIST_FILES): Add cpu_features.c, cpu_features.h.
* include/fenv,h ( fenv_t;): Append __mxcsr field.
(__MXCSR_EXCEPT_FLAG_SHIFT): New define.
(__MXCSR_EXCEPT_MASK_SHIFT): New define.
(__MXCSR_ROUND_FLAG_SHIFT): New define.
* mingwex/feclearexcept.c: Include "cpu_features.h".
Handle SSE environment.
* mingwex/fegetenv.c: Likewise.
* mingwex/feholdexcept.c: Likewise.
* mingwex/fesetenv.c: Likewise.
* mingwex/fesetexceptflag.c: Likewise.
* mingwex/fesetround.c: Likewise.
* mingwex/fetestexcept.c: Likewise.
* mingwex/feupdateenv.c: Likewise.
* mingwex/fegetround.c: Add comment.
Diffstat (limited to 'winsup/mingw/mingwex/fesetexceptflag.c')
-rw-r--r-- | winsup/mingw/mingwex/fesetexceptflag.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/winsup/mingw/mingwex/fesetexceptflag.c b/winsup/mingw/mingwex/fesetexceptflag.c index 7f4b8e562..876174b69 100644 --- a/winsup/mingw/mingwex/fesetexceptflag.c +++ b/winsup/mingw/mingwex/fesetexceptflag.c @@ -1,4 +1,5 @@ #include <fenv.h> +#include "cpu_features.h" /* 7.6.2.4 The fesetexceptflag function sets the complete status for those @@ -18,5 +19,15 @@ int fesetexceptflag (const fexcept_t * flagp, int excepts) _env.__status_word &= ~excepts; _env.__status_word |= (*flagp & excepts); __asm__ volatile ("fldenv %0;" : : "m" (_env)); + + if (__HAS_SSE) + { + unsigned int _csr; + __asm__ __volatile__("stmxcsr %0" : "=m" (_csr)); + _csr &= ~excepts; + _csr |= *flagp & excepts; + __asm__ volatile ("ldmxcsr %0" : : "m" (_csr)); + } + return 0; } |