]>
Commit | Line | Data |
---|---|---|
7ad6d73d | 1 | /* Inline floating-point environment handling functions for powerpc. |
568035b7 | 2 | Copyright (C) 1995-2013 Free Software Foundation, Inc. |
7ad6d73d UD |
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 | |
41bdb6e2 AJ |
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. | |
7ad6d73d UD |
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 | |
41bdb6e2 | 13 | Lesser General Public License for more details. |
7ad6d73d | 14 | |
41bdb6e2 | 15 | You should have received a copy of the GNU Lesser General Public |
59ba27a6 PE |
16 | License along with the GNU C Library; if not, see |
17 | <http://www.gnu.org/licenses/>. */ | |
7ad6d73d UD |
18 | |
19 | #if defined __GNUC__ && !defined _SOFT_FLOAT && !defined __NO_MATH_INLINES | |
20 | ||
21 | /* Inline definition for fegetround. */ | |
22 | # define fegetround() \ | |
23 | (__extension__ ({ int __fegetround_result; \ | |
f2a2deef RM |
24 | __asm__ __volatile__ \ |
25 | ("mcrfs 7,7 ; mfcr %0" \ | |
26 | : "=r"(__fegetround_result) : : "cr7"); \ | |
7ad6d73d UD |
27 | __fegetround_result & 3; })) |
28 | ||
29 | /* The weird 'i#*X' constraints on the following suppress a gcc | |
30 | warning when __excepts is not a constant. Otherwise, they mean the | |
31 | same as just plain 'i'. */ | |
32 | ||
33 | /* Inline definition for feraiseexcept. */ | |
34 | # define feraiseexcept(__excepts) \ | |
35 | ((__builtin_constant_p (__excepts) \ | |
36 | && ((__excepts) & ((__excepts)-1)) == 0 \ | |
37 | && (__excepts) != FE_INVALID) \ | |
38 | ? ((__excepts) != 0 \ | |
39 | ? (__extension__ ({ __asm__ __volatile__ \ | |
40 | ("mtfsb1 %s0" \ | |
41 | : : "i#*X"(__builtin_ffs (__excepts))); \ | |
4efb5faf GK |
42 | 0; })) \ |
43 | : 0) \ | |
7ad6d73d UD |
44 | : (feraiseexcept) (__excepts)) |
45 | ||
46 | /* Inline definition for feclearexcept. */ | |
47 | # define feclearexcept(__excepts) \ | |
48 | ((__builtin_constant_p (__excepts) \ | |
49 | && ((__excepts) & ((__excepts)-1)) == 0 \ | |
50 | && (__excepts) != FE_INVALID) \ | |
51 | ? ((__excepts) != 0 \ | |
52 | ? (__extension__ ({ __asm__ __volatile__ \ | |
53 | ("mtfsb0 %s0" \ | |
54 | : : "i#*X"(__builtin_ffs (__excepts))); \ | |
4efb5faf GK |
55 | 0; })) \ |
56 | : 0) \ | |
7ad6d73d UD |
57 | : (feclearexcept) (__excepts)) |
58 | ||
59 | #endif /* __GNUC__ && !_SOFT_FLOAT */ |