]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/ia64/bits/floatn.h
Prefer https to http for gnu.org and fsf.org URLs
[thirdparty/glibc.git] / sysdeps / ia64 / bits / floatn.h
CommitLineData
034e7380 1/* Macros to control TS 18661-3 glibc features on ia64.
04277e02 2 Copyright (C) 2017-2019 Free Software Foundation, Inc.
034e7380
JM
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
5a82c748 17 <https://www.gnu.org/licenses/>. */
034e7380
JM
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
a23aa5b7
JM
43/* Defined to 1 if the current compiler invocation provides a
44 floating-point type with the right format for _Float64x, and this
45 glibc includes corresponding *f64x interfaces for it. */
46#define __HAVE_FLOAT64X 1
47
48/* Defined to 1 if __HAVE_FLOAT64X is 1 and _Float64x has the format
49 of long double. Otherwise, if __HAVE_FLOAT64X is 1, _Float64x has
50 the format of _Float128, which must be different from that of long
51 double. */
52#define __HAVE_FLOAT64X_LONG_DOUBLE 1
53
015c6dc2
JM
54#ifndef __ASSEMBLER__
55
034e7380
JM
56/* Defined to concatenate the literal suffix to be used with _Float128
57 types, if __HAVE_FLOAT128 is 1. */
015c6dc2
JM
58# if __HAVE_FLOAT128
59# if !__GNUC_PREREQ (7, 0) || defined __cplusplus
034e7380 60/* The literal suffix f128 exists only since GCC 7.0. */
015c6dc2
JM
61# define __f128(x) x##q
62# else
63# define __f128(x) x##f128
64# endif
034e7380 65# endif
034e7380
JM
66
67/* Defined to a complex binary128 type if __HAVE_FLOAT128 is 1. */
015c6dc2
JM
68# if __HAVE_FLOAT128
69# if !__GNUC_PREREQ (7, 0) || defined __cplusplus
034e7380
JM
70/* Add a typedef for older GCC compilers which don't natively support
71 _Complex _Float128. */
72typedef _Complex float __cfloat128 __attribute__ ((__mode__ (__TC__)));
015c6dc2
JM
73# define __CFLOAT128 __cfloat128
74# else
75# define __CFLOAT128 _Complex _Float128
76# endif
034e7380 77# endif
034e7380
JM
78
79/* The remaining of this file provides support for older compilers. */
015c6dc2 80# if __HAVE_FLOAT128
034e7380
JM
81
82/* The type _Float128 exists only since GCC 7.0. */
015c6dc2 83# if !__GNUC_PREREQ (7, 0) || defined __cplusplus
034e7380 84typedef __float128 _Float128;
015c6dc2 85# endif
034e7380
JM
86
87/* __builtin_huge_valf128 doesn't exist before GCC 7.0. */
015c6dc2
JM
88# if !__GNUC_PREREQ (7, 0)
89# define __builtin_huge_valf128() ((_Float128) __builtin_huge_val ())
90# endif
034e7380
JM
91
92/* Older GCC has only a subset of built-in functions for _Float128 on
93 ia64, and __builtin_infq is not usable in static initializers.
94 Converting a narrower sNaN to _Float128 produces a quiet NaN, so
95 attempts to use _Float128 sNaNs will not work properly with older
96 compilers. */
015c6dc2
JM
97# if !__GNUC_PREREQ (7, 0)
98# define __builtin_copysignf128 __builtin_copysignq
99# define __builtin_fabsf128 __builtin_fabsq
100# define __builtin_inff128() ((_Float128) __builtin_inf ())
101# define __builtin_nanf128(x) ((_Float128) __builtin_nan (x))
102# define __builtin_nansf128(x) ((_Float128) __builtin_nans (x))
103# endif
034e7380 104
8466ee1c
GG
105/* In math/math.h, __MATH_TG will expand signbit to __builtin_signbit*,
106 e.g.: __builtin_signbitf128, before GCC 6. However, there has never
107 been a __builtin_signbitf128 in GCC and the type-generic builtin is
108 only available since GCC 6. */
015c6dc2
JM
109# if !__GNUC_PREREQ (6, 0)
110# define __builtin_signbitf128 __signbitf128
111# endif
112
8466ee1c
GG
113# endif
114
015c6dc2 115#endif /* !__ASSEMBLER__. */
034e7380 116
797ba44b
JM
117#include <bits/floatn-common.h>
118
034e7380 119#endif /* _BITS_FLOATN_H */