]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/hppa/fpu/bits/fenv.h
Update copyright dates with scripts/update-copyrights.
[thirdparty/glibc.git] / sysdeps / hppa / fpu / bits / fenv.h
CommitLineData
04277e02 1/* Copyright (C) 2000-2019 Free Software Foundation, Inc.
fb0f0053
UD
2 This file is part of the GNU C Library.
3 Contributed by David Huggins-Daines <dhd@debian.org>
4
5 The GNU C Library is free software; you can redistribute it and/or
3214b89b
AJ
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.
fb0f0053
UD
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
3214b89b 13 Lesser General Public License for more details.
fb0f0053 14
3214b89b 15 You should have received a copy of the GNU Lesser General Public
ab84e3ff
PE
16 License along with the GNU C Library. If not, see
17 <http://www.gnu.org/licenses/>. */
fb0f0053
UD
18
19#ifndef _FENV_H
20# error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
21#endif
22
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). */
27enum
28{
fbeafede
JM
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,
fb0f0053
UD
44};
45
46#define FE_ALL_EXCEPT \
47 (FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID)
48
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. */
52enum
53 {
fbeafede
JM
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,
fb0f0053
UD
66 };
67
68/* Type representing exception flags. */
69typedef unsigned int fexcept_t;
70
71/* Type representing floating-point environment. This structure
72 corresponds to the layout of the status and exception words in the
48dcf1c5
CD
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
5556231d 77 then use assembly to store fr0. This is a performance hit, but
48dcf1c5 78 means the ABI is stable. */
fb0f0053
UD
79typedef struct
80{
81 unsigned int __status_word;
82 unsigned int __exception[7];
83} fenv_t;
84
85/* If the default argument is used we use this value. */
acfa885f 86#define FE_DFL_ENV ((const fenv_t *) -1)
fb0f0053
UD
87
88#ifdef __USE_GNU
89/* Floating-point environment where none of the exceptions are masked. */
acfa885f 90# define FE_NOMASK_ENV ((const fenv_t *) -2)
fb0f0053 91#endif
ec94343f
JM
92
93#if __GLIBC_USE (IEC_60559_BFP_EXT)
94/* Type representing floating-point control modes. */
95typedef unsigned int femode_t;
96
97/* Default floating-point control modes. */
98# define FE_DFL_MODE ((const femode_t *) -1L)
99#endif