Skip to content

[libc][math] Refactor frexpf128 implementation to header-only in src/… #147822

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 12, 2025

Conversation

bassiounix
Copy link
Contributor

@llvmbot llvmbot added libc bazel "Peripheral" support tier build system: utils/bazel labels Jul 9, 2025
@llvmbot
Copy link
Member

llvmbot commented Jul 9, 2025

@llvm/pr-subscribers-libc

Author: Muhammad Bassiouni (bassiounix)

Changes

Part of #147386

in preparation for: https://discourse.llvm.org/t/rfc-make-clang-builtin-math-functions-constexpr-with-llvm-libc-to-support-c-23-constexpr-math-functions/86450

@lntue


Full diff: https://github.com/llvm/llvm-project/pull/147822.diff

7 Files Affected:

  • (modified) libc/shared/math.h (+1)
  • (added) libc/shared/math/frexpf128.h (+30)
  • (modified) libc/src/__support/math/CMakeLists.txt (+9)
  • (added) libc/src/__support/math/frexpf128.h (+36)
  • (modified) libc/src/math/generic/CMakeLists.txt (+1-2)
  • (modified) libc/src/math/generic/frexpf128.cpp (+3-4)
  • (modified) utils/bazel/llvm-project-overlay/libc/BUILD.bazel (+10)
diff --git a/libc/shared/math.h b/libc/shared/math.h
index 4ddc29c7ae834..00e770b73d341 100644
--- a/libc/shared/math.h
+++ b/libc/shared/math.h
@@ -12,5 +12,6 @@
 #include "libc_common.h"
 
 #include "math/expf.h"
+#include "math/frexpf128.h"
 
 #endif // LLVM_LIBC_SHARED_MATH_H
diff --git a/libc/shared/math/frexpf128.h b/libc/shared/math/frexpf128.h
new file mode 100644
index 0000000000000..0eea36e32ede1
--- /dev/null
+++ b/libc/shared/math/frexpf128.h
@@ -0,0 +1,30 @@
+//===-- Shared frexpf128 function -------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_MATH_FREXPF128_H
+#define LLVM_LIBC_SHARED_MATH_FREXPF128_H
+
+#include "include/llvm-libc-types/float128.h"
+#include "shared/libc_common.h"
+#include "src/__support/macros/properties/complex_types.h"
+
+#ifndef LIBC_TYPES_HAS_FLOAT128
+#error unsupported
+#endif
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::frexpf128;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT128
+
+#endif // LLVM_LIBC_SHARED_MATH_FREXPF128_H
diff --git a/libc/src/__support/math/CMakeLists.txt b/libc/src/__support/math/CMakeLists.txt
index 66c1d19a1cab0..17306d7dc2938 100644
--- a/libc/src/__support/math/CMakeLists.txt
+++ b/libc/src/__support/math/CMakeLists.txt
@@ -22,3 +22,12 @@ add_header_library(
     libc.src.__support.macros.config
     libc.src.__support.macros.optimization
 )
+
+add_header_library(
+  frexpf128
+  HDRS
+    frexpf128.h
+  DEPENDS
+    libc.src.__support.macros.properties.types
+    libc.src.__support.FPUtil.manipulation_functions
+)
diff --git a/libc/src/__support/math/frexpf128.h b/libc/src/__support/math/frexpf128.h
new file mode 100644
index 0000000000000..795155f556602
--- /dev/null
+++ b/libc/src/__support/math/frexpf128.h
@@ -0,0 +1,36 @@
+//===-- Implementation header for expf --------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC___SUPPORT_MATH_FREXPF128_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FREXPF128_H
+
+#include "include/llvm-libc-types/float128.h"
+
+#ifndef LIBC_TYPES_HAS_FLOAT128
+#error unsupported
+#else
+
+#include "src/__support/FPUtil/ManipulationFunctions.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+namespace math {
+
+static constexpr float128 frexpf128(float128 x, int *exp) {
+  return fputil::frexp(x, *exp);
+}
+
+} // namespace math
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT128
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FREXPF128_H
diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt
index fd1e6c0d648aa..586593ae6cb96 100644
--- a/libc/src/math/generic/CMakeLists.txt
+++ b/libc/src/math/generic/CMakeLists.txt
@@ -1786,8 +1786,7 @@ add_entrypoint_object(
   HDRS
     ../frexpf128.h
   DEPENDS
-    libc.src.__support.macros.properties.types
-    libc.src.__support.FPUtil.manipulation_functions
+    libc.src.__support.math.frexpf128
 )
 
 add_entrypoint_object(
diff --git a/libc/src/math/generic/frexpf128.cpp b/libc/src/math/generic/frexpf128.cpp
index eb816c4769707..55f7afcf4aea5 100644
--- a/libc/src/math/generic/frexpf128.cpp
+++ b/libc/src/math/generic/frexpf128.cpp
@@ -7,14 +7,13 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/frexpf128.h"
-#include "src/__support/FPUtil/ManipulationFunctions.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+
+#include "src/__support/math/frexpf128.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(float128, frexpf128, (float128 x, int *exp)) {
-  return fputil::frexp(x, *exp);
+  return math::frexpf128(x, exp);
 }
 
 } // namespace LIBC_NAMESPACE_DECL
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 2484a2f1e2bd7..7c04b417c0544 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -2096,6 +2096,15 @@ libc_support_library(
     ],
 )
 
