fix regression from a745c4bfc8a9b5db4e48387170da0dc1d39e3abe
[uclibc-ng.git] / libm / nds32 / fedisblxcpt.c
blobbbb6d54e497f954f176efa9ec6457bc7dc0da0f0
1 /*
2 * Copyright (C) 2016-2017 Andes Technology, Inc.
3 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
4 */
6 /* Disable floating-point exceptions.
7 Copyright (C) 2001-2013 Free Software Foundation, Inc.
8 Contributed by Philip Blundell <philb@gnu.org>, 2001.
10 The GNU C Library is free software; you can redistribute it and/or
11 modify it under the terms of the GNU Lesser General Public
12 License as published by the Free Software Foundation; either
13 version 2.1 of the License, or (at your option) any later version.
15 The GNU C Library is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
20 You should have received a copy of the GNU Lesser General Public
21 License along with the GNU C Library. If not, see
22 <http://www.gnu.org/licenses/>. */
24 #include <fenv.h>
25 #include "fenv_libc.h"
26 #include <fpu_control.h>
28 int
29 fedisableexcept (int excepts)
31 #ifdef __NDS32_ABI_2FP_PLUS__
32 unsigned long int new_exc, old_exc;
34 _FPU_GETCW(new_exc);
36 old_exc = (new_exc & ENABLE_MASK) >> ENABLE_SHIFT;
38 excepts &= FE_ALL_EXCEPT;
40 new_exc &= ~(excepts << ENABLE_SHIFT);
41 new_exc &= ~_FPU_RESERVED;
42 _FPU_SETCW (new_exc);
44 return old_exc;
45 #else
46 /* Unsupported, so return -1 for failure. */
47 return -1;
48 #endif