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

LLVM Continuous Integration via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 2 13:07:42 PDT 2025


llvm-ci wrote:

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

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

<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)
...
[       OK ] LlvmLibcStrtouint32Test.MessyBaseSixteenDecode (2 us)
[ RUN      ] LlvmLibcStrtouint32Test.AutomaticBaseSelection
[       OK ] LlvmLibcStrtouint32Test.AutomaticBaseSelection (4 us)
Ran 14 tests.  PASS: 14  FAIL: 0
[991/997] Running unit test libc.test.src.time.nanosleep_test.__unit__
[==========] Running 1 test from 1 test suite.
[ RUN      ] LlvmLibcNanosleep.SmokeTest
[       OK ] LlvmLibcNanosleep.SmokeTest (27 us)
Ran 1 tests.  PASS: 1  FAIL: 0
[992/997] Building CXX object libc/test/shared/CMakeFiles/libc.test.shared.shared_math_test.__unit__.__NO_ROUND_OPT.__build__.dir/shared_math_test.cpp.o
FAILED: libc/test/shared/CMakeFiles/libc.test.shared.shared_math_test.__unit__.__NO_ROUND_OPT.__build__.dir/shared_math_test.cpp.o 
/usr/bin/clang++ -DLIBC_NAMESPACE=__llvm_libc_20_0_0_git -D_DEBUG -I/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc -isystem libc/include -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wstring-conversion -fdiagnostics-color -g -DLIBC_QSORT_IMPL=LIBC_QSORT_QUICK_SORT -DLIBC_ADD_NULL_CHECKS -DLIBC_ERRNO_MODE=LIBC_ERRNO_MODE_DEFAULT -DLIBC_THREAD_MODE=LIBC_THREAD_MODE_PLATFORM -fpie -DLIBC_FULL_BUILD -ffreestanding -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -Wconversion -Wno-sign-conversion -Wimplicit-fallthrough -Wwrite-strings -Wno-c99-extensions -Wno-gnu-imaginary-constant -Wno-pedantic -Wstrict-prototypes -Wextra-semi -Wnewline-eof -Wnonportable-system-include-path -Wthread-safety -DLIBC_TEST=UNIT -std=gnu++17 -MD -MT libc/test/shared/CMakeFiles/libc.test.shared.shared_math_test.__unit__.__NO_ROUND_OPT.__build__.dir/shared_math_test.cpp.o -MF libc/test/shared/CMakeFiles/libc.test.shared.shared_math_test.__unit__.__NO_ROUND_OPT.__build__.dir/shared_math_test.cpp.o.d -o libc/test/shared/CMakeFiles/libc.test.shared.shared_math_test.__unit__.__NO_ROUND_OPT.__build__.dir/shared_math_test.cpp.o -c /home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/test/shared/shared_math_test.cpp
In file included from /home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/test/shared/shared_math_test.cpp:9:
In file included from /home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/shared/math.h:32:
In file included from /home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/shared/math/atanhf16.h:16:
/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/src/__support/math/atanhf16.h:112:36: error: constexpr function never produces a constant expression [-Winvalid-constexpr]
LIBC_INLINE static constexpr float log_eval_f(float x) {
                                   ^
/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/src/__support/math/atanhf16.h:137:14: note: non-constexpr function 'multiply_add' cannot be used in a constant expression
  float c1 = fputil::multiply_add(dx, COEFFS[1], COEFFS[0]);
             ^
/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/src/__support/FPUtil/multiply_add.h:50:19: note: declared here
LIBC_INLINE float multiply_add(float x, float y, float z) {
                  ^
1 error generated.
[993/997] Building CXX object libc/test/shared/CMakeFiles/libc.test.shared.shared_math_test.__unit__.__build__.dir/shared_math_test.cpp.o
FAILED: libc/test/shared/CMakeFiles/libc.test.shared.shared_math_test.__unit__.__build__.dir/shared_math_test.cpp.o 
/usr/bin/clang++ -DLIBC_NAMESPACE=__llvm_libc_20_0_0_git -D_DEBUG -I/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc -isystem libc/include -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wstring-conversion -fdiagnostics-color -g -D__LIBC_USE_BUILTIN_CEIL_FLOOR_RINT_TRUNC -D__LIBC_USE_BUILTIN_ROUND -DLIBC_QSORT_IMPL=LIBC_QSORT_QUICK_SORT -DLIBC_ADD_NULL_CHECKS -DLIBC_ERRNO_MODE=LIBC_ERRNO_MODE_DEFAULT -DLIBC_THREAD_MODE=LIBC_THREAD_MODE_PLATFORM -fpie -DLIBC_FULL_BUILD -ffreestanding -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -Wconversion -Wno-sign-conversion -Wimplicit-fallthrough -Wwrite-strings -Wno-c99-extensions -Wno-gnu-imaginary-constant -Wno-pedantic -Wstrict-prototypes -Wextra-semi -Wnewline-eof -Wnonportable-system-include-path -Wthread-safety -DLIBC_TEST=UNIT -std=gnu++17 -MD -MT libc/test/shared/CMakeFiles/libc.test.shared.shared_math_test.__unit__.__build__.dir/shared_math_test.cpp.o -MF libc/test/shared/CMakeFiles/libc.test.shared.shared_math_test.__unit__.__build__.dir/shared_math_test.cpp.o.d -o libc/test/shared/CMakeFiles/libc.test.shared.shared_math_test.__unit__.__build__.dir/shared_math_test.cpp.o -c /home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/test/shared/shared_math_test.cpp
In file included from /home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/test/shared/shared_math_test.cpp:9:
In file included from /home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/shared/math.h:32:
In file included from /home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/shared/math/atanhf16.h:16:
/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/src/__support/math/atanhf16.h:112:36: error: constexpr function never produces a constant expression [-Winvalid-constexpr]
LIBC_INLINE static constexpr float log_eval_f(float x) {
                                   ^
/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/src/__support/math/atanhf16.h:137:14: note: non-constexpr function 'multiply_add' cannot be used in a constant expression
  float c1 = fputil::multiply_add(dx, COEFFS[1], COEFFS[0]);
             ^
/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/src/__support/FPUtil/multiply_add.h:50:19: note: declared here
LIBC_INLINE float multiply_add(float x, float y, float z) {
                  ^
1 error generated.
ninja: build stopped: subcommand failed.
['ninja', 'libc-unit-tests'] exited with return code 1.
The build step threw an exception...
Traceback (most recent call last):
  File "../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 181, in step
    yield
  File "../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 154, in main
    run_command(['ninja', 'libc-unit-tests'])

```

</details>

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


More information about the llvm-commits mailing list