Update.
[glibc.git] / sysdeps / sparc / fpu_control.h
blob5ef38247027e04fa7635232fd54f362abd947108
1 /* FPU control word bits. SPARC version.
2 Copyright (C) 1997 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4 Contributed by Miguel de Icaza
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public License as
8 published by the Free Software Foundation; either version 2 of the
9 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 Library General Public License for more details.
16 You should have received a copy of the GNU Library General Public
17 License along with the GNU C Library; see the file COPYING.LIB. If not,
18 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
21 #ifndef _FPU_CONTROL_H
22 #define _FPU_CONTROL_H 1
25 #include <features.h>
27 /* precision control */
28 #define _FPU_EXTENDED 0x00000000 /* RECOMMENDED */
29 #define _FPU_DOUBLE 0x20000000
30 #define _FPU_80BIT 0x30000000
31 #define _FPU_SINGLE 0x10000000 /* DO NOT USE */
33 /* rounding control / Sparc */
34 #define _FPU_RC_DOWN 0xc0000000
35 #define _FPU_RC_UP 0x80000000
36 #define _FPU_RC_ZERO 0x40000000
37 #define _FPU_RC_NEAREST 0x0 /* RECOMMENDED */
39 #define _FPU_RESERVED 0x30300000 /* Reserved bits in cw */
42 /* Now two recommended cw */
44 /* Linux default:
45 - extended precision
46 - rounding to nearest
47 - exceptions on overflow, zero divide and NaN */
48 #define _FPU_DEFAULT 0x1e
50 /* IEEE: same as above, but exceptions */
51 #define _FPU_IEEE 0x0
53 /* Type of the control word. */
54 typedef unsigned int fpu_control_t;
56 #define _FPU_GETCW(cw) __asm__ ("st %%fsr,%0" : "=m" (*&cw))
57 #define _FPU_SETCW(cw) __asm__ ("ld %0,%%fsr" : : "m" (*&cw))
59 /* Default control word set at startup. */
60 extern fpu_control_t __fpu_control;
62 __BEGIN_DECLS
64 /* Called at startup. It can be used to manipulate fpu control register. */
65 extern void __setfpucw __P ((fpu_control_t));
67 __END_DECLS
69 #endif /* fpu_control.h */