[libcxx-commits] [PATCH] D136393: [libc++][math.h] Use builtins for all the functions

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Nov 23 07:28:12 PST 2022


ldionne added inline comments.


================
Comment at: libcxx/include/math.h:1299-1300
 
-inline _LIBCPP_HIDE_FROM_ABI float       tgamma(float __x) _NOEXCEPT       {return ::tgammaf(__x);}
-inline _LIBCPP_HIDE_FROM_ABI long double tgamma(long double __x) _NOEXCEPT {return ::tgammal(__x);}
+inline _LIBCPP_HIDE_FROM_ABI float       tgamma(float __x) _NOEXCEPT       {return __builtin_tgammaf(__x);}
+inline _LIBCPP_HIDE_FROM_ABI long double tgamma(long double __x) _NOEXCEPT {return __builtin_tgammal(__x);}
 
----------------
I know this is not the main purpose of this patch, but this doesn't help us if we want to support systems where e.g. `tgamma(double)` is not provided. Indeed, with this patch, we end up calling `tgama(double)` below, which is ambiguous between `tgamma(float)` and `tgamma(long double)`, since there is no `tgamma(double)`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136393/new/

https://reviews.llvm.org/D136393



More information about the libcxx-commits mailing list