1 /* Install given floating-point environment.
2 Copyright (C) 1997,99,2000,01,02,07 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20 #include <fenv_libc.h>
24 __fesetenv (const fenv_t
*envp
)
26 fenv_union_t old
, new;
28 /* get the currently set exceptions. */
30 old
.fenv
= fegetenv_register ();
32 /* If the old env has no eabled exceptions and the new env has any enabled
33 exceptions, then unmask SIGFPE in the MSR FE0/FE1 bits. This will put
34 the hardware into "precise mode" and may cause the FPU to run slower on
36 if ((old
.l
[1] & 0x000000F8) == 0 && (new.l
[1] & 0x000000F8) != 0)
37 (void)__fe_nomask_env ();
39 /* If the old env had any eabled exceptions and the new env has no enabled
40 exceptions, then mask SIGFPE in the MSR FE0/FE1 bits. This may allow the
41 FPU to run faster because it always takes the default action and can not
43 if ((old
.l
[1] & 0x000000F8) != 0 && (new.l
[1] & 0x000000F8) == 0)
44 (void)__fe_mask_env ();
46 fesetenv_register (*envp
);
52 #include <shlib-compat.h>
53 #if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
54 strong_alias (__fesetenv
, __old_fesetenv
)
55 compat_symbol (libm
, BP_SYM (__old_fesetenv
), BP_SYM (fesetenv
), GLIBC_2_1
);
58 libm_hidden_ver (__fesetenv
, fesetenv
)
59 versioned_symbol (libm
, BP_SYM (__fesetenv
), BP_SYM (fesetenv
), GLIBC_2_2
);