Update copyright notices with scripts/update-copyrights
[glibc.git] / ports / sysdeps / alpha / fpu / fpu_control.h
blobb271c93951e3031c3d5590a547653760ac7f6976
1 /* FPU control word bits. Alpha-mapped-to-Intel version.
2 Copyright (C) 1996-2014 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4 Contributed by Olaf Flebbe.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library. If not, see
18 <http://www.gnu.org/licenses/>. */
20 #ifndef _ALPHA_FPU_CONTROL_H
21 #define _ALPHA_FPU_CONTROL_H
24 * Since many programs seem to hardcode the values passed to __setfpucw()
25 * (rather than using the manifest constants) we emulate the x87 interface
26 * here (at least where this makes sense).
28 * 15-13 12 11-10 9-8 7-6 5 4 3 2 1 0
29 * | reserved | IC | RC | PC | reserved | PM | UM | OM | ZM | DM | IM
31 * IM: Invalid operation mask
32 * DM: Denormalized operand mask
33 * ZM: Zero-divide mask
34 * OM: Overflow mask
35 * UM: Underflow mask
36 * PM: Precision (inexact result) mask
38 * Mask bit is 1 means no interrupt.
40 * PC: Precision control
41 * 11 - round to extended precision
42 * 10 - round to double precision
43 * 00 - round to single precision
45 * RC: Rounding control
46 * 00 - rounding to nearest
47 * 01 - rounding down (toward - infinity)
48 * 10 - rounding up (toward + infinity)
49 * 11 - rounding toward zero
51 * IC: Infinity control
52 * That is for 8087 and 80287 only.
54 * The hardware default is 0x037f. I choose 0x1372.
57 #include <features.h>
59 /* masking of interrupts */
60 #define _FPU_MASK_IM 0x01
61 #define _FPU_MASK_DM 0x02
62 #define _FPU_MASK_ZM 0x04
63 #define _FPU_MASK_OM 0x08
64 #define _FPU_MASK_UM 0x10
65 #define _FPU_MASK_PM 0x20
67 /* precision control -- without effect on Alpha */
68 #define _FPU_EXTENDED 0x300 /* RECOMMENDED */
69 #define _FPU_DOUBLE 0x200
70 #define _FPU_SINGLE 0x0 /* DO NOT USE */
73 * rounding control---notice that on the Alpha this affects only
74 * instructions with the dynamic rounding mode qualifier (/d).
76 #define _FPU_RC_NEAREST 0x000 /* RECOMMENDED */
77 #define _FPU_RC_DOWN 0x400
78 #define _FPU_RC_UP 0x800
79 #define _FPU_RC_ZERO 0xC00
81 #define _FPU_RESERVED 0xF0C0 /* Reserved bits in cw */
84 /* Now two recommended cw */
86 /* Linux default:
87 - extended precision
88 - rounding to positive infinity. There is no /p instruction
89 qualifier. By setting the dynamic rounding mode to +infinity,
90 one can use /d to get round to +infinity with no extra overhead
91 (so long as the default isn't changed, of course...)
92 - no exceptions enabled. */
94 #define _FPU_DEFAULT 0x137f
96 /* IEEE: same as above. */
97 #define _FPU_IEEE 0x137f
99 /* Type of the control word. */
100 typedef unsigned int fpu_control_t;
102 /* Default control word set at startup. */
103 extern fpu_control_t __fpu_control;
105 #endif /* _ALPHA_FPU_CONTROL */