summaryrefslogtreecommitdiffstats
path: root/winsup/mingw/mingwex/fesetexceptflag.c
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/mingw/mingwex/fesetexceptflag.c')
-rw-r--r--winsup/mingw/mingwex/fesetexceptflag.c11
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;
}