+libc_support_library(
+    name = "__support_math_frexpf128",
+    hdrs = ["src/__support/math/frexpf128.h"],
+    deps = [
+        ":__support_macros_properties_types",
+        ":__support_fputil_manipulation_functions",
+    ],
+)
+
 ############################### complex targets ################################
 
 libc_function(
@@ -2694,6 +2703,7 @@ libc_math_function(
     name = "expf",
     additional_deps = [
         ":__support_math_expf",
+        ":__support_math_frexpf128",
         ":errno",
     ],
 )

@bassiounix bassiounix requested a review from lntue July 12, 2025 02:24
@lntue lntue merged commit af6500d into llvm:main Jul 12, 2025
19 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 12, 2025

LLVM Buildbot has detected a new failure on builder libc-aarch64-ubuntu-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/104/builds/26669

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: 'python ../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py ...' (failure)
...
-- Set CPU features: FullFP16
-- Compiler features available: builtin_ceil_floor_rint_trunc;builtin_fmax_fmin;builtin_fmaxf16_fminf16;builtin_round;cfloat128;float128;float16
-- Using getrandom for hashtable randomness
-- check-runtimes does nothing.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu/build
@@@BUILD_STEP build libc@@@
Running: ninja libc
[1/2] Building CXX object libc/src/math/generic/CMakeFiles/libc.src.math.generic.frexpf128.dir/frexpf128.cpp.o
FAILED: libc/src/math/generic/CMakeFiles/libc.src.math.generic.frexpf128.dir/frexpf128.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/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 -fpie -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 -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.frexpf128.dir/frexpf128.cpp.o -MF libc/src/math/generic/CMakeFiles/libc.src.math.generic.frexpf128.dir/frexpf128.cpp.o.d -o libc/src/math/generic/CMakeFiles/libc.src.math.generic.frexpf128.dir/frexpf128.cpp.o -c /home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu/llvm-project/libc/src/math/generic/frexpf128.cpp
In file included from /home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu/llvm-project/libc/src/math/generic/frexpf128.cpp:11:
/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu/llvm-project/libc/src/__support/math/frexpf128.h:24:27: error: constexpr function never produces a constant expression [-Winvalid-constexpr]
static constexpr float128 frexpf128(float128 x, int *exp) {
                          ^
/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu/llvm-project/libc/src/__support/math/frexpf128.h:25:10: note: non-constexpr function 'frexp<long double, 0>' cannot be used in a constant expression
  return fputil::frexp(x, *exp);
         ^
/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu/llvm-project/libc/src/__support/FPUtil/ManipulationFunctions.h:32:15: note: declared here
LIBC_INLINE T frexp(T x, int &exp) {
              ^
1 error generated.
ninja: build stopped: subcommand failed.
['ninja', 'libc'] 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 176, in step
    yield
  File "../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 138, in main
    run_command(['ninja', 'libc'])
  File "../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 191, in run_command
    util.report_run_cmd(cmd, cwd=directory)
  File "/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu/llvm-zorg/zorg/buildbot/builders/annotated/util.py", line 49, in report_run_cmd
    subprocess.check_call(cmd, shell=shell, *args, **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 190, in check_call
    raise CalledProcessError(retcode, cmd)
CalledProcessError: Command '['ninja', 'libc']' returned non-zero exit status 1
@@@STEP_FAILURE@@@
@@@BUILD_STEP libc-unit-tests@@@
Running: ninja libc-unit-tests
[1/1024] Running unit test libc.test.src.math.rintf16_test.__unit__.__NO_ROUND_OPT
[==========] Running 5 tests from 1 test suite.
[ RUN      ] LlvmLibcRIntTest.specialNumbers
[       OK ] LlvmLibcRIntTest.specialNumbers (7 us)
[ RUN      ] LlvmLibcRIntTest.RoundNumbers
[       OK ] LlvmLibcRIntTest.RoundNumbers (65 us)
[ RUN      ] LlvmLibcRIntTest.Fractions
[       OK ] LlvmLibcRIntTest.Fractions (22 us)

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 12, 2025

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

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: 'python ../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py ...' (failure)
...
[ RUN      ] LlvmLibcCospifTest.SpecialNumbers
[       OK ] LlvmLibcCospifTest.SpecialNumbers (12 us)
[ RUN      ] LlvmLibcCospifTest.FTZMode
[       OK ] LlvmLibcCospifTest.FTZMode (3 us)
[ RUN      ] LlvmLibcCospifTest.DAZMode
[       OK ] LlvmLibcCospifTest.DAZMode (3 us)
[ RUN      ] LlvmLibcCospifTest.FTZDAZMode
[       OK ] LlvmLibcCospifTest.FTZDAZMode (2 us)
Ran 4 tests.  PASS: 4  FAIL: 0
[153/1206] Building CXX object libc/src/math/generic/CMakeFiles/libc.src.math.generic.frexpf128.__internal__.dir/frexpf128.cpp.o
FAILED: libc/src/math/generic/CMakeFiles/libc.src.math.generic.frexpf128.__internal__.dir/frexpf128.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 -mavx2 -mfma -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 -std=gnu++17 -MD -MT libc/src/math/generic/CMakeFiles/libc.src.math.generic.frexpf128.__internal__.dir/frexpf128.cpp.o -MF libc/src/math/generic/CMakeFiles/libc.src.math.generic.frexpf128.__internal__.dir/frexpf128.cpp.o.d -o libc/src/math/generic/CMakeFiles/libc.src.math.generic.frexpf128.__internal__.dir/frexpf128.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/frexpf128.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/frexpf128.cpp:11:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/__support/math/frexpf128.h: In function ‘constexpr float128 __llvm_libc_20_0_0_git::math::frexpf128(float128, 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/frexpf128.h:25:23: error: call to non-‘constexpr’ function ‘T __llvm_libc_20_0_0_git::fputil::frexp(T, int&) [with T = __float128; typename __llvm_libc_20_0_0_git::cpp::enable_if<is_floating_point_v<T>, int>::type <anonymous> = 0]’
   25 |   return fputil::frexp(x, *exp);
      |          ~~~~~~~~~~~~~^~~~~~~~~
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/math/frexpf128.h:16:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/__support/FPUtil/ManipulationFunctions.h:32:15: note: ‘T __llvm_libc_20_0_0_git::fputil::frexp(T, int&) [with T = __float128; typename __llvm_libc_20_0_0_git::cpp::enable_if<is_floating_point_v<T>, int>::type <anonymous> = 0]’ declared here
   32 | LIBC_INLINE T frexp(T x, int &exp) {
      |               ^~~~~
[154/1206] Building CXX object libc/src/math/generic/CMakeFiles/libc.src.math.generic.frexpf128.dir/frexpf128.cpp.o
FAILED: libc/src/math/generic/CMakeFiles/libc.src.math.generic.frexpf128.dir/frexpf128.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 -mavx2 -mfma -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.frexpf128.dir/frexpf128.cpp.o -MF libc/src/math/generic/CMakeFiles/libc.src.math.generic.frexpf128.dir/frexpf128.cpp.o.d -o libc/src/math/generic/CMakeFiles/libc.src.math.generic.frexpf128.dir/frexpf128.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/frexpf128.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/frexpf128.cpp:11:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/__support/math/frexpf128.h: In function ‘constexpr float128 __llvm_libc_20_0_0_git::math::frexpf128(float128, 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/frexpf128.h:25:23: error: call to non-‘constexpr’ function ‘T __llvm_libc_20_0_0_git::fputil::frexp(T, int&) [with T = __float128; typename __llvm_libc_20_0_0_git::cpp::enable_if<is_floating_point_v<T>, int>::type <anonymous> = 0]’
   25 |   return fputil::frexp(x, *exp);
      |          ~~~~~~~~~~~~~^~~~~~~~~
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/math/frexpf128.h:16:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/__support/FPUtil/ManipulationFunctions.h:32:15: note: ‘T __llvm_libc_20_0_0_git::fputil::frexp(T, int&) [with T = __float128; typename __llvm_libc_20_0_0_git::cpp::enable_if<is_floating_point_v<T>, int>::type <anonymous> = 0]’ declared here
   32 | LIBC_INLINE T frexp(T x, int &exp) {
      |               ^~~~~
[155/1206] Building CXX object libc/src/math/generic/CMakeFiles/libc.src.math.generic.frexpf128.__NO_FMA_OPT.__internal__.dir/frexpf128.cpp.o
FAILED: libc/src/math/generic/CMakeFiles/libc.src.math.generic.frexpf128.__NO_FMA_OPT.__internal__.dir/frexpf128.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 -std=gnu++17 -MD -MT libc/src/math/generic/CMakeFiles/libc.src.math.generic.frexpf128.__NO_FMA_OPT.__internal__.dir/frexpf128.cpp.o -MF libc/src/math/generic/CMakeFiles/libc.src.math.generic.frexpf128.__NO_FMA_OPT.__internal__.dir/frexpf128.cpp.o.d -o libc/src/math/generic/CMakeFiles/libc.src.math.generic.frexpf128.__NO_FMA_OPT.__internal__.dir/frexpf128.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/frexpf128.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/frexpf128.cpp:11:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/__support/math/frexpf128.h: In function ‘constexpr float128 __llvm_libc_20_0_0_git::math::frexpf128(float128, 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/frexpf128.h:25:23: error: call to non-‘constexpr’ function ‘T __llvm_libc_20_0_0_git::fputil::frexp(T, int&) [with T = __float128; typename __llvm_libc_20_0_0_git::cpp::enable_if<is_floating_point_v<T>, int>::type <anonymous> = 0]’
   25 |   return fputil::frexp(x, *exp);
      |          ~~~~~~~~~~~~~^~~~~~~~~
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/math/frexpf128.h:16:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/__support/FPUtil/ManipulationFunctions.h:32:15: note: ‘T __llvm_libc_20_0_0_git::fputil::frexp(T, int&) [with T = __float128; typename __llvm_libc_20_0_0_git::cpp::enable_if<is_floating_point_v<T>, int>::type <anonymous> = 0]’ declared here
   32 | LIBC_INLINE T frexp(T x, int &exp) {
      |               ^~~~~
[156/1206] Building CXX object libc/src/math/generic/CMakeFiles/libc.src.math.generic.frexpf128.__NO_FMA_OPT.dir/frexpf128.cpp.o
FAILED: libc/src/math/generic/CMakeFiles/libc.src.math.generic.frexpf128.__NO_FMA_OPT.dir/frexpf128.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.frexpf128.__NO_FMA_OPT.dir/frexpf128.cpp.o -MF libc/src/math/generic/CMakeFiles/libc.src.math.generic.frexpf128.__NO_FMA_OPT.dir/frexpf128.cpp.o.d -o libc/src/math/generic/CMakeFiles/libc.src.math.generic.frexpf128.__NO_FMA_OPT.dir/frexpf128.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/frexpf128.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/frexpf128.cpp:11:

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 12, 2025

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

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: 'python ../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py ...' (failure)
...
[       OK ] LlvmLibcStdcHasSingleBitUcTest.OneHot (1 us)
Ran 2 tests.  PASS: 2  FAIL: 0
[198/919] Running unit test libc.test.src.math.smoke.iscanonicall_test.__unit__
[==========] Running 2 tests from 1 test suite.
[ RUN      ] LlvmLibcIsCanonicalTest.SpecialNumbers
[       OK ] LlvmLibcIsCanonicalTest.SpecialNumbers (6 us)
[ RUN      ] LlvmLibcIsCanonicalTest.RoundedNubmers
[       OK ] LlvmLibcIsCanonicalTest.RoundedNubmers (2 us)
Ran 2 tests.  PASS: 2  FAIL: 0
[199/919] Building CXX object libc/src/math/generic/CMakeFiles/libc.src.math.generic.frexpf128.dir/frexpf128.cpp.o
FAILED: libc/src/math/generic/CMakeFiles/libc.src.math.generic.frexpf128.dir/frexpf128.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 -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 -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.frexpf128.dir/frexpf128.cpp.o -MF libc/src/math/generic/CMakeFiles/libc.src.math.generic.frexpf128.dir/frexpf128.cpp.o.d -o libc/src/math/generic/CMakeFiles/libc.src.math.generic.frexpf128.dir/frexpf128.cpp.o -c /home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/src/math/generic/frexpf128.cpp
In file included from /home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/src/math/generic/frexpf128.cpp:11:
/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/src/__support/math/frexpf128.h:24:27: error: constexpr function never produces a constant expression [-Winvalid-constexpr]
static constexpr float128 frexpf128(float128 x, int *exp) {
                          ^
/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/src/__support/math/frexpf128.h:25:10: note: non-constexpr function 'frexp<long double, 0>' cannot be used in a constant expression
  return fputil::frexp(x, *exp);
         ^
/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/src/__support/FPUtil/ManipulationFunctions.h:32:15: note: declared here
LIBC_INLINE T frexp(T x, int &exp) {
              ^
1 error generated.
[200/919] Running unit test libc.test.src.math.logbf_test.__unit__
[==========] Running 4 tests from 1 test suite.
[ RUN      ] LlvmLibcLogbTest.SpecialNumbers
[       OK ] LlvmLibcLogbTest.SpecialNumbers (4 us)
[ RUN      ] LlvmLibcLogbTest.PowersOfTwo
[       OK ] LlvmLibcLogbTest.PowersOfTwo (5 us)
[ RUN      ] LlvmLibcLogbTest.SomeIntegers
[       OK ] LlvmLibcLogbTest.SomeIntegers (4 us)
[ RUN      ] LlvmLibcLogbTest.InRange
[       OK ] LlvmLibcLogbTest.InRange (66 ms)
Ran 4 tests.  PASS: 4  FAIL: 0
[201/919] Building CXX object libc/src/math/generic/CMakeFiles/libc.src.math.generic.frexpf128.__internal__.dir/frexpf128.cpp.o
FAILED: libc/src/math/generic/CMakeFiles/libc.src.math.generic.frexpf128.__internal__.dir/frexpf128.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 -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 -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.frexpf128.__internal__.dir/frexpf128.cpp.o -MF libc/src/math/generic/CMakeFiles/libc.src.math.generic.frexpf128.__internal__.dir/frexpf128.cpp.o.d -o libc/src/math/generic/CMakeFiles/libc.src.math.generic.frexpf128.__internal__.dir/frexpf128.cpp.o -c /home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/src/math/generic/frexpf128.cpp
In file included from /home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/src/math/generic/frexpf128.cpp:11:
/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/src/__support/math/frexpf128.h:24:27: error: constexpr function never produces a constant expression [-Winvalid-constexpr]
static constexpr float128 frexpf128(float128 x, int *exp) {
                          ^
/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/src/__support/math/frexpf128.h:25:10: note: non-constexpr function 'frexp<long double, 0>' cannot be used in a constant expression
  return fputil::frexp(x, *exp);
         ^
/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/src/__support/FPUtil/ManipulationFunctions.h:32:15: note: declared here
LIBC_INLINE T frexp(T x, int &exp) {
              ^
1 error generated.
[202/919] Running unit test libc.test.src.math.smoke.fmodf128_test.__unit__

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bazel "Peripheral" support tier build system: utils/bazel libc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants