]>
Commit | Line | Data |
---|---|---|
fd26970f | 1 | /* FPU control word bits. SPARC version. |
d4697bc9 | 2 | Copyright (C) 1997-2014 Free Software Foundation, Inc. |
fd26970f UD |
3 | This file is part of the GNU C Library. |
4 | Contributed by Miguel de Icaza | |
5 | ||
6 | The GNU C Library is free software; you can redistribute it and/or | |
41bdb6e2 AJ |
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. | |
fd26970f UD |
10 | |
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 | |
41bdb6e2 | 14 | Lesser General Public License for more details. |
fd26970f | 15 | |
41bdb6e2 | 16 | You should have received a copy of the GNU Lesser General Public |
59ba27a6 PE |
17 | License along with the GNU C Library; if not, see |
18 | <http://www.gnu.org/licenses/>. */ | |
fd26970f UD |
19 | |
20 | #ifndef _FPU_CONTROL_H | |
21 | #define _FPU_CONTROL_H 1 | |
22 | ||
23 | ||
24 | #include <features.h> | |
d265c833 | 25 | #include <bits/wordsize.h> |
fd26970f | 26 | |
2c8aeff8 UD |
27 | /* masking of interrupts */ |
28 | #define _FPU_MASK_IM 0x08000000 | |
29 | #define _FPU_MASK_OM 0x04000000 | |
30 | #define _FPU_MASK_UM 0x02000000 | |
31 | #define _FPU_MASK_ZM 0x01000000 | |
32 | #define _FPU_MASK_PM 0x00800000 | |
33 | ||
fd26970f UD |
34 | /* precision control */ |
35 | #define _FPU_EXTENDED 0x00000000 /* RECOMMENDED */ | |
36 | #define _FPU_DOUBLE 0x20000000 | |
37 | #define _FPU_80BIT 0x30000000 | |
38 | #define _FPU_SINGLE 0x10000000 /* DO NOT USE */ | |
39 | ||
40 | /* rounding control / Sparc */ | |
63551311 UD |
41 | #define _FPU_RC_DOWN 0xc0000000 |
42 | #define _FPU_RC_UP 0x80000000 | |
fd26970f | 43 | #define _FPU_RC_ZERO 0x40000000 |
63551311 | 44 | #define _FPU_RC_NEAREST 0x0 /* RECOMMENDED */ |
fd26970f | 45 | |
63551311 | 46 | #define _FPU_RESERVED 0x30300000 /* Reserved bits in cw */ |
fd26970f UD |
47 | |
48 | ||
49 | /* Now two recommended cw */ | |
50 | ||
f41c8091 | 51 | /* Linux and IEEE default: |
fd26970f UD |
52 | - extended precision |
53 | - rounding to nearest | |
d265c833 | 54 | - no exceptions */ |
f41c8091 | 55 | #define _FPU_DEFAULT 0x0 |
fd26970f UD |
56 | #define _FPU_IEEE 0x0 |
57 | ||
fd26970f | 58 | /* Type of the control word. */ |
d265c833 UD |
59 | typedef unsigned long int fpu_control_t; |
60 | ||
61 | #if __WORDSIZE == 64 | |
842b81d6 DM |
62 | # define _FPU_GETCW(cw) __asm__ __volatile__ ("stx %%fsr,%0" : "=m" (*&cw)) |
63 | # define _FPU_SETCW(cw) __asm__ __volatile__ ("ldx %0,%%fsr" : : "m" (*&cw)) | |
d265c833 | 64 | #else |
842b81d6 DM |
65 | # define _FPU_GETCW(cw) __asm__ __volatile__ ("st %%fsr,%0" : "=m" (*&cw)) |
66 | # define _FPU_SETCW(cw) __asm__ __volatile__ ("ld %0,%%fsr" : : "m" (*&cw)) | |
d265c833 | 67 | #endif |
fd26970f UD |
68 | |
69 | /* Default control word set at startup. */ | |
70 | extern fpu_control_t __fpu_control; | |
71 | ||
fd26970f | 72 | #endif /* fpu_control.h */ |