2 #include "cpu_features.h"
5 The feholdexcept function saves the current floating-point
6 environment in the object pointed to by envp, clears the exception
7 flags, and then installs a non-stop (continue on exceptions) mode,
8 if available, for all exceptions. */
10 int feholdexcept (fenv_t * envp)
12 __asm__ ("fnstenv %0;" : "=m" (* envp)); /* save current into envp */
13 /* fnstenv sets control word to non-stop for all exceptions, so all we
14 need to do is clear the exception flags. */
20 /* Save the SSE MXCSR register. */
21 __asm__ ("stmxcsr %0" : "=m" (envp->__mxcsr));
22 /* Clear the exception flags. */
23 _csr = envp->__mxcsr & ~FE_ALL_EXCEPT;
24 /* Set exception mask to non-stop */
25 _csr |= (FE_ALL_EXCEPT << __MXCSR_EXCEPT_MASK_SHIFT) /*= 0x1f80 */;
26 __asm__ volatile ("ldmxcsr %0" : : "m" (_csr));