]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/s390/fpu/bits/fenv.h
81732b9972db4dd613e67b5f08d7886dfcf7d921
[thirdparty/glibc.git] / sysdeps / s390 / fpu / bits / fenv.h
1 /* Copyright (C) 2000 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com).
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 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 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If not,
17 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19
20 */
21
22 #ifndef _FENV_H
23 # error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
24 #endif
25
26 /* Define bits representing the exception. We use the bit positions
27 of the appropriate bits in the FPU control word. */
28 enum
29 {
30 FE_INVALID = 0x80,
31 #define FE_INVALID FE_INVALID
32 FE_DIVBYZERO = 0x40,
33 #define FE_DIVBYZERO FE_DIVBYZERO
34 FE_OVERFLOW = 0x20,
35 #define FE_OVERFLOW FE_OVERFLOW
36 FE_UNDERFLOW = 0x10,
37 #define FE_UNDERFLOW FE_UNDERFLOW
38 FE_INEXACT = 0x08
39 #define FE_INEXACT FE_INEXACT
40 };
41 /* We dont use the y bit of the DXC in the floating point control register
42 * as glibc has no FE encoding for fe inexact incremented
43 * or fe inexact truncated.
44 * We currently use the flag bits in the fpc
45 * as these are sticky for feholdenv & feupdatenv as it is defined
46 * in the HP Manpages.
47 */
48
49
50 #define FE_ALL_EXCEPT \
51 (FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID)
52
53 enum
54 {
55 FE_TONEAREST = 0,
56 #define FE_TONEAREST FE_TONEAREST
57 FE_DOWNWARD = 0x3,
58 #define FE_DOWNWARD FE_DOWNWARD
59 FE_UPWARD = 0x2,
60 #define FE_UPWARD FE_UPWARD
61 FE_TOWARDZERO = 0x1
62 #define FE_TOWARDZERO FE_TOWARDZERO
63 };
64
65 #define FPC_EXCEPTION_MASK_SHIFT 24
66 #define FPC_FLAGS_SHIFT 16
67 #define FPC_DXC_SHIFT 8
68 #define FPC_NOT_FPU_EXCEPTION 0x300
69
70
71 /* Type representing exception flags. */
72 typedef unsigned int fexcept_t; /* size of fpc */
73
74
75 /* Type representing floating-point environment. This function corresponds
76 to the layout of the block written by the `fstenv'. */
77 typedef struct
78 {
79 fexcept_t fpc;
80 void *ieee_instruction_pointer;
81 /* failing instruction for ieee exceptions */
82 } fenv_t;
83
84 /* If the default argument is used we use this value. */
85 #define FE_DFL_ENV ((fenv_t *) -1)
86
87 #ifdef __USE_GNU
88 /* Floating-point environment where none of the exceptions are masked. */
89 #define FE_NOMASK_ENV ((fenv_t *) -2)
90 #endif