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

Nikolas Klauser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Nov 23 08:58:03 PST 2022


philnik 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);}
 
----------------
ldionne wrote:
> 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)`.
I'm planning to add `double` overloads, but that will be a later patch.


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