1 /* Internal libc stuff for floating point environment routines. e500 version.
2 Copyright (C) 2004-2019 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, see
17 <http://www.gnu.org/licenses/>. */
20 #define _FENV_LIBC_H 1
24 int __feraiseexcept_spe (int);
25 libm_hidden_proto (__feraiseexcept_spe)
27 int __feraiseexcept_soft (int);
28 libc_hidden_proto (__feraiseexcept_soft)
30 int __fexcepts_to_spe (int);
31 libm_hidden_proto (__fexcepts_to_spe)
33 int __fexcepts_from_spe (int);
34 libm_hidden_proto (__fexcepts_from_spe)
36 int __fexcepts_to_prctl (int);
37 libm_hidden_proto (__fexcepts_to_prctl)
39 int __fexcepts_from_prctl (int);
40 libm_hidden_proto (__fexcepts_from_prctl)
42 void __fe_note_change (void);
43 libm_hidden_proto (__fe_note_change)
45 /* Equivalent to fegetenv, but returns an unsigned int instead of
47 #define fegetenv_register() \
48 ({ unsigned int fscr; asm volatile ("mfspefscr %0" : "=r" (fscr)); fscr; })
50 /* Equivalent to fesetenv, but takes an unsigned int instead of a
52 #define fesetenv_register(fscr) \
53 ({ asm volatile ("mtspefscr %0" : : "r" (fscr)); })
61 /* Definitions of all the SPEFSCR bit numbers. */
63 SPEFSCR_SOVH = 0x80000000,
64 SPEFSCR_OVH = 0x40000000,
65 SPEFSCR_FGH = 0x20000000,
66 SPEFSCR_FXH = 0x10000000,
67 SPEFSCR_FINVH = 0x08000000,
68 SPEFSCR_FDBZH = 0x04000000,
69 SPEFSCR_FUNFH = 0x02000000,
70 SPEFSCR_FOVFH = 0x01000000,
72 SPEFSCR_FINXS = 0x00200000,
73 SPEFSCR_FINVS = 0x00100000,
74 SPEFSCR_FDBZS = 0x00080000,
75 SPEFSCR_FUNFS = 0x00040000,
76 SPEFSCR_FOVFS = 0x00020000,
77 /* Combination of the exception bits. */
78 SPEFSCR_ALL_EXCEPT = 0x003e0000,
79 SPEFSCR_MODE = 0x00010000,
80 SPEFSCR_SOV = 0x00008000,
81 SPEFSCR_OV = 0x00004000,
82 SPEFSCR_FG = 0x00002000,
83 SPEFSCR_FX = 0x00001000,
84 SPEFSCR_FINV = 0x00000800,
85 SPEFSCR_FDBZ = 0x00000400,
86 SPEFSCR_FUNF = 0x00000200,
87 SPEFSCR_FOVF = 0x00000100,
89 SPEFSCR_FINXE = 0x00000040,
90 SPEFSCR_FINVE = 0x00000020,
91 SPEFSCR_FDBZE = 0x00000010,
92 SPEFSCR_FUNFE = 0x00000008,
93 SPEFSCR_FOVFE = 0x00000004,
94 /* Combination of the exception trap enable bits. */
95 SPEFSCR_ALL_EXCEPT_ENABLE = 0x0000007c,
96 SPEFSCR_FRMC = 0x00000003
99 #endif /* fenv_libc.h */