floatn.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /* Macros to control TS 18661-3 glibc features on ia64.
  2. Copyright (C) 2017-2019 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, see
  14. <http://www.gnu.org/licenses/>. */
  15. #ifndef _BITS_FLOATN_H
  16. #define _BITS_FLOATN_H
  17. #include <features.h>
  18. /* Defined to 1 if the current compiler invocation provides a
  19. floating-point type with the IEEE 754 binary128 format, and this
  20. glibc includes corresponding *f128 interfaces for it. The required
  21. libgcc support was added some time after the basic compiler
  22. support. */
  23. #if __GNUC_PREREQ (4, 4)
  24. # define __HAVE_FLOAT128 1
  25. #else
  26. # define __HAVE_FLOAT128 0
  27. #endif
  28. /* Defined to 1 if __HAVE_FLOAT128 is 1 and the type is ABI-distinct
  29. from the default float, double and long double types in this glibc. */
  30. #if __HAVE_FLOAT128
  31. # define __HAVE_DISTINCT_FLOAT128 1
  32. #else
  33. # define __HAVE_DISTINCT_FLOAT128 0
  34. #endif
  35. /* Defined to 1 if the current compiler invocation provides a
  36. floating-point type with the right format for _Float64x, and this
  37. glibc includes corresponding *f64x interfaces for it. */
  38. #define __HAVE_FLOAT64X 1
  39. /* Defined to 1 if __HAVE_FLOAT64X is 1 and _Float64x has the format
  40. of long double. Otherwise, if __HAVE_FLOAT64X is 1, _Float64x has
  41. the format of _Float128, which must be different from that of long
  42. double. */
  43. #define __HAVE_FLOAT64X_LONG_DOUBLE 1
  44. #ifndef __ASSEMBLER__
  45. /* Defined to concatenate the literal suffix to be used with _Float128
  46. types, if __HAVE_FLOAT128 is 1. */
  47. # if __HAVE_FLOAT128
  48. # if !__GNUC_PREREQ (7, 0) || defined __cplusplus
  49. /* The literal suffix f128 exists only since GCC 7.0. */
  50. # define __f128(x) x##q
  51. # else
  52. # define __f128(x) x##f128
  53. # endif
  54. # endif
  55. /* Defined to a complex binary128 type if __HAVE_FLOAT128 is 1. */
  56. # if __HAVE_FLOAT128
  57. # if !__GNUC_PREREQ (7, 0) || defined __cplusplus
  58. /* Add a typedef for older GCC compilers which don't natively support
  59. _Complex _Float128. */
  60. typedef _Complex float __cfloat128 __attribute__ ((__mode__ (__TC__)));
  61. # define __CFLOAT128 __cfloat128
  62. # else
  63. # define __CFLOAT128 _Complex _Float128
  64. # endif
  65. # endif
  66. /* The remaining of this file provides support for older compilers. */
  67. # if __HAVE_FLOAT128
  68. /* The type _Float128 exists only since GCC 7.0. */
  69. # if !__GNUC_PREREQ (7, 0) || defined __cplusplus
  70. typedef __float128 _Float128;
  71. # endif
  72. /* __builtin_huge_valf128 doesn't exist before GCC 7.0. */
  73. # if !__GNUC_PREREQ (7, 0)
  74. # define __builtin_huge_valf128() ((_Float128) __builtin_huge_val ())
  75. # endif
  76. /* Older GCC has only a subset of built-in functions for _Float128 on
  77. ia64, and __builtin_infq is not usable in static initializers.
  78. Converting a narrower sNaN to _Float128 produces a quiet NaN, so
  79. attempts to use _Float128 sNaNs will not work properly with older
  80. compilers. */
  81. # if !__GNUC_PREREQ (7, 0)
  82. # define __builtin_copysignf128 __builtin_copysignq
  83. # define __builtin_fabsf128 __builtin_fabsq
  84. # define __builtin_inff128() ((_Float128) __builtin_inf ())
  85. # define __builtin_nanf128(x) ((_Float128) __builtin_nan (x))
  86. # define __builtin_nansf128(x) ((_Float128) __builtin_nans (x))
  87. # endif
  88. /* In math/math.h, __MATH_TG will expand signbit to __builtin_signbit*,
  89. e.g.: __builtin_signbitf128, before GCC 6. However, there has never
  90. been a __builtin_signbitf128 in GCC and the type-generic builtin is
  91. only available since GCC 6. */
  92. # if !__GNUC_PREREQ (6, 0)
  93. # define __builtin_signbitf128 __signbitf128
  94. # endif
  95. # endif
  96. #endif /* !__ASSEMBLER__. */
  97. #include <bits/floatn-common.h>
  98. #endif /* _BITS_FLOATN_H */