2002-09-05 19:51:26 +08:00
|
|
|
#include <fenv.h>
|
2006-07-03 18:32:58 +08:00
|
|
|
#include "cpu_features.h"
|
2002-09-05 19:51:26 +08:00
|
|
|
|
|
|
|
/* 7.6.4.1
|
|
|
|
The fegetenv function stores the current floating-point environment
|
2005-10-08 10:14:45 +08:00
|
|
|
in the object pointed to by envp. */
|
2002-09-05 19:51:26 +08:00
|
|
|
|
2005-08-25 16:39:54 +08:00
|
|
|
int fegetenv (fenv_t * envp)
|
2002-09-05 19:51:26 +08:00
|
|
|
{
|
|
|
|
__asm__ ("fnstenv %0;": "=m" (*envp));
|
2005-10-08 10:14:45 +08:00
|
|
|
/* fnstenv sets control word to non-stop for all exceptions, so we
|
|
|
|
need to reload our env to restore the original mask. */
|
|
|
|
__asm__ ("fldenv %0" : : "m" (*envp));
|
2006-07-03 18:32:58 +08:00
|
|
|
|
|
|
|
/* And the SSE environment. */
|
|
|
|
if (__HAS_SSE)
|
|
|
|
__asm__ ("stmxcsr %0" : "=m" (envp->__mxcsr));
|
|
|
|
|
2005-08-25 16:39:54 +08:00
|
|
|
return 0;
|
2002-09-05 19:51:26 +08:00
|
|
|
}
|