1 /* Install given floating-point environment.
2 Copyright (C) 1997, 1999, 2000, 2002 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4 Contributed by David Huggins-Daines <dhd@debian.org>, 2000
5 Based on the m68k version by
6 Andreas Schwab <schwab@suse.de>
8 The GNU C Library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Lesser General Public
10 License as published by the Free Software Foundation; either
11 version 2.1 of the License, or (at your option) any later version.
13 The GNU C Library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
18 You should have received a copy of the GNU Lesser General Public
19 License along with the GNU C Library; if not, write to the Free
20 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
26 fesetenv (const fenv_t
*envp
)
29 fenv_t
* _regs
= &temp
;
31 /* Install the environment specified by ENVP. But there are a few
32 values which we do not want to come from the saved environment.
33 Therefore, we get the current environment and replace the values
34 we want to use from the environment specified by the parameter. */
36 "fstd,ma %%fr0,8(%1)\n"
37 "fstd,ma %%fr1,8(%1)\n"
38 "fstd,ma %%fr2,8(%1)\n"
40 : "=m" (*_regs
), "+r" (_regs
));
42 temp
.__status_word
&= ~(FE_ALL_EXCEPT
43 | (FE_ALL_EXCEPT
<< 27)
45 if (envp
== FE_DFL_ENV
)
47 else if (envp
== FE_NOMASK_ENV
)
48 temp
.__status_word
|= FE_ALL_EXCEPT
;
50 temp
.__status_word
|= (envp
->__status_word
53 | (FE_ALL_EXCEPT
<< 27)));
55 /* Load the new environment. */
57 "fldd,ma -8(%1),%%fr3\n"
58 "fldd,ma -8(%1),%%fr2\n"
59 "fldd,ma -8(%1),%%fr1\n"
61 : "=m" (*_regs
), "+r" (_regs
));
66 libm_hidden_def (fesetenv
)