]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/powerpc/fpu_control.h
Remove support for PowerPC SPE extension (powerpc*-*-*gnuspe*).
[thirdparty/glibc.git] / sysdeps / powerpc / fpu_control.h
1 /* FPU control word definitions. PowerPC version.
2 Copyright (C) 1996-2019 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
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.
9
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.
14
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 <http://www.gnu.org/licenses/>. */
18
19 #ifndef _FPU_CONTROL_H
20 #define _FPU_CONTROL_H
21
22 #if defined __SPE__ || (defined __NO_FPRS__ && !defined _SOFT_FLOAT)
23 # error "SPE/e500 is no longer supported"
24 #endif
25
26 #ifdef _SOFT_FLOAT
27
28 # define _FPU_RESERVED 0xffffffff
29 # define _FPU_DEFAULT 0x00000000 /* Default value. */
30 typedef unsigned int fpu_control_t;
31 # define _FPU_GETCW(cw) (cw) = 0
32 # define _FPU_SETCW(cw) (void) (cw)
33 extern fpu_control_t __fpu_control;
34
35 #else /* PowerPC 6xx floating-point. */
36
37 /* rounding control */
38 # define _FPU_RC_NEAREST 0x00 /* RECOMMENDED */
39 # define _FPU_RC_DOWN 0x03
40 # define _FPU_RC_UP 0x02
41 # define _FPU_RC_ZERO 0x01
42
43 # define _FPU_MASK_NI 0x04 /* non-ieee mode */
44
45 /* masking of interrupts */
46 # define _FPU_MASK_ZM 0x10 /* zero divide */
47 # define _FPU_MASK_OM 0x40 /* overflow */
48 # define _FPU_MASK_UM 0x20 /* underflow */
49 # define _FPU_MASK_XM 0x08 /* inexact */
50 # define _FPU_MASK_IM 0x80 /* invalid operation */
51
52 # define _FPU_RESERVED 0xffffff00 /* These bits are reserved are not changed. */
53
54 /* The fdlibm code requires no interrupts for exceptions. */
55 # define _FPU_DEFAULT 0x00000000 /* Default value. */
56
57 /* IEEE: same as above, but (some) exceptions;
58 we leave the 'inexact' exception off.
59 */
60 # define _FPU_IEEE 0x000000f0
61
62 /* Type of the control word. */
63 typedef unsigned int fpu_control_t;
64
65 /* Macros for accessing the hardware control word. */
66 # define _FPU_GETCW(cw) \
67 ({union { double __d; unsigned long long __ll; } __u; \
68 register double __fr; \
69 __asm__ ("mffs %0" : "=f" (__fr)); \
70 __u.__d = __fr; \
71 (cw) = (fpu_control_t) __u.__ll; \
72 (fpu_control_t) __u.__ll; \
73 })
74
75 # define _FPU_SETCW(cw) \
76 { union { double __d; unsigned long long __ll; } __u; \
77 register double __fr; \
78 __u.__ll = 0xfff80000LL << 32; /* This is a QNaN. */ \
79 __u.__ll |= (cw) & 0xffffffffLL; \
80 __fr = __u.__d; \
81 __asm__ ("mtfsf 255,%0" : : "f" (__fr)); \
82 }
83
84 /* Default control word set at startup. */
85 extern fpu_control_t __fpu_control;
86
87 #endif /* PowerPC 6xx floating-point. */
88
89 #endif /* _FPU_CONTROL_H */