1 /* FPU control word bits. SPARC version.
2 Copyright (C) 1997-2024 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
19 #ifndef _FPU_CONTROL_H
20 #define _FPU_CONTROL_H 1
24 #include <bits/wordsize.h>
26 /* masking of interrupts */
27 #define _FPU_MASK_IM 0x08000000
28 #define _FPU_MASK_OM 0x04000000
29 #define _FPU_MASK_UM 0x02000000
30 #define _FPU_MASK_ZM 0x01000000
31 #define _FPU_MASK_PM 0x00800000
33 /* precision control */
34 #define _FPU_EXTENDED 0x00000000 /* RECOMMENDED */
35 #define _FPU_DOUBLE 0x20000000
36 #define _FPU_80BIT 0x30000000
37 #define _FPU_SINGLE 0x10000000 /* DO NOT USE */
39 /* rounding control / Sparc */
40 #define _FPU_RC_DOWN 0xc0000000
41 #define _FPU_RC_UP 0x80000000
42 #define _FPU_RC_ZERO 0x40000000
43 #define _FPU_RC_NEAREST 0x0 /* RECOMMENDED */
45 #define _FPU_RESERVED 0x30300000 /* Reserved bits in cw */
48 /* Now two recommended cw */
50 /* Linux and IEEE default:
54 #define _FPU_DEFAULT 0x0
57 /* Type of the control word. */
58 typedef unsigned long int fpu_control_t
;
61 # define _FPU_GETCW(cw) __asm__ __volatile__ ("stx %%fsr,%0" : "=m" (*&cw))
62 # define _FPU_SETCW(cw) __asm__ __volatile__ ("ldx %0,%%fsr" : : "m" (*&cw))
65 /* Prevent stfsr from being placed directly after other fp instruction. */
66 # define _FPU_GETCW(cw) __asm__ __volatile__ ("nop; st %%fsr,%0" : "=m" (*&cw))
68 # define _FPU_GETCW(cw) __asm__ __volatile__ ("st %%fsr,%0" : "=m" (*&cw))
70 # define _FPU_SETCW(cw) __asm__ __volatile__ ("ld %0,%%fsr" : : "m" (*&cw))
73 /* Default control word set at startup. */
74 extern fpu_control_t __fpu_control
;
76 #endif /* fpu_control.h */