mathcalls-macros.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. /* Macros for math function declarations.
  17. Copyright (C) 2024-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. #define __SIMD_DECL(function) __CONCAT (__DECL_SIMD_, function)
  31. #define __MATHCALL_VEC(function, suffix, args) \
  32. __SIMD_DECL (__MATH_PRECNAME (function, suffix)) \
  33. __MATHCALL (function, suffix, args)
  34. #define __MATHDECL_VEC(type, function,suffix, args) \
  35. __SIMD_DECL (__MATH_PRECNAME (function, suffix)) \
  36. __MATHDECL(type, function,suffix, args)
  37. #define __MATHCALL(function,suffix, args) \
  38. __MATHDECL (_Mdouble_,function,suffix, args)
  39. #define __MATHDECL(type, function,suffix, args) \
  40. __MATHDECL_1(type, function,suffix, args); \
  41. __MATHDECL_1(type, __CONCAT(__,function),suffix, args)
  42. #define __MATHCALLX(function,suffix, args, attrib) \
  43. __MATHDECLX (_Mdouble_,function,suffix, args, attrib)
  44. #define __MATHDECLX(type, function,suffix, args, attrib) \
  45. __MATHDECL_1(type, function,suffix, args) __attribute__ (attrib)
  46. #define __MATHDECL_1_IMPL(type, function, suffix, args) \
  47. extern type __MATH_PRECNAME(function,suffix) args __THROW
  48. #define __MATHDECL_1(type, function, suffix, args) \
  49. __MATHDECL_1_IMPL(type, function, suffix, args)
  50. /* Ignore the alias by default. The alias is only useful with
  51. redirections. */
  52. #define __MATHDECL_ALIAS(type, function, suffix, args, alias) \
  53. __MATHDECL_1(type, function, suffix, args)
  54. #define __MATHREDIR(type, function, suffix, args, to) \
  55. extern type __REDIRECT_NTH (__MATH_PRECNAME (function, suffix), args, to)