]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/mips/fpu/fclrexcpt.c
MIPS specific optimizations.
[thirdparty/glibc.git] / sysdeps / mips / fpu / fclrexcpt.c
CommitLineData
4a986c1a 1/* Clear given exceptions in current floating-point environment.
f1cdba97 2 Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
4a986c1a 3 This file is part of the GNU C Library.
17e74c26 4 Contributed by Andreas Jaeger <aj@suse.de>, 1998.
4a986c1a
UD
5
6 The GNU C Library is free software; you can redistribute it and/or
3214b89b
AJ
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
4a986c1a
UD
10
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3214b89b 14 Lesser General Public License for more details.
4a986c1a 15
3214b89b
AJ
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, write to the Free
18 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19 02111-1307 USA. */
4a986c1a
UD
20
21#include <fenv.h>
f1cdba97 22#include <fenv_libc.h>
4a986c1a 23#include <fpu_control.h>
17e74c26 24#include <shlib-compat.h>
4a986c1a
UD
25
26int
27__feclearexcept (int excepts)
28{
29 int cw;
30
31 /* Mask out unsupported bits/exceptions. */
32 excepts &= FE_ALL_EXCEPT;
33
34 /* Read the complete control word. */
35 _FPU_GETCW (cw);
36
f1cdba97
AJ
37 /* Clear exception flag bits and cause bits. If the cause bit is not
38 cleared, the next CTC instruction (just below) will re-generate
39 the exception. */
40
41 cw &= ~(excepts | (excepts << CAUSE_SHIFT));
4a986c1a
UD
42
43 /* Put the new data in effect. */
44 _FPU_SETCW (cw);
45
46 /* Success. */
47 return 0;
48}
f1cdba97 49
b1212cdb 50#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
4a986c1a 51strong_alias (__feclearexcept, __old_feclearexcept)
17e74c26
AJ
52compat_symbol (libm, __old_feclearexcept, feclearexcept, GLIBC_2_1);
53#endif
54versioned_symbol (libm, __feclearexcept, feclearexcept, GLIBC_2_2);