math-vector.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. //
  2. // Copyright 2026 Aarav Ravindra Kharade
  3. //
  4. // Licensed under the Apache License, Version 2.0 (the "License");
  5. // you may not use this file except in compliance with the License.
  6. // You may obtain a copy of the License at
  7. //
  8. // http://www.apache.org/licenses/LICENSE-2.0
  9. //
  10. // Unless required by applicable law or agreed to in writing, software
  11. // distributed under the License is distributed on an "AS IS" BASIS,
  12. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. // See the License for the specific language governing permissions and
  14. // limitations under the License.
  15. //
  16. /* Platform-specific SIMD declarations of math functions.
  17. Copyright (C) 2014-2026 Free Software Foundation, Inc.
  18. This file is part of the GNU C Library.
  19. The GNU C Library is free software; you can redistribute it and/or
  20. modify it under the terms of the GNU Lesser General Public
  21. License as published by the Free Software Foundation; either
  22. version 2.1 of the License, or (at your option) any later version.
  23. The GNU C Library is distributed in the hope that it will be useful,
  24. but WITHOUT ANY WARRANTY; without even the implied warranty of
  25. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  26. Lesser General Public License for more details.
  27. You should have received a copy of the GNU Lesser General Public
  28. License along with the GNU C Library; if not, see
  29. <https://www.gnu.org/licenses/>. */
  30. #ifndef _MATH_H
  31. # error "Never include <bits/math-vector.h> directly;\
  32. include <math.h> instead."
  33. #endif
  34. /* Get default empty definitions for simd declarations. */
  35. #include <bits/libm-simd-decl-stubs.h>
  36. #if defined __x86_64__ && defined __FAST_MATH__
  37. # if defined _OPENMP && _OPENMP >= 201307
  38. /* OpenMP case. */
  39. # define __DECL_SIMD_x86_64 _Pragma ("omp declare simd notinbranch")
  40. # elif __GNUC_PREREQ (6,0)
  41. /* W/o OpenMP use GCC 6.* __attribute__ ((__simd__)). */
  42. # define __DECL_SIMD_x86_64 __attribute__ ((__simd__ ("notinbranch")))
  43. # endif
  44. # ifdef __DECL_SIMD_x86_64
  45. # undef __DECL_SIMD_cos
  46. # define __DECL_SIMD_cos __DECL_SIMD_x86_64
  47. # undef __DECL_SIMD_cosf
  48. # define __DECL_SIMD_cosf __DECL_SIMD_x86_64
  49. # undef __DECL_SIMD_sin
  50. # define __DECL_SIMD_sin __DECL_SIMD_x86_64
  51. # undef __DECL_SIMD_sinf
  52. # define __DECL_SIMD_sinf __DECL_SIMD_x86_64
  53. # undef __DECL_SIMD_sincos
  54. # define __DECL_SIMD_sincos __DECL_SIMD_x86_64
  55. # undef __DECL_SIMD_sincosf
  56. # define __DECL_SIMD_sincosf __DECL_SIMD_x86_64
  57. # undef __DECL_SIMD_log
  58. # define __DECL_SIMD_log __DECL_SIMD_x86_64
  59. # undef __DECL_SIMD_logf
  60. # define __DECL_SIMD_logf __DECL_SIMD_x86_64
  61. # undef __DECL_SIMD_exp
  62. # define __DECL_SIMD_exp __DECL_SIMD_x86_64
  63. # undef __DECL_SIMD_expf
  64. # define __DECL_SIMD_expf __DECL_SIMD_x86_64
  65. # undef __DECL_SIMD_pow
  66. # define __DECL_SIMD_pow __DECL_SIMD_x86_64
  67. # undef __DECL_SIMD_powf
  68. # define __DECL_SIMD_powf __DECL_SIMD_x86_64
  69. # undef __DECL_SIMD_acos
  70. # define __DECL_SIMD_acos __DECL_SIMD_x86_64
  71. # undef __DECL_SIMD_acosf
  72. # define __DECL_SIMD_acosf __DECL_SIMD_x86_64
  73. # undef __DECL_SIMD_atan
  74. # define __DECL_SIMD_atan __DECL_SIMD_x86_64
  75. # undef __DECL_SIMD_atanf
  76. # define __DECL_SIMD_atanf __DECL_SIMD_x86_64
  77. # undef __DECL_SIMD_asin
  78. # define __DECL_SIMD_asin __DECL_SIMD_x86_64
  79. # undef __DECL_SIMD_asinf
  80. # define __DECL_SIMD_asinf __DECL_SIMD_x86_64
  81. # undef __DECL_SIMD_hypot
  82. # define __DECL_SIMD_hypot __DECL_SIMD_x86_64
  83. # undef __DECL_SIMD_hypotf
  84. # define __DECL_SIMD_hypotf __DECL_SIMD_x86_64
  85. # undef __DECL_SIMD_exp2
  86. # define __DECL_SIMD_exp2 __DECL_SIMD_x86_64
  87. # undef __DECL_SIMD_exp2f
  88. # define __DECL_SIMD_exp2f __DECL_SIMD_x86_64
  89. # undef __DECL_SIMD_exp10
  90. # define __DECL_SIMD_exp10 __DECL_SIMD_x86_64
  91. # undef __DECL_SIMD_exp10f
  92. # define __DECL_SIMD_exp10f __DECL_SIMD_x86_64
  93. # undef __DECL_SIMD_cosh
  94. # define __DECL_SIMD_cosh __DECL_SIMD_x86_64
  95. # undef __DECL_SIMD_coshf
  96. # define __DECL_SIMD_coshf __DECL_SIMD_x86_64
  97. # undef __DECL_SIMD_expm1
  98. # define __DECL_SIMD_expm1 __DECL_SIMD_x86_64
  99. # undef __DECL_SIMD_expm1f
  100. # define __DECL_SIMD_expm1f __DECL_SIMD_x86_64
  101. # undef __DECL_SIMD_sinh
  102. # define __DECL_SIMD_sinh __DECL_SIMD_x86_64
  103. # undef __DECL_SIMD_sinhf
  104. # define __DECL_SIMD_sinhf __DECL_SIMD_x86_64
  105. # undef __DECL_SIMD_cbrt
  106. # define __DECL_SIMD_cbrt __DECL_SIMD_x86_64
  107. # undef __DECL_SIMD_cbrtf
  108. # define __DECL_SIMD_cbrtf __DECL_SIMD_x86_64
  109. # undef __DECL_SIMD_atan2
  110. # define __DECL_SIMD_atan2 __DECL_SIMD_x86_64
  111. # undef __DECL_SIMD_atan2f
  112. # define __DECL_SIMD_atan2f __DECL_SIMD_x86_64
  113. # undef __DECL_SIMD_log10
  114. # define __DECL_SIMD_log10 __DECL_SIMD_x86_64
  115. # undef __DECL_SIMD_log10f
  116. # define __DECL_SIMD_log10f __DECL_SIMD_x86_64
  117. # undef __DECL_SIMD_log2
  118. # define __DECL_SIMD_log2 __DECL_SIMD_x86_64
  119. # undef __DECL_SIMD_log2f
  120. # define __DECL_SIMD_log2f __DECL_SIMD_x86_64
  121. # undef __DECL_SIMD_log1p
  122. # define __DECL_SIMD_log1p __DECL_SIMD_x86_64
  123. # undef __DECL_SIMD_log1pf
  124. # define __DECL_SIMD_log1pf __DECL_SIMD_x86_64
  125. # undef __DECL_SIMD_atanh
  126. # define __DECL_SIMD_atanh __DECL_SIMD_x86_64
  127. # undef __DECL_SIMD_atanhf
  128. # define __DECL_SIMD_atanhf __DECL_SIMD_x86_64
  129. # undef __DECL_SIMD_acosh
  130. # define __DECL_SIMD_acosh __DECL_SIMD_x86_64
  131. # undef __DECL_SIMD_acoshf
  132. # define __DECL_SIMD_acoshf __DECL_SIMD_x86_64
  133. # undef __DECL_SIMD_erf
  134. # define __DECL_SIMD_erf __DECL_SIMD_x86_64
  135. # undef __DECL_SIMD_erff
  136. # define __DECL_SIMD_erff __DECL_SIMD_x86_64
  137. # undef __DECL_SIMD_tanh
  138. # define __DECL_SIMD_tanh __DECL_SIMD_x86_64
  139. # undef __DECL_SIMD_tanhf
  140. # define __DECL_SIMD_tanhf __DECL_SIMD_x86_64
  141. # undef __DECL_SIMD_asinh
  142. # define __DECL_SIMD_asinh __DECL_SIMD_x86_64
  143. # undef __DECL_SIMD_asinhf
  144. # define __DECL_SIMD_asinhf __DECL_SIMD_x86_64
  145. # undef __DECL_SIMD_erfc
  146. # define __DECL_SIMD_erfc __DECL_SIMD_x86_64
  147. # undef __DECL_SIMD_erfcf
  148. # define __DECL_SIMD_erfcf __DECL_SIMD_x86_64
  149. # undef __DECL_SIMD_tan
  150. # define __DECL_SIMD_tan __DECL_SIMD_x86_64
  151. # undef __DECL_SIMD_tanf
  152. # define __DECL_SIMD_tanf __DECL_SIMD_x86_64
  153. # endif
  154. #endif