[libc-commits] [libc] [libc][math][c++23] Implement comparison operations operator overloads for BFloat16 (PR #150087)

LLVM Continuous Integration via libc-commits libc-commits at lists.llvm.org
Wed Jul 23 07:50:00 PDT 2025


llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `libc-arm32-debian-dbg` running on `libc-arm32-debian` while building `libc` at step 4 "annotate".

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

<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      ] LlvmLibcTypeTraitsTest.is_signed
[       OK ] LlvmLibcTypeTraitsTest.is_signed (24 us)
[ RUN      ] LlvmLibcTypeTraitsTest.is_unsigned
[       OK ] LlvmLibcTypeTraitsTest.is_unsigned (18 us)
[ RUN      ] LlvmLibcTypeTraitsTest.true_type
[       OK ] LlvmLibcTypeTraitsTest.true_type (9 us)
[ RUN      ] LlvmLibcTypeTraitsTest.has_unique_object_representations
[       OK ] LlvmLibcTypeTraitsTest.has_unique_object_representations (12 us)
Ran 66 tests.  PASS: 66  FAIL: 0
[34/749] Building CXX object libc/utils/MPFRWrapper/CMakeFiles/libcMPCommon.dir/MPCommon.cpp.o
FAILED: libc/utils/MPFRWrapper/CMakeFiles/libcMPCommon.dir/MPCommon.cpp.o 
/llvm/llvm-install/bin/clang++ -DLIBC_NAMESPACE=__llvm_libc_20_0_0_git -D_DEBUG -I/llvm/libc_worker/worker/libc-arm32-debian/libc-arm32-debian-dbg/llvm-project/libc -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 -O3 -DLIBC_QSORT_IMPL=LIBC_QSORT_QUICK_SORT -DLIBC_ADD_NULL_CHECKS -DLIBC_ERRNO_MODE=LIBC_ERRNO_MODE_DEFAULT -fpie -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 -std=gnu++17 -MD -MT libc/utils/MPFRWrapper/CMakeFiles/libcMPCommon.dir/MPCommon.cpp.o -MF libc/utils/MPFRWrapper/CMakeFiles/libcMPCommon.dir/MPCommon.cpp.o.d -o libc/utils/MPFRWrapper/CMakeFiles/libcMPCommon.dir/MPCommon.cpp.o -c /llvm/libc_worker/worker/libc-arm32-debian/libc-arm32-debian-dbg/llvm-project/libc/utils/MPFRWrapper/MPCommon.cpp
In file included from /llvm/libc_worker/worker/libc-arm32-debian/libc-arm32-debian-dbg/llvm-project/libc/utils/MPFRWrapper/MPCommon.cpp:12:
/llvm/libc_worker/worker/libc-arm32-debian/libc-arm32-debian-dbg/llvm-project/libc/src/__support/FPUtil/bfloat16.h:62:30: error: constexpr function never produces a constant expression [-Winvalid-constexpr]
  LIBC_INLINE constexpr bool operator==(BFloat16 other) const {
                             ^
/llvm/libc_worker/worker/libc-arm32-debian/libc-arm32-debian-dbg/llvm-project/libc/src/__support/FPUtil/bfloat16.h:63:12: note: non-constexpr function 'equals<__llvm_libc_20_0_0_git::fputil::BFloat16>' cannot be used in a constant expression
    return fputil::equals(*this, other);
           ^
/llvm/libc_worker/worker/libc-arm32-debian/libc-arm32-debian-dbg/llvm-project/libc/src/__support/FPUtil/comparison_operations.h:29:65: note: declared here
LIBC_INLINE cpp::enable_if_t<cpp::is_floating_point_v<T>, bool> equals(T x,
                                                                ^
In file included from /llvm/libc_worker/worker/libc-arm32-debian/libc-arm32-debian-dbg/llvm-project/libc/utils/MPFRWrapper/MPCommon.cpp:12:
/llvm/libc_worker/worker/libc-arm32-debian/libc-arm32-debian-dbg/llvm-project/libc/src/__support/FPUtil/bfloat16.h:66:30: error: constexpr function never produces a constant expression [-Winvalid-constexpr]
  LIBC_INLINE constexpr bool operator!=(BFloat16 other) const {
                             ^
/llvm/libc_worker/worker/libc-arm32-debian/libc-arm32-debian-dbg/llvm-project/libc/src/__support/FPUtil/bfloat16.h:67:13: note: non-constexpr function 'equals<__llvm_libc_20_0_0_git::fputil::BFloat16>' cannot be used in a constant expression
    return !fputil::equals(*this, other);
            ^
/llvm/libc_worker/worker/libc-arm32-debian/libc-arm32-debian-dbg/llvm-project/libc/src/__support/FPUtil/comparison_operations.h:29:65: note: declared here
LIBC_INLINE cpp::enable_if_t<cpp::is_floating_point_v<T>, bool> equals(T x,
                                                                ^
In file included from /llvm/libc_worker/worker/libc-arm32-debian/libc-arm32-debian-dbg/llvm-project/libc/utils/MPFRWrapper/MPCommon.cpp:12:
/llvm/libc_worker/worker/libc-arm32-debian/libc-arm32-debian-dbg/llvm-project/libc/src/__support/FPUtil/bfloat16.h:70:30: error: constexpr function never produces a constant expression [-Winvalid-constexpr]
  LIBC_INLINE constexpr bool operator<(BFloat16 other) const {
                             ^
/llvm/libc_worker/worker/libc-arm32-debian/libc-arm32-debian-dbg/llvm-project/libc/src/__support/FPUtil/bfloat16.h:71:12: note: non-constexpr function 'less_than<__llvm_libc_20_0_0_git::fputil::BFloat16>' cannot be used in a constant expression
    return fputil::less_than(*this, other);
           ^
/llvm/libc_worker/worker/libc-arm32-debian/libc-arm32-debian-dbg/llvm-project/libc/src/__support/FPUtil/comparison_operations.h:55:65: note: declared here
LIBC_INLINE cpp::enable_if_t<cpp::is_floating_point_v<T>, bool> less_than(T x,
                                                                ^
In file included from /llvm/libc_worker/worker/libc-arm32-debian/libc-arm32-debian-dbg/llvm-project/libc/utils/MPFRWrapper/MPCommon.cpp:12:
/llvm/libc_worker/worker/libc-arm32-debian/libc-arm32-debian-dbg/llvm-project/libc/src/__support/FPUtil/bfloat16.h:74:30: error: constexpr function never produces a constant expression [-Winvalid-constexpr]
  LIBC_INLINE constexpr bool operator<=(BFloat16 other) const {
                             ^
/llvm/libc_worker/worker/libc-arm32-debian/libc-arm32-debian-dbg/llvm-project/libc/src/__support/FPUtil/bfloat16.h:75:12: note: non-constexpr function 'less_than_or_equals<__llvm_libc_20_0_0_git::fputil::BFloat16>' cannot be used in a constant expression
    return fputil::less_than_or_equals(*this, other);
           ^
Step 7 (libc-unit-tests) failure: libc-unit-tests (failure)
...
[ RUN      ] LlvmLibcTypeTraitsTest.is_signed
[       OK ] LlvmLibcTypeTraitsTest.is_signed (24 us)
[ RUN      ] LlvmLibcTypeTraitsTest.is_unsigned
[       OK ] LlvmLibcTypeTraitsTest.is_unsigned (18 us)
[ RUN      ] LlvmLibcTypeTraitsTest.true_type
[       OK ] LlvmLibcTypeTraitsTest.true_type (9 us)
[ RUN      ] LlvmLibcTypeTraitsTest.has_unique_object_representations
[       OK ] LlvmLibcTypeTraitsTest.has_unique_object_representations (12 us)
Ran 66 tests.  PASS: 66  FAIL: 0
[34/749] Building CXX object libc/utils/MPFRWrapper/CMakeFiles/libcMPCommon.dir/MPCommon.cpp.o
FAILED: libc/utils/MPFRWrapper/CMakeFiles/libcMPCommon.dir/MPCommon.cpp.o 
/llvm/llvm-install/bin/clang++ -DLIBC_NAMESPACE=__llvm_libc_20_0_0_git -D_DEBUG -I/llvm/libc_worker/worker/libc-arm32-debian/libc-arm32-debian-dbg/llvm-project/libc -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 -O3 -DLIBC_QSORT_IMPL=LIBC_QSORT_QUICK_SORT -DLIBC_ADD_NULL_CHECKS -DLIBC_ERRNO_MODE=LIBC_ERRNO_MODE_DEFAULT -fpie -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 -std=gnu++17 -MD -MT libc/utils/MPFRWrapper/CMakeFiles/libcMPCommon.dir/MPCommon.cpp.o -MF libc/utils/MPFRWrapper/CMakeFiles/libcMPCommon.dir/MPCommon.cpp.o.d -o libc/utils/MPFRWrapper/CMakeFiles/libcMPCommon.dir/MPCommon.cpp.o -c /llvm/libc_worker/worker/libc-arm32-debian/libc-arm32-debian-dbg/llvm-project/libc/utils/MPFRWrapper/MPCommon.cpp
In file included from /llvm/libc_worker/worker/libc-arm32-debian/libc-arm32-debian-dbg/llvm-project/libc/utils/MPFRWrapper/MPCommon.cpp:12:
/llvm/libc_worker/worker/libc-arm32-debian/libc-arm32-debian-dbg/llvm-project/libc/src/__support/FPUtil/bfloat16.h:62:30: error: constexpr function never produces a constant expression [-Winvalid-constexpr]
  LIBC_INLINE constexpr bool operator==(BFloat16 other) const {
                             ^
/llvm/libc_worker/worker/libc-arm32-debian/libc-arm32-debian-dbg/llvm-project/libc/src/__support/FPUtil/bfloat16.h:63:12: note: non-constexpr function 'equals<__llvm_libc_20_0_0_git::fputil::BFloat16>' cannot be used in a constant expression
    return fputil::equals(*this, other);
           ^
/llvm/libc_worker/worker/libc-arm32-debian/libc-arm32-debian-dbg/llvm-project/libc/src/__support/FPUtil/comparison_operations.h:29:65: note: declared here
LIBC_INLINE cpp::enable_if_t<cpp::is_floating_point_v<T>, bool> equals(T x,
                                                                ^
In file included from /llvm/libc_worker/worker/libc-arm32-debian/libc-arm32-debian-dbg/llvm-project/libc/utils/MPFRWrapper/MPCommon.cpp:12:
/llvm/libc_worker/worker/libc-arm32-debian/libc-arm32-debian-dbg/llvm-project/libc/src/__support/FPUtil/bfloat16.h:66:30: error: constexpr function never produces a constant expression [-Winvalid-constexpr]
  LIBC_INLINE constexpr bool operator!=(BFloat16 other) const {
                             ^
/llvm/libc_worker/worker/libc-arm32-debian/libc-arm32-debian-dbg/llvm-project/libc/src/__support/FPUtil/bfloat16.h:67:13: note: non-constexpr function 'equals<__llvm_libc_20_0_0_git::fputil::BFloat16>' cannot be used in a constant expression
    return !fputil::equals(*this, other);
            ^
/llvm/libc_worker/worker/libc-arm32-debian/libc-arm32-debian-dbg/llvm-project/libc/src/__support/FPUtil/comparison_operations.h:29:65: note: declared here
LIBC_INLINE cpp::enable_if_t<cpp::is_floating_point_v<T>, bool> equals(T x,
                                                                ^
In file included from /llvm/libc_worker/worker/libc-arm32-debian/libc-arm32-debian-dbg/llvm-project/libc/utils/MPFRWrapper/MPCommon.cpp:12:
/llvm/libc_worker/worker/libc-arm32-debian/libc-arm32-debian-dbg/llvm-project/libc/src/__support/FPUtil/bfloat16.h:70:30: error: constexpr function never produces a constant expression [-Winvalid-constexpr]
  LIBC_INLINE constexpr bool operator<(BFloat16 other) const {
                             ^
/llvm/libc_worker/worker/libc-arm32-debian/libc-arm32-debian-dbg/llvm-project/libc/src/__support/FPUtil/bfloat16.h:71:12: note: non-constexpr function 'less_than<__llvm_libc_20_0_0_git::fputil::BFloat16>' cannot be used in a constant expression
    return fputil::less_than(*this, other);
           ^
/llvm/libc_worker/worker/libc-arm32-debian/libc-arm32-debian-dbg/llvm-project/libc/src/__support/FPUtil/comparison_operations.h:55:65: note: declared here
LIBC_INLINE cpp::enable_if_t<cpp::is_floating_point_v<T>, bool> less_than(T x,
                                                                ^
In file included from /llvm/libc_worker/worker/libc-arm32-debian/libc-arm32-debian-dbg/llvm-project/libc/utils/MPFRWrapper/MPCommon.cpp:12:
/llvm/libc_worker/worker/libc-arm32-debian/libc-arm32-debian-dbg/llvm-project/libc/src/__support/FPUtil/bfloat16.h:74:30: error: constexpr function never produces a constant expression [-Winvalid-constexpr]
  LIBC_INLINE constexpr bool operator<=(BFloat16 other) const {
                             ^
/llvm/libc_worker/worker/libc-arm32-debian/libc-arm32-debian-dbg/llvm-project/libc/src/__support/FPUtil/bfloat16.h:75:12: note: non-constexpr function 'less_than_or_equals<__llvm_libc_20_0_0_git::fputil::BFloat16>' cannot be used in a constant expression
    return fputil::less_than_or_equals(*this, other);
           ^

```

</details>

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


More information about the libc-commits mailing list