floatn.h 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /* Macros to control TS 18661-3 glibc features on ldbl-128 platforms.
  2. Copyright (C) 2017-2021 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. <https://www.gnu.org/licenses/>. */
  15. #ifndef _BITS_FLOATN_H
  16. #define _BITS_FLOATN_H
  17. #include <features.h>
  18. #include <bits/long-double.h>
  19. /* Defined to 1 if the current compiler invocation provides a
  20. floating-point type with the IEEE 754 binary128 format, and this
  21. glibc includes corresponding *f128 interfaces for it. */
  22. #ifndef __NO_LONG_DOUBLE_MATH
  23. # define __HAVE_FLOAT128 1
  24. #else
  25. /* glibc does not support _Float128 for platforms where long double is
  26. normally binary128 when building with long double as binary64.
  27. GCC's default for supported scalar modes does not support it either
  28. in that case. */
  29. # define __HAVE_FLOAT128 0
  30. #endif
  31. /* Defined to 1 if __HAVE_FLOAT128 is 1 and the type is ABI-distinct
  32. from the default float, double and long double types in this glibc. */
  33. #define __HAVE_DISTINCT_FLOAT128 0
  34. /* Defined to 1 if the current compiler invocation provides a
  35. floating-point type with the right format for _Float64x, and this
  36. glibc includes corresponding *f64x interfaces for it. */
  37. #define __HAVE_FLOAT64X __HAVE_FLOAT128
  38. /* Defined to 1 if __HAVE_FLOAT64X is 1 and _Float64x has the format
  39. of long double. Otherwise, if __HAVE_FLOAT64X is 1, _Float64x has
  40. the format of _Float128, which must be different from that of long
  41. double. */
  42. #define __HAVE_FLOAT64X_LONG_DOUBLE __HAVE_FLOAT128
  43. #ifndef __ASSEMBLER__
  44. /* Defined to concatenate the literal suffix to be used with _Float128
  45. types, if __HAVE_FLOAT128 is 1. */
  46. # if __HAVE_FLOAT128
  47. # if !__GNUC_PREREQ (7, 0) || defined __cplusplus
  48. /* The literal suffix f128 exists only since GCC 7.0. */
  49. # define __f128(x) x##l
  50. # else
  51. # define __f128(x) x##f128
  52. # endif
  53. # endif
  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. # define __CFLOAT128 _Complex long double
  58. # else
  59. # define __CFLOAT128 _Complex _Float128
  60. # endif
  61. # endif
  62. /* The remaining of this file provides support for older compilers. */
  63. # if __HAVE_FLOAT128
  64. /* The type _Float128 exists only since GCC 7.0. */
  65. # if !__GNUC_PREREQ (7, 0) || defined __cplusplus
  66. typedef long double _Float128;
  67. # endif
  68. /* Various built-in functions do not exist before GCC 7.0. */
  69. # if !__GNUC_PREREQ (7, 0)
  70. # define __builtin_huge_valf128() (__builtin_huge_vall ())
  71. # define __builtin_inff128() (__builtin_infl ())
  72. # define __builtin_nanf128(x) (__builtin_nanl (x))
  73. # define __builtin_nansf128(x) (__builtin_nansl (x))
  74. # endif
  75. # endif
  76. #endif /* !__ASSEMBLER__. */
  77. #include <bits/floatn-common.h>
  78. #endif /* _BITS_FLOATN_H */