Add Changelog ...
[glibc.git] / sysdeps / am33 / fpu / fpu_control.h
blobde28228e7182627e5ffa361c0932e5f5bf79d363
1 /* FPU control word bits. AM33/2.0 version.
2 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004
3 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
5 Contributed by Alexandre Oliva <aoliva@redhat.com>
6 based on the corresponding file in the mips port.
8 The GNU C Library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Lesser General Public
10 License as published by the Free Software Foundation; either
11 version 2.1 of the License, or (at your option) any later version.
13 The GNU C Library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
18 You should have received a copy of the GNU Lesser General Public
19 License along with the GNU C Library. If not, see
20 <http://www.gnu.org/licenses/>. */
22 #ifndef _FPU_CONTROL_H
23 #define _FPU_CONTROL_H
25 /* AM33/2.0 FPU floating point control register bits.
27 * 31-22 -> reserved
28 * 21-18 -> floating-point condition codes (L, G, E, U)
29 * 17-16 -> rounding modes (00 is to-nearest; other values are reserved
30 * 15 -> reserved (read as 0, write with 0)
31 * 14-10 -> Exception Cause (inValid, divZero, Overflow, Underflow, Inexact)
32 * 9- 5 -> Exception Enable
33 * 4- 0 -> Exception Flag, cleared when exception cause is set
36 #include <features.h>
37 #include <fenv.h>
39 /* masking of interrupts */
40 #define _FPU_MASK_V 0x0200 /* Invalid operation */
41 #define _FPU_MASK_Z 0x0100 /* Division by zero */
42 #define _FPU_MASK_O 0x0080 /* Overflow */
43 #define _FPU_MASK_U 0x0040 /* Underflow */
44 #define _FPU_MASK_I 0x0020 /* Inexact operation */
46 /* rounding control */
47 #define _FPU_RC_NEAREST 0x0 /* Only available mode */
49 #define _FPU_RESERVED 0xffc08000 /* Reserved bits in fpcr */
52 /* The fdlibm code requires strict IEEE double precision arithmetic,
53 and no interrupts for exceptions, rounding to nearest. */
55 #define _FPU_DEFAULT 0x0000001f
57 /* IEEE: same as above, but exceptions */
58 #define _FPU_IEEE 0x000003ff
60 /* Type of the control word. */
61 typedef unsigned int fpu_control_t;
63 /* Macros for accessing the hardware control word. _FPU_SETCW is
64 defined such that it won't modify the EF bits, that are cleared
65 when assigned bits that are set. Use SETFCW to get them actually
66 reset. */
67 #define _FPU_SETFCW(cw) __asm__ ("fmov %0,fpcr" : : "ri" (cw))
68 #define _FPU_SETCW(cw) _FPU_SETFCW((cw) & ~FE_ALL_EXCEPT)
69 #define _FPU_GETCW(cw) __asm__ ("fmov fpcr,%0" : "=r" (cw))
71 /* Default control word set at startup. */
72 extern fpu_control_t __fpu_control;
74 #endif /* fpu_control.h */