1 /* FPU control word bits. Alpha-mapped-to-Intel version.
2 Copyright (C) 1996, 1998, 2000, 2002 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, write to the Free
18 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21 #ifndef _ALPHA_FPU_CONTROL_H
22 #define _ALPHA_FPU_CONTROL_H
25 * Since many programs seem to hardcode the values passed to __setfpucw()
26 * (rather than using the manifest constants) we emulate the x87 interface
27 * here (at least where this makes sense).
29 * 15-13 12 11-10 9-8 7-6 5 4 3 2 1 0
30 * | reserved | IC | RC | PC | reserved | PM | UM | OM | ZM | DM | IM
32 * IM: Invalid operation mask
33 * DM: Denormalized operand mask
34 * ZM: Zero-divide mask
37 * PM: Precision (inexact result) mask
39 * Mask bit is 1 means no interrupt.
41 * PC: Precision control
42 * 11 - round to extended precision
43 * 10 - round to double precision
44 * 00 - round to single precision
46 * RC: Rounding control
47 * 00 - rounding to nearest
48 * 01 - rounding down (toward - infinity)
49 * 10 - rounding up (toward + infinity)
50 * 11 - rounding toward zero
52 * IC: Infinity control
53 * That is for 8087 and 80287 only.
55 * The hardware default is 0x037f. I choose 0x1372.
60 /* masking of interrupts */
61 #define _FPU_MASK_IM 0x01
62 #define _FPU_MASK_DM 0x02
63 #define _FPU_MASK_ZM 0x04
64 #define _FPU_MASK_OM 0x08
65 #define _FPU_MASK_UM 0x10
66 #define _FPU_MASK_PM 0x20
68 /* precision control -- without effect on Alpha */
69 #define _FPU_EXTENDED 0x300 /* RECOMMENDED */
70 #define _FPU_DOUBLE 0x200
71 #define _FPU_SINGLE 0x0 /* DO NOT USE */
74 * rounding control---notice that on the Alpha this affects only
75 * instructions with the dynamic rounding mode qualifier (/d).
77 #define _FPU_RC_NEAREST 0x000 /* RECOMMENDED */
78 #define _FPU_RC_DOWN 0x400
79 #define _FPU_RC_UP 0x800
80 #define _FPU_RC_ZERO 0xC00
82 #define _FPU_RESERVED 0xF0C0 /* Reserved bits in cw */
85 /* Now two recommended cw */
89 - rounding to positive infinity. There is no /p instruction
90 qualifier. By setting the dynamic rounding mode to +infinity,
91 one can use /d to get round to +infinity with no extra overhead
92 (so long as the default isn't changed, of course...)
93 - no exceptions enabled. */
95 #define _FPU_DEFAULT 0x137f
97 /* IEEE: same as above. */
98 #define _FPU_IEEE 0x137f
100 /* Type of the control word. */
101 typedef unsigned int fpu_control_t
;
103 /* Default control word set at startup. */
104 extern fpu_control_t __fpu_control
;
106 #endif /* _ALPHA_FPU_CONTROL */