math-vector.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. /* Platform-specific SIMD declarations of math functions.
  2. Copyright (C) 2014-2026 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 _MATH_H
  16. # error "Never include <bits/math-vector.h> directly;\
  17. include <math.h> instead."
  18. #endif
  19. /* Get default empty definitions for simd declarations. */
  20. #include <bits/libm-simd-decl-stubs.h>
  21. #if defined __x86_64__ && defined __FAST_MATH__
  22. # if defined _OPENMP && _OPENMP >= 201307
  23. /* OpenMP case. */
  24. # define __DECL_SIMD_x86_64 _Pragma ("omp declare simd notinbranch")
  25. # elif __GNUC_PREREQ (6,0)
  26. /* W/o OpenMP use GCC 6.* __attribute__ ((__simd__)). */
  27. # define __DECL_SIMD_x86_64 __attribute__ ((__simd__ ("notinbranch")))
  28. # endif
  29. # ifdef __DECL_SIMD_x86_64
  30. # undef __DECL_SIMD_cos
  31. # define __DECL_SIMD_cos __DECL_SIMD_x86_64
  32. # undef __DECL_SIMD_cosf
  33. # define __DECL_SIMD_cosf __DECL_SIMD_x86_64
  34. # undef __DECL_SIMD_sin
  35. # define __DECL_SIMD_sin __DECL_SIMD_x86_64
  36. # undef __DECL_SIMD_sinf
  37. # define __DECL_SIMD_sinf __DECL_SIMD_x86_64
  38. # undef __DECL_SIMD_sincos
  39. # define __DECL_SIMD_sincos __DECL_SIMD_x86_64
  40. # undef __DECL_SIMD_sincosf
  41. # define __DECL_SIMD_sincosf __DECL_SIMD_x86_64
  42. # undef __DECL_SIMD_log
  43. # define __DECL_SIMD_log __DECL_SIMD_x86_64
  44. # undef __DECL_SIMD_logf
  45. # define __DECL_SIMD_logf __DECL_SIMD_x86_64
  46. # undef __DECL_SIMD_exp
  47. # define __DECL_SIMD_exp __DECL_SIMD_x86_64
  48. # undef __DECL_SIMD_expf
  49. # define __DECL_SIMD_expf __DECL_SIMD_x86_64
  50. # undef __DECL_SIMD_pow
  51. # define __DECL_SIMD_pow __DECL_SIMD_x86_64
  52. # undef __DECL_SIMD_powf
  53. # define __DECL_SIMD_powf __DECL_SIMD_x86_64
  54. # undef __DECL_SIMD_acos
  55. # define __DECL_SIMD_acos __DECL_SIMD_x86_64
  56. # undef __DECL_SIMD_acosf
  57. # define __DECL_SIMD_acosf __DECL_SIMD_x86_64
  58. # undef __DECL_SIMD_atan
  59. # define __DECL_SIMD_atan __DECL_SIMD_x86_64
  60. # undef __DECL_SIMD_atanf
  61. # define __DECL_SIMD_atanf __DECL_SIMD_x86_64
  62. # undef __DECL_SIMD_asin
  63. # define __DECL_SIMD_asin __DECL_SIMD_x86_64
  64. # undef __DECL_SIMD_asinf
  65. # define __DECL_SIMD_asinf __DECL_SIMD_x86_64
  66. # undef __DECL_SIMD_hypot
  67. # define __DECL_SIMD_hypot __DECL_SIMD_x86_64
  68. # undef __DECL_SIMD_hypotf
  69. # define __DECL_SIMD_hypotf __DECL_SIMD_x86_64
  70. # undef __DECL_SIMD_exp2
  71. # define __DECL_SIMD_exp2 __DECL_SIMD_x86_64
  72. # undef __DECL_SIMD_exp2f
  73. # define __DECL_SIMD_exp2f __DECL_SIMD_x86_64
  74. # undef __DECL_SIMD_exp10
  75. # define __DECL_SIMD_exp10 __DECL_SIMD_x86_64
  76. # undef __DECL_SIMD_exp10f
  77. # define __DECL_SIMD_exp10f __DECL_SIMD_x86_64
  78. # undef __DECL_SIMD_cosh
  79. # define __DECL_SIMD_cosh __DECL_SIMD_x86_64
  80. # undef __DECL_SIMD_coshf
  81. # define __DECL_SIMD_coshf __DECL_SIMD_x86_64
  82. # undef __DECL_SIMD_expm1
  83. # define __DECL_SIMD_expm1 __DECL_SIMD_x86_64
  84. # undef __DECL_SIMD_expm1f
  85. # define __DECL_SIMD_expm1f __DECL_SIMD_x86_64
  86. # undef __DECL_SIMD_sinh
  87. # define __DECL_SIMD_sinh __DECL_SIMD_x86_64
  88. # undef __DECL_SIMD_sinhf
  89. # define __DECL_SIMD_sinhf __DECL_SIMD_x86_64
  90. # undef __DECL_SIMD_cbrt
  91. # define __DECL_SIMD_cbrt __DECL_SIMD_x86_64
  92. # undef __DECL_SIMD_cbrtf
  93. # define __DECL_SIMD_cbrtf __DECL_SIMD_x86_64
  94. # undef __DECL_SIMD_atan2
  95. # define __DECL_SIMD_atan2 __DECL_SIMD_x86_64
  96. # undef __DECL_SIMD_atan2f
  97. # define __DECL_SIMD_atan2f __DECL_SIMD_x86_64
  98. # undef __DECL_SIMD_log10
  99. # define __DECL_SIMD_log10 __DECL_SIMD_x86_64
  100. # undef __DECL_SIMD_log10f
  101. # define __DECL_SIMD_log10f __DECL_SIMD_x86_64
  102. # undef __DECL_SIMD_log2
  103. # define __DECL_SIMD_log2 __DECL_SIMD_x86_64
  104. # undef __DECL_SIMD_log2f
  105. # define __DECL_SIMD_log2f __DECL_SIMD_x86_64
  106. # undef __DECL_SIMD_log1p
  107. # define __DECL_SIMD_log1p __DECL_SIMD_x86_64
  108. # undef __DECL_SIMD_log1pf
  109. # define __DECL_SIMD_log1pf __DECL_SIMD_x86_64
  110. # undef __DECL_SIMD_atanh
  111. # define __DECL_SIMD_atanh __DECL_SIMD_x86_64
  112. # undef __DECL_SIMD_atanhf
  113. # define __DECL_SIMD_atanhf __DECL_SIMD_x86_64
  114. # undef __DECL_SIMD_acosh
  115. # define __DECL_SIMD_acosh __DECL_SIMD_x86_64
  116. # undef __DECL_SIMD_acoshf
  117. # define __DECL_SIMD_acoshf __DECL_SIMD_x86_64
  118. # undef __DECL_SIMD_erf
  119. # define __DECL_SIMD_erf __DECL_SIMD_x86_64
  120. # undef __DECL_SIMD_erff
  121. # define __DECL_SIMD_erff __DECL_SIMD_x86_64
  122. # undef __DECL_SIMD_tanh
  123. # define __DECL_SIMD_tanh __DECL_SIMD_x86_64
  124. # undef __DECL_SIMD_tanhf
  125. # define __DECL_SIMD_tanhf __DECL_SIMD_x86_64
  126. # undef __DECL_SIMD_asinh
  127. # define __DECL_SIMD_asinh __DECL_SIMD_x86_64
  128. # undef __DECL_SIMD_asinhf
  129. # define __DECL_SIMD_asinhf __DECL_SIMD_x86_64
  130. # undef __DECL_SIMD_erfc
  131. # define __DECL_SIMD_erfc __DECL_SIMD_x86_64
  132. # undef __DECL_SIMD_erfcf
  133. # define __DECL_SIMD_erfcf __DECL_SIMD_x86_64
  134. # undef __DECL_SIMD_tan
  135. # define __DECL_SIMD_tan __DECL_SIMD_x86_64
  136. # undef __DECL_SIMD_tanf
  137. # define __DECL_SIMD_tanf __DECL_SIMD_x86_64
  138. # endif
  139. #endif