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

LLVM Continuous Integration via libc-commits libc-commits at lists.llvm.org
Tue Feb 17 13:56:28 PST 2026


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/41560

<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)
...
[ RUN      ] LlvmLibcFMaxTest.InfArg
[       OK ] LlvmLibcFMaxTest.InfArg (1 us)
[ RUN      ] LlvmLibcFMaxTest.NegInfArg
[       OK ] LlvmLibcFMaxTest.NegInfArg (1 us)
[ RUN      ] LlvmLibcFMaxTest.BothZero
[       OK ] LlvmLibcFMaxTest.BothZero (1 us)
[ RUN      ] LlvmLibcFMaxTest.Range
[       OK ] LlvmLibcFMaxTest.Range (39 ms)
Ran 5 tests.  PASS: 5  FAIL: 0
[218/1036] Building CXX object libc/src/math/generic/CMakeFiles/libc.src.math.generic.bf16divf.dir/bf16divf.cpp.o
FAILED: libc/src/math/generic/CMakeFiles/libc.src.math.generic.bf16divf.dir/bf16divf.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 -Wno-pass-failed -fdiagnostics-color -g -DLIBC_QSORT_IMPL=LIBC_QSORT_QUICK_SORT -DLIBC_COPT_STRING_LENGTH_IMPL=clang_vector -DLIBC_COPT_FIND_FIRST_CHARACTER_IMPL=word -DLIBC_ADD_NULL_CHECKS -DLIBC_ERRNO_MODE=LIBC_ERRNO_MODE_DEFAULT -DLIBC_THREAD_MODE=LIBC_THREAD_MODE_PLATFORM -DLIBC_CONF_WCTYPE_MODE=LIBC_WCTYPE_MODE_ASCII -DLIBC_COPT_RAW_MUTEX_DEFAULT_SPIN_COUNT=100 -fpie -ffreestanding -DLIBC_FULL_BUILD -nostdlibinc -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 -fstack-protector-strong -Wall -Wextra -Werror -Wconversion -Wno-sign-conversion -Wdeprecated -Wno-c99-extensions -Wno-gnu-imaginary-constant -Wno-pedantic -Wimplicit-fallthrough -Wwrite-strings -Wextra-semi -Wnewline-eof -Wnonportable-system-include-path -Wstrict-prototypes -Wthread-safety -Wglobal-constructors -DLIBC_COPT_PUBLIC_PACKAGING -std=gnu++17 -MD -MT libc/src/math/generic/CMakeFiles/libc.src.math.generic.bf16divf.dir/bf16divf.cpp.o -MF libc/src/math/generic/CMakeFiles/libc.src.math.generic.bf16divf.dir/bf16divf.cpp.o.d -o libc/src/math/generic/CMakeFiles/libc.src.math.generic.bf16divf.dir/bf16divf.cpp.o -c /home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/src/math/generic/bf16divf.cpp
In file included from /home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/src/math/generic/bf16divf.cpp:10:
/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/src/__support/math/bf16divf.h:20:32: error: constexpr function never produces a constant expression [-Winvalid-constexpr]
LIBC_INLINE constexpr bfloat16 bf16divf(float x, float y) {
                               ^
/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/src/__support/math/bf16divf.h:21:10: note: non-constexpr function 'div<__llvm_libc_20_0_0_git::fputil::BFloat16, float>' cannot be used in a constant expression
  return fputil::generic::div<bfloat16>(x, y);
         ^
/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/src/__support/FPUtil/generic/div.h:33:1: note: declared here
div(InType x, InType y) {
^
1 error generated.
[219/1036] Running unit test libc.test.src.math.smoke.logbf_test.__unit__
[==========] Running 4 tests from 1 test suite.
[ RUN      ] LlvmLibcLogbTest.SpecialNumbers
[       OK ] LlvmLibcLogbTest.SpecialNumbers (5 us)
[ RUN      ] LlvmLibcLogbTest.PowersOfTwo
[       OK ] LlvmLibcLogbTest.PowersOfTwo (7 us)
[ RUN      ] LlvmLibcLogbTest.SomeIntegers
[       OK ] LlvmLibcLogbTest.SomeIntegers (5 us)
[ RUN      ] LlvmLibcLogbTest.InRange
[       OK ] LlvmLibcLogbTest.InRange (62 ms)
Ran 4 tests.  PASS: 4  FAIL: 0
[220/1036] Building CXX object libc/src/math/generic/CMakeFiles/libc.src.math.generic.bf16divf.__internal__.dir/bf16divf.cpp.o
FAILED: libc/src/math/generic/CMakeFiles/libc.src.math.generic.bf16divf.__internal__.dir/bf16divf.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 -Wno-pass-failed -fdiagnostics-color -g -DLIBC_QSORT_IMPL=LIBC_QSORT_QUICK_SORT -DLIBC_COPT_STRING_LENGTH_IMPL=clang_vector -DLIBC_COPT_FIND_FIRST_CHARACTER_IMPL=word -DLIBC_ADD_NULL_CHECKS -DLIBC_ERRNO_MODE=LIBC_ERRNO_MODE_DEFAULT -DLIBC_THREAD_MODE=LIBC_THREAD_MODE_PLATFORM -DLIBC_CONF_WCTYPE_MODE=LIBC_WCTYPE_MODE_ASCII -DLIBC_COPT_RAW_MUTEX_DEFAULT_SPIN_COUNT=100 -fpie -ffreestanding -DLIBC_FULL_BUILD -nostdlibinc -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 -fstack-protector-strong -Wall -Wextra -Werror -Wconversion -Wno-sign-conversion -Wdeprecated -Wno-c99-extensions -Wno-gnu-imaginary-constant -Wno-pedantic -Wimplicit-fallthrough -Wwrite-strings -Wextra-semi -Wnewline-eof -Wnonportable-system-include-path -Wstrict-prototypes -Wthread-safety -Wglobal-constructors -std=gnu++17 -MD -MT libc/src/math/generic/CMakeFiles/libc.src.math.generic.bf16divf.__internal__.dir/bf16divf.cpp.o -MF libc/src/math/generic/CMakeFiles/libc.src.math.generic.bf16divf.__internal__.dir/bf16divf.cpp.o.d -o libc/src/math/generic/CMakeFiles/libc.src.math.generic.bf16divf.__internal__.dir/bf16divf.cpp.o -c /home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/src/math/generic/bf16divf.cpp
In file included from /home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/src/math/generic/bf16divf.cpp:10:
/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/src/__support/math/bf16divf.h:20:32: error: constexpr function never produces a constant expression [-Winvalid-constexpr]
LIBC_INLINE constexpr bfloat16 bf16divf(float x, float y) {
                               ^
/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/src/__support/math/bf16divf.h:21:10: note: non-constexpr function 'div<__llvm_libc_20_0_0_git::fputil::BFloat16, float>' cannot be used in a constant expression
  return fputil::generic::div<bfloat16>(x, y);
         ^
/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/src/__support/FPUtil/generic/div.h:33:1: note: declared here
div(InType x, InType y) {
^
1 error generated.
[221/1036] Running unit test libc.test.src.math.modf_test.__unit__

```

</details>

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


More information about the libc-commits mailing list