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

Xing Xue via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Nov 14 14:56:36 PST 2022


xingxue added inline comments.


================
Comment at: libcxx/include/math.h:686
+#ifdef _AIX
+  return ::ldexpl(__x, __e);
+#else
----------------
xingxue wrote:
> ldionne wrote:
> > Is there a reason why this builtin doesn't work correctly on AIX?
> > 
> > @daltenty @xingxue Can you get someone to fix this? When we try to make those `constexpr`, things could start failing pretty badly on AIX if we're not using builtins.
> The issue is that AIX implements math functions `frexpl()`, `ldexpl()`, and `modfl()` as 128-bit `long double` but for other math functions, AIX libm has 64-bit `long double` wrappers. Currently, the Clang compiler on AIX supports 64-bit `long double` only and therefore, `frexpl()`, `ldexpl()`, and `modfl()` would seg-fault. We are looking into a fix.
Patch D137986 has been created for the compiler to map `__builtin_frexpl()`, `__builtin_ldexpl()`, and `__builtin_modfl()` to `double` version functions `frexp()`, `ldexp()`, and `modf()` in 64-bit `long double` mode.


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