2002-09-05 13:51:26 +02:00
|
|
|
#include <fenv.h>
|
2006-07-03 12:32:58 +02:00
|
|
|
#include "cpu_features.h"
|
2002-09-05 13:51:26 +02:00
|
|
|
|
|
|
|
/* 7.6.4.1
|
|
|
|
The fegetenv function stores the current floating-point environment
|
2005-10-08 04:14:45 +02:00
|
|
|
in the object pointed to by envp. */
|
2002-09-05 13:51:26 +02:00
|
|
|
|
2005-08-25 10:39:54 +02:00
|
|
|
int fegetenv (fenv_t * envp)
|
2002-09-05 13:51:26 +02:00
|
|
|
{
|
|
|
|
__asm__ ("fnstenv %0;": "=m" (*envp));
|
2005-10-08 04:14:45 +02: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 12:32:58 +02:00
|
|
|
|
|
|
|
/* And the SSE environment. */
|
|
|
|
if (__HAS_SSE)
|
|
|
|
__asm__ ("stmxcsr %0" : "=m" (envp->__mxcsr));
|
|
|
|
|
2005-08-25 10:39:54 +02:00
|
|
|
return 0;
|
2002-09-05 13:51:26 +02:00
|
|
|
}
|