Improve string benchtest timing
[platform/upstream/glibc.git] / sysdeps / powerpc / powerpc32 / e500 / nofpu / fenv_libc.h
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.
4
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.
9
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.
14
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/>.  */
18
19 #ifndef _FENV_LIBC_H
20 #define _FENV_LIBC_H    1
21
22 #include <fenv.h>
23
24 int __feraiseexcept_spe (int);
25 libm_hidden_proto (__feraiseexcept_spe)
26
27 int __feraiseexcept_soft (int);
28 libc_hidden_proto (__feraiseexcept_soft)
29
30 int __fexcepts_to_spe (int);
31 libm_hidden_proto (__fexcepts_to_spe)
32
33 int __fexcepts_from_spe (int);
34 libm_hidden_proto (__fexcepts_from_spe)
35
36 int __fexcepts_to_prctl (int);
37 libm_hidden_proto (__fexcepts_to_prctl)
38
39 int __fexcepts_from_prctl (int);
40 libm_hidden_proto (__fexcepts_from_prctl)
41
42 void __fe_note_change (void);
43 libm_hidden_proto (__fe_note_change)
44
45 /* Equivalent to fegetenv, but returns an unsigned int instead of
46    taking a pointer.  */
47 #define fegetenv_register() \
48   ({ unsigned int fscr; asm volatile ("mfspefscr %0" : "=r" (fscr)); fscr; })
49
50 /* Equivalent to fesetenv, but takes an unsigned int instead of a
51    pointer.  */
52 #define fesetenv_register(fscr) \
53   ({ asm volatile ("mtspefscr %0" : : "r" (fscr)); })
54
55 typedef union
56 {
57   fenv_t fenv;
58   unsigned int l[2];
59 } fenv_union_t;
60
61 /* Definitions of all the SPEFSCR bit numbers.  */
62 enum {
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,
71   /* 2 unused bits.  */
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,
88   /* 1 unused bit.  */
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
97 };
98
99 #endif /* fenv_libc.h */