]>
Commit | Line | Data |
---|---|---|
034e7380 JM |
1 | /* Macros to control TS 18661-3 glibc features on ia64. |
2 | Copyright (C) 2017 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 _BITS_FLOATN_H | |
20 | #define _BITS_FLOATN_H | |
21 | ||
22 | #include <features.h> | |
23 | ||
24 | /* Defined to 1 if the current compiler invocation provides a | |
25 | floating-point type with the IEEE 754 binary128 format, and this | |
26 | glibc includes corresponding *f128 interfaces for it. The required | |
27 | libgcc support was added some time after the basic compiler | |
28 | support. */ | |
29 | #if __GNUC_PREREQ (4, 4) | |
30 | # define __HAVE_FLOAT128 1 | |
31 | #else | |
32 | # define __HAVE_FLOAT128 0 | |
33 | #endif | |
34 | ||
35 | /* Defined to 1 if __HAVE_FLOAT128 is 1 and the type is ABI-distinct | |
36 | from the default float, double and long double types in this glibc. */ | |
37 | #if __HAVE_FLOAT128 | |
38 | # define __HAVE_DISTINCT_FLOAT128 1 | |
39 | #else | |
40 | # define __HAVE_DISTINCT_FLOAT128 0 | |
41 | #endif | |
42 | ||
43 | /* Defined to concatenate the literal suffix to be used with _Float128 | |
44 | types, if __HAVE_FLOAT128 is 1. */ | |
45 | #if __HAVE_FLOAT128 | |
46 | # if !__GNUC_PREREQ (7, 0) || defined __cplusplus | |
47 | /* The literal suffix f128 exists only since GCC 7.0. */ | |
48 | # define __f128(x) x##q | |
49 | # else | |
50 | # define __f128(x) x##f128 | |
51 | # endif | |
52 | #endif | |
53 | ||
54 | /* Defined to a complex binary128 type if __HAVE_FLOAT128 is 1. */ | |
55 | #if __HAVE_FLOAT128 | |
56 | # if !__GNUC_PREREQ (7, 0) || defined __cplusplus | |
57 | /* Add a typedef for older GCC compilers which don't natively support | |
58 | _Complex _Float128. */ | |
59 | typedef _Complex float __cfloat128 __attribute__ ((__mode__ (__TC__))); | |
60 | # define __CFLOAT128 __cfloat128 | |
61 | # else | |
62 | # define __CFLOAT128 _Complex _Float128 | |
63 | # endif | |
64 | #endif | |
65 | ||
66 | /* The remaining of this file provides support for older compilers. */ | |
67 | #if __HAVE_FLOAT128 | |
68 | ||
69 | /* The type _Float128 exists only since GCC 7.0. */ | |
70 | # if !__GNUC_PREREQ (7, 0) || defined __cplusplus | |
71 | typedef __float128 _Float128; | |
72 | # endif | |
73 | ||
74 | /* __builtin_huge_valf128 doesn't exist before GCC 7.0. */ | |
75 | # if !__GNUC_PREREQ (7, 0) | |
76 | # define __builtin_huge_valf128() ((_Float128) __builtin_huge_val ()) | |
77 | # endif | |
78 | ||
79 | /* Older GCC has only a subset of built-in functions for _Float128 on | |
80 | ia64, and __builtin_infq is not usable in static initializers. | |
81 | Converting a narrower sNaN to _Float128 produces a quiet NaN, so | |
82 | attempts to use _Float128 sNaNs will not work properly with older | |
83 | compilers. */ | |
84 | # if !__GNUC_PREREQ (7, 0) | |
85 | # define __builtin_copysignf128 __builtin_copysignq | |
86 | # define __builtin_fabsf128 __builtin_fabsq | |
87 | # define __builtin_inff128() ((_Float128) __builtin_inf ()) | |
88 | # define __builtin_nanf128(x) ((_Float128) __builtin_nan (x)) | |
89 | # define __builtin_nansf128(x) ((_Float128) __builtin_nans (x)) | |
90 | # endif | |
91 | ||
92 | #endif | |
93 | ||
94 | #endif /* _BITS_FLOATN_H */ |