[libc] [llvm] [libc][math] Refactor exp implementation to header-only in src/__support/math folder. (PR #148091)

LLVM Continuous Integration via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 14 09:23:30 PDT 2025


llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `libc-x86_64-debian-gcc-fullbuild-dbg` running on `libc-x86_64-debian-fullbuild` while building `libc,utils` at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/131/builds/26098

<details>
<summary>Here is the relevant piece of the build log for the reference</summary>

```
Step 4 (annotate) failure: 'python ../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py ...' (failure)
...
-- Build files have been written to: /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/build
@@@BUILD_STEP build libc@@@
Running: ninja libc
ninja: no work to do.
@@@BUILD_STEP build libc-startup@@@
Running: ninja libc-startup
ninja: no work to do.
@@@BUILD_STEP libc-unit-tests@@@
Running: ninja libc-unit-tests
[1/1445] Building CXX object libc/src/math/generic/CMakeFiles/libc.src.math.generic.exp.__NO_FMA_OPT.__NO_ROUND_OPT.dir/exp.cpp.o
FAILED: libc/src/math/generic/CMakeFiles/libc.src.math.generic.exp.__NO_FMA_OPT.__NO_ROUND_OPT.dir/exp.cpp.o 
/usr/bin/g++ -DLIBC_NAMESPACE=__llvm_libc_20_0_0_git -D_DEBUG -I/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc -isystem /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/build/libc/include -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -Wimplicit-fallthrough -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -g -DLIBC_QSORT_IMPL=LIBC_QSORT_QUICK_SORT -DLIBC_ADD_NULL_CHECKS -DLIBC_ERRNO_MODE=LIBC_ERRNO_MODE_DEFAULT -fpie -ffreestanding -DLIBC_FULL_BUILD -isystem/usr/lib/gcc/x86_64-linux-gnu/12//include -nostdinc -idirafter/usr/include -fno-builtin -fno-exceptions -fno-lax-vector-conversions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -ftrivial-auto-var-init=pattern -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wall -Wextra -Werror -Wconversion -Wno-sign-conversion -Wdeprecated -fext-numeric-literals -Wno-pedantic -Wimplicit-fallthrough -Wwrite-strings -Wextra-semi -DLIBC_COPT_PUBLIC_PACKAGING -std=gnu++17 -MD -MT libc/src/math/generic/CMakeFiles/libc.src.math.generic.exp.__NO_FMA_OPT.__NO_ROUND_OPT.dir/exp.cpp.o -MF libc/src/math/generic/CMakeFiles/libc.src.math.generic.exp.__NO_FMA_OPT.__NO_ROUND_OPT.dir/exp.cpp.o.d -o libc/src/math/generic/CMakeFiles/libc.src.math.generic.exp.__NO_FMA_OPT.__NO_ROUND_OPT.dir/exp.cpp.o -c /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/math/generic/exp.cpp
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/math/generic/exp.cpp:10:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/__support/math/exp.h: In function ‘constexpr double __llvm_libc_20_0_0_git::{anonymous}::poly_approx_d(double)’:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/__support/math/exp.h:74:35: error: call to non-‘constexpr’ function ‘__llvm_libc_20_0_0_git::cpp::enable_if_t<(sizeof (T) <= sizeof (void*)), T> __llvm_libc_20_0_0_git::fputil::multiply_add(T, T, T) [with T = double; __llvm_libc_20_0_0_git::cpp::enable_if_t<(sizeof (T) <= sizeof (void*)), T> = double]’
   74 |   double c0 = fputil::multiply_add(dx, 0.5, 1.0);
      |               ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/__support/FPUtil/PolyEval.h:12,
                 from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/__support/math/exp.h:18:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/__support/FPUtil/multiply_add.h:33:1: note: ‘__llvm_libc_20_0_0_git::cpp::enable_if_t<(sizeof (T) <= sizeof (void*)), T> __llvm_libc_20_0_0_git::fputil::multiply_add(T, T, T) [with T = double; __llvm_libc_20_0_0_git::cpp::enable_if_t<(sizeof (T) <= sizeof (void*)), T> = double]’ declared here
   33 | multiply_add(T x, T y, T z) {
      | ^~~~~~~~~~~~
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/__support/math/exp.h: In function ‘constexpr __llvm_libc_20_0_0_git::fputil::DoubleDouble __llvm_libc_20_0_0_git::{anonymous}::poly_approx_dd(const __llvm_libc_20_0_0_git::fputil::DoubleDouble&)’:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/__support/math/exp.h:100:36: error: call to non-‘constexpr’ function ‘__llvm_libc_20_0_0_git::cpp::enable_if_t<(sizeof (T) > sizeof (void*)), T> __llvm_libc_20_0_0_git::fputil::polyeval(const T&, const T&, const Ts& ...) [with T = __llvm_libc_20_0_0_git::NumberPair<double>; Ts = {__llvm_libc_20_0_0_git::NumberPair<double>, __llvm_libc_20_0_0_git::NumberPair<double>, __llvm_libc_20_0_0_git::NumberPair<double>, __llvm_libc_20_0_0_git::NumberPair<double>, __llvm_libc_20_0_0_git::NumberPair<double>, __llvm_libc_20_0_0_git::NumberPair<double>}; __llvm_libc_20_0_0_git::cpp::enable_if_t<(sizeof (T) > sizeof (void*)), T> = __llvm_libc_20_0_0_git::NumberPair<double>]’
  100 |   DoubleDouble p = fputil::polyeval(dx, COEFFS[0], COEFFS[1], COEFFS[2],
      |                    ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  101 |                                     COEFFS[3], COEFFS[4], COEFFS[5], COEFFS[6]);
      |                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/__support/FPUtil/PolyEval.h:41:1: note: ‘__llvm_libc_20_0_0_git::cpp::enable_if_t<(sizeof (T) > sizeof (void*)), T> __llvm_libc_20_0_0_git::fputil::polyeval(const T&, const T&, const Ts& ...) [with T = __llvm_libc_20_0_0_git::NumberPair<double>; Ts = {__llvm_libc_20_0_0_git::NumberPair<double>, __llvm_libc_20_0_0_git::NumberPair<double>, __llvm_libc_20_0_0_git::NumberPair<double>, __llvm_libc_20_0_0_git::NumberPair<double>, __llvm_libc_20_0_0_git::NumberPair<double>, __llvm_libc_20_0_0_git::NumberPair<double>}; __llvm_libc_20_0_0_git::cpp::enable_if_t<(sizeof (T) > sizeof (void*)), T> = __llvm_libc_20_0_0_git::NumberPair<double>]’ declared here
   41 | polyeval(const T &x, const T &a0, const Ts &...a) {
      | ^~~~~~~~
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/__support/math/exp.h: In function ‘constexpr __llvm_libc_20_0_0_git::Float128 __llvm_libc_20_0_0_git::{anonymous}::poly_approx_f128(const __llvm_libc_20_0_0_git::Float128&)’:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/__support/math/exp.h:121:32: error: call to non-‘constexpr’ function ‘__llvm_libc_20_0_0_git::cpp::enable_if_t<(sizeof (T) > sizeof (void*)), T> __llvm_libc_20_0_0_git::fputil::polyeval(const T&, const T&, const Ts& ...) [with T = DyadicFloat<128>; Ts = {DyadicFloat<128>, DyadicFloat<128>, DyadicFloat<128>, DyadicFloat<128>, DyadicFloat<128>, DyadicFloat<128>, DyadicFloat<128>}; __llvm_libc_20_0_0_git::cpp::enable_if_t<(sizeof (T) > sizeof (void*)), T> = DyadicFloat<128>]’
  121 |   Float128 p = fputil::polyeval(dx, COEFFS_128[0], COEFFS_128[1], COEFFS_128[2],
      |                ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  122 |                                 COEFFS_128[3], COEFFS_128[4], COEFFS_128[5],
      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  123 |                                 COEFFS_128[6], COEFFS_128[7]);
      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/__support/FPUtil/PolyEval.h:41:1: note: ‘__llvm_libc_20_0_0_git::cpp::enable_if_t<(sizeof (T) > sizeof (void*)), T> __llvm_libc_20_0_0_git::fputil::polyeval(const T&, const T&, const Ts& ...) [with T = DyadicFloat<128>; Ts = {DyadicFloat<128>, DyadicFloat<128>, DyadicFloat<128>, DyadicFloat<128>, DyadicFloat<128>, DyadicFloat<128>, DyadicFloat<128>}; __llvm_libc_20_0_0_git::cpp::enable_if_t<(sizeof (T) > sizeof (void*)), T> = DyadicFloat<128>]’ declared here
   41 | polyeval(const T &x, const T &a0, const Ts &...a) {
      | ^~~~~~~~
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/__support/math/exp.h: In function ‘constexpr __llvm_libc_20_0_0_git::Float128 __llvm_libc_20_0_0_git::{anonymous}::exp_f128(double, double, int, int)’:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/__support/math/exp.h:133:35: error: call to non-‘constexpr’ function ‘__llvm_libc_20_0_0_git::cpp::enable_if_t<(sizeof (T) <= sizeof (void*)), T> __llvm_libc_20_0_0_git::fputil::multiply_add(T, T, T) [with T = double; __llvm_libc_20_0_0_git::cpp::enable_if_t<(sizeof (T) <= sizeof (void*)), T> = double]’
  133 |   double t1 = fputil::multiply_add(kd, MLOG_2_EXP2_M12_HI, x); // exact
      |               ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/__support/FPUtil/multiply_add.h:33:1: note: ‘__llvm_libc_20_0_0_git::cpp::enable_if_t<(sizeof (T) <= sizeof (void*)), T> __llvm_libc_20_0_0_git::fputil::multiply_add(T, T, T) [with T = double; __llvm_libc_20_0_0_git::cpp::enable_if_t<(sizeof (T) <= sizeof (void*)), T> = double]’ declared here
   33 | multiply_add(T x, T y, T z) {
      | ^~~~~~~~~~~~

```

</details>

https://github.com/llvm/llvm-project/pull/148091


More information about the llvm-commits mailing list