]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/powerpc/bits/fenvinline.h
Update copyright dates with scripts/update-copyrights.
[thirdparty/glibc.git] / sysdeps / powerpc / bits / fenvinline.h
1 /* Inline floating-point environment handling functions for powerpc.
2 Copyright (C) 1995-2015 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 #if defined __GNUC__ && !defined _SOFT_FLOAT && !defined __NO_FPRS__
20
21 /* Inline definition for fegetround. */
22 # define __fegetround() \
23 (__extension__ ({ int __fegetround_result; \
24 __asm__ __volatile__ \
25 ("mcrfs 7,7 ; mfcr %0" \
26 : "=r"(__fegetround_result) : : "cr7"); \
27 __fegetround_result & 3; }))
28 # define fegetround() __fegetround ()
29
30 # ifndef __NO_MATH_INLINES
31 /* The weird 'i#*X' constraints on the following suppress a gcc
32 warning when __excepts is not a constant. Otherwise, they mean the
33 same as just plain 'i'. */
34
35 /* Inline definition for feraiseexcept. */
36 # define feraiseexcept(__excepts) \
37 ((__builtin_constant_p (__excepts) \
38 && ((__excepts) & ((__excepts)-1)) == 0 \
39 && (__excepts) != FE_INVALID) \
40 ? ((__excepts) != 0 \
41 ? (__extension__ ({ __asm__ __volatile__ \
42 ("mtfsb1 %s0" \
43 : : "i#*X"(__builtin_ffs (__excepts))); \
44 0; })) \
45 : 0) \
46 : (feraiseexcept) (__excepts))
47
48 /* Inline definition for feclearexcept. */
49 # define feclearexcept(__excepts) \
50 ((__builtin_constant_p (__excepts) \
51 && ((__excepts) & ((__excepts)-1)) == 0 \
52 && (__excepts) != FE_INVALID) \
53 ? ((__excepts) != 0 \
54 ? (__extension__ ({ __asm__ __volatile__ \
55 ("mtfsb0 %s0" \
56 : : "i#*X"(__builtin_ffs (__excepts))); \
57 0; })) \
58 : 0) \
59 : (feclearexcept) (__excepts))
60
61 # endif /* !__NO_MATH_INLINES. */
62
63 #endif /* __GNUC__ && !_SOFT_FLOAT && !__NO_FPRS__ */