Update copyright notices with scripts/update-copyrights
[glibc.git] / ports / sysdeps / hppa / fpu / bits / fenv.h
blobb675ea4c1588f569c29fbbeccb719b5f847516b4
1 /* Copyright (C) 2000-2014 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by David Huggins-Daines <dhd@debian.org>
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/>. */
19 #ifndef _FENV_H
20 # error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
21 #endif
23 /* Define bits representing the exception. We use the values of the
24 appropriate enable bits in the FPU status word (which,
25 coincidentally, are the same as the flag bits, but shifted right by
26 27 bits). */
27 enum
29 FE_INVALID =
30 #define FE_INVALID (1<<4) /* V */
31 FE_INVALID,
32 FE_DIVBYZERO =
33 #define FE_DIVBYZERO (1<<3) /* Z */
34 FE_DIVBYZERO,
35 FE_OVERFLOW =
36 #define FE_OVERFLOW (1<<2) /* O */
37 FE_OVERFLOW,
38 FE_UNDERFLOW =
39 #define FE_UNDERFLOW (1<<1) /* U */
40 FE_UNDERFLOW,
41 FE_INEXACT =
42 #define FE_INEXACT (1<<0) /* I */
43 FE_INEXACT,
46 #define FE_ALL_EXCEPT \
47 (FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID)
49 /* The PA-RISC FPU supports all of the four defined rounding modes.
50 We use the values of the RM field in the floating point status
51 register for the appropriate macros. */
52 enum
54 FE_TONEAREST =
55 #define FE_TONEAREST (0 << 9)
56 FE_TONEAREST,
57 FE_TOWARDZERO =
58 #define FE_TOWARDZERO (1 << 9)
59 FE_TOWARDZERO,
60 FE_UPWARD =
61 #define FE_UPWARD (2 << 9)
62 FE_UPWARD,
63 FE_DOWNWARD =
64 #define FE_DOWNWARD (3 << 9)
65 FE_DOWNWARD,
68 /* Type representing exception flags. */
69 typedef unsigned int fexcept_t;
71 /* Type representing floating-point environment. This structure
72 corresponds to the layout of the status and exception words in the
73 register file. The exception registers are never saved/stored by
74 userspace. This structure is also not correctly aligned ever, in
75 an ABI error we left out __aligned(8) and subsequently all of our
76 fenv functions must accept unaligned input, align the input, and
77 then use assembly to store fr0. This is a performance hit, but
78 means the ABI is stable. */
79 typedef struct
81 unsigned int __status_word;
82 unsigned int __exception[7];
83 } fenv_t;
85 /* If the default argument is used we use this value. */
86 #define FE_DFL_ENV ((const fenv_t *) -1)
88 #ifdef __USE_GNU
89 /* Floating-point environment where none of the exceptions are masked. */
90 # define FE_NOMASK_ENV ((const fenv_t *) -2)
91 #endif