[libc-commits] [libc] [llvm] Revert "[libc][math] Refactor fmaximum_mag_num family to header-only" (PR #194183)

Muhammad Bassiouni via libc-commits libc-commits at lists.llvm.org
Sat Apr 25 15:14:07 PDT 2026


https://github.com/bassiounix created https://github.com/llvm/llvm-project/pull/194183

Reverts llvm/llvm-project#182169

>From 4713f10a3bd6e92d931157653caa26977308f8ad Mon Sep 17 00:00:00 2001
From: Muhammad Bassiouni <60100307+bassiounix at users.noreply.github.com>
Date: Sun, 26 Apr 2026 01:13:36 +0300
Subject: [PATCH] Revert "[libc][math] Refactor fmaximum_mag_num family to
 header-only (#182169)"

This reverts commit 23cc957f50710b431854e5281a434fcdc419c284.
---
 libc/shared/math.h                            |  3 --
 libc/shared/math/fmaximum_mag_num.h           | 23 ---------
 libc/shared/math/fmaximum_mag_numbf16.h       | 23 ---------
 libc/shared/math/fmaximum_mag_numf.h          | 23 ---------
 libc/src/__support/FPUtil/BasicOperations.h   | 27 +++++-----
 libc/src/__support/math/CMakeLists.txt        | 30 ------------
 libc/src/__support/math/fmaximum_mag_num.h    | 25 ----------
 .../src/__support/math/fmaximum_mag_numbf16.h | 26 ----------
 libc/src/__support/math/fmaximum_mag_numf.h   | 25 ----------
 libc/src/math/generic/CMakeLists.txt          | 11 +++--
 libc/src/math/generic/fmaximum_mag_num.cpp    |  6 ++-
 .../src/math/generic/fmaximum_mag_numbf16.cpp |  7 ++-
 libc/src/math/generic/fmaximum_mag_numf.cpp   |  6 ++-
 libc/test/shared/CMakeLists.txt               |  6 ---
 .../shared/shared_math_constexpr_test.cpp     |  5 --
 libc/test/shared/shared_math_test.cpp         |  7 ---
 .../llvm-project-overlay/libc/BUILD.bazel     | 49 +------------------
 17 files changed, 34 insertions(+), 268 deletions(-)
 delete mode 100644 libc/shared/math/fmaximum_mag_num.h
 delete mode 100644 libc/shared/math/fmaximum_mag_numbf16.h
 delete mode 100644 libc/shared/math/fmaximum_mag_numf.h
 delete mode 100644 libc/src/__support/math/fmaximum_mag_num.h
 delete mode 100644 libc/src/__support/math/fmaximum_mag_numbf16.h
 delete mode 100644 libc/src/__support/math/fmaximum_mag_numf.h

diff --git a/libc/shared/math.h b/libc/shared/math.h
index 80078afea59ba..66b7af9b95ebc 100644
--- a/libc/shared/math.h
+++ b/libc/shared/math.h
@@ -175,9 +175,6 @@
 #include "math/fmaxf.h"
 #include "math/fmaxf128.h"
 #include "math/fmaxf16.h"
-#include "math/fmaximum_mag_num.h"
-#include "math/fmaximum_mag_numbf16.h"
-#include "math/fmaximum_mag_numf.h"
 #include "math/fmaxl.h"
 #include "math/frexpf.h"
 #include "math/frexpf128.h"
diff --git a/libc/shared/math/fmaximum_mag_num.h b/libc/shared/math/fmaximum_mag_num.h
deleted file mode 100644
index a644072cd4406..0000000000000
--- a/libc/shared/math/fmaximum_mag_num.h
+++ /dev/null
@@ -1,23 +0,0 @@
-//===-- Shared fmaximum_mag_num 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_FMAXIMUM_MAG_NUM_H
-#define LLVM_LIBC_SHARED_MATH_FMAXIMUM_MAG_NUM_H
-
-#include "shared/libc_common.h"
-#include "src/__support/math/fmaximum_mag_num.h"
-
-namespace LIBC_NAMESPACE_DECL {
-namespace shared {
-
-using math::fmaximum_mag_num;
-
-} // namespace shared
-} // namespace LIBC_NAMESPACE_DECL
-
-#endif // LLVM_LIBC_SHARED_MATH_FMAXIMUM_MAG_NUM_H
diff --git a/libc/shared/math/fmaximum_mag_numbf16.h b/libc/shared/math/fmaximum_mag_numbf16.h
deleted file mode 100644
index d6b4067e59451..0000000000000
--- a/libc/shared/math/fmaximum_mag_numbf16.h
+++ /dev/null
@@ -1,23 +0,0 @@
-//===-- Shared fmaximum_mag_numbf16 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_FMAXIMUM_MAG_NUMBF16_H
-#define LLVM_LIBC_SHARED_MATH_FMAXIMUM_MAG_NUMBF16_H
-
-#include "shared/libc_common.h"
-#include "src/__support/math/fmaximum_mag_numbf16.h"
-
-namespace LIBC_NAMESPACE_DECL {
-namespace shared {
-
-using math::fmaximum_mag_numbf16;
-
-} // namespace shared
-} // namespace LIBC_NAMESPACE_DECL
-
-#endif // LLVM_LIBC_SHARED_MATH_FMAXIMUM_MAG_NUMBF16_H
diff --git a/libc/shared/math/fmaximum_mag_numf.h b/libc/shared/math/fmaximum_mag_numf.h
deleted file mode 100644
index 57236f4dcf1d9..0000000000000
--- a/libc/shared/math/fmaximum_mag_numf.h
+++ /dev/null
@@ -1,23 +0,0 @@
-//===-- Shared fmaximum_mag_numf 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_FMAXIMUM_MAG_NUMF_H
-#define LLVM_LIBC_SHARED_MATH_FMAXIMUM_MAG_NUMF_H
-
-#include "shared/libc_common.h"
-#include "src/__support/math/fmaximum_mag_numf.h"
-
-namespace LIBC_NAMESPACE_DECL {
-namespace shared {
-
-using math::fmaximum_mag_numf;
-
-} // namespace shared
-} // namespace LIBC_NAMESPACE_DECL
-
-#endif // LLVM_LIBC_SHARED_MATH_FMAXIMUM_MAG_NUMF_H
diff --git a/libc/src/__support/FPUtil/BasicOperations.h b/libc/src/__support/FPUtil/BasicOperations.h
index 2da9b55673b09..ee5c90a8f290f 100644
--- a/libc/src/__support/FPUtil/BasicOperations.h
+++ b/libc/src/__support/FPUtil/BasicOperations.h
@@ -33,30 +33,25 @@ LIBC_INLINE constexpr T abs(T x) {
 namespace internal {
 
 template <typename T>
-LIBC_INLINE constexpr cpp::enable_if_t<cpp::is_floating_point_v<T>, T>
-constexpr_max(T x, T y) {
+LIBC_INLINE cpp::enable_if_t<cpp::is_floating_point_v<T>, T> max(T x, T y) {
   FPBits<T> x_bits(x);
   FPBits<T> y_bits(y);
+
+  // To make sure that fmax(+0, -0) == +0 == fmax(-0, +0), whenever x and y
+  // have different signs and both are not NaNs, we return the number with
+  // positive sign.
   if (x_bits.sign() != y_bits.sign())
     return x_bits.is_pos() ? x : y;
   return x > y ? x : y;
 }
 
-template <typename T>
-LIBC_INLINE constexpr cpp::enable_if_t<cpp::is_floating_point_v<T>, T>
-max(T x, T y) {
-  return constexpr_max(x, y);
-}
-
 #ifdef LIBC_TYPES_HAS_FLOAT16
 #if defined(__LIBC_USE_BUILTIN_FMAXF16_FMINF16)
-template <> LIBC_INLINE constexpr float16 max(float16 x, float16 y) {
-  if (cpp::is_constant_evaluated())
-    return constexpr_max(x, y);
+template <> LIBC_INLINE float16 max(float16 x, float16 y) {
   return __builtin_fmaxf16(x, y);
 }
 #elif !defined(LIBC_TARGET_ARCH_IS_AARCH64)
-template <> LIBC_INLINE constexpr float16 max(float16 x, float16 y) {
+template <> LIBC_INLINE float16 max(float16 x, float16 y) {
   FPBits<float16> x_bits(x);
   FPBits<float16> y_bits(y);
 
@@ -68,11 +63,11 @@ template <> LIBC_INLINE constexpr float16 max(float16 x, float16 y) {
 #endif // LIBC_TYPES_HAS_FLOAT16
 
 #if defined(__LIBC_USE_BUILTIN_FMAX_FMIN) && !defined(LIBC_TARGET_ARCH_IS_X86)
-template <> LIBC_INLINE constexpr float max(float x, float y) {
+template <> LIBC_INLINE float max(float x, float y) {
   return __builtin_fmaxf(x, y);
 }
 
-template <> LIBC_INLINE constexpr double max(double x, double y) {
+template <> LIBC_INLINE double max(double x, double y) {
   return __builtin_fmax(x, y);
 }
 #endif
@@ -164,7 +159,7 @@ LIBC_INLINE T fminimum(T x, T y) {
 }
 
 template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
-LIBC_INLINE constexpr T fmaximum_num(T x, T y) {
+LIBC_INLINE T fmaximum_num(T x, T y) {
   FPBits<T> bitx(x), bity(y);
   if (bitx.is_signaling_nan() || bity.is_signaling_nan()) {
     fputil::raise_except_if_required(FE_INVALID);
@@ -216,7 +211,7 @@ LIBC_INLINE T fminimum_mag(T x, T y) {
 }
 
 template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
-LIBC_INLINE constexpr T fmaximum_mag_num(T x, T y) {
+LIBC_INLINE T fmaximum_mag_num(T x, T y) {
   FPBits<T> bitx(x), bity(y);
 
   if (abs(x) > abs(y))
diff --git a/libc/src/__support/math/CMakeLists.txt b/libc/src/__support/math/CMakeLists.txt
index 67c3b28109987..f72dd6772c8ca 100644
--- a/libc/src/__support/math/CMakeLists.txt
+++ b/libc/src/__support/math/CMakeLists.txt
@@ -1674,36 +1674,6 @@ add_header_library(
     libc.src.__support.macros.config
 )
 
-add_header_library(
-  fmaximum_mag_num
-  HDRS
-    fmaximum_mag_num.h
-  DEPENDS
-    libc.src.__support.FPUtil.basic_operations
-    libc.src.__support.macros.config
-)
-
-add_header_library(
-  fmaximum_mag_numbf16
-  HDRS
-    fmaximum_mag_numbf16.h
-  DEPENDS
-    libc.src.__support.FPUtil.basic_operations
-    libc.src.__support.FPUtil.bfloat16
-    libc.src.__support.macros.config
-  FLAGS
-    MISC_MATH_BASIC_OPS_OPT
-)
-
-add_header_library(
-  fmaximum_mag_numf
-  HDRS
-    fmaximum_mag_numf.h
-  DEPENDS
-    libc.src.__support.FPUtil.basic_operations
-    libc.src.__support.macros.config
-)
-
 add_header_library(
   fmabf16
   HDRS
diff --git a/libc/src/__support/math/fmaximum_mag_num.h b/libc/src/__support/math/fmaximum_mag_num.h
deleted file mode 100644
index bb54f5c8919d1..0000000000000
--- a/libc/src/__support/math/fmaximum_mag_num.h
+++ /dev/null
@@ -1,25 +0,0 @@
-//===-- Implementation header for fmaximum_mag_num --------------*- 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_FMAXIMUM_MAG_NUM_H
-#define LLVM_LIBC_SRC___SUPPORT_MATH_FMAXIMUM_MAG_NUM_H
-
-#include "src/__support/FPUtil/BasicOperations.h"
-#include "src/__support/macros/config.h"
-
-namespace LIBC_NAMESPACE_DECL {
-namespace math {
-
-LIBC_INLINE constexpr double fmaximum_mag_num(double x, double y) {
-  return fputil::fmaximum_mag_num(x, y);
-}
-
-} // namespace math
-} // namespace LIBC_NAMESPACE_DECL
-
-#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FMAXIMUM_MAG_NUM_H
diff --git a/libc/src/__support/math/fmaximum_mag_numbf16.h b/libc/src/__support/math/fmaximum_mag_numbf16.h
deleted file mode 100644
index 7010371015589..0000000000000
--- a/libc/src/__support/math/fmaximum_mag_numbf16.h
+++ /dev/null
@@ -1,26 +0,0 @@
-//===-- Implementation header for fmaximum_mag_numbf16 ----------*- 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_FMAXIMUM_MAG_NUMBF16_H
-#define LLVM_LIBC_SRC___SUPPORT_MATH_FMAXIMUM_MAG_NUMBF16_H
-
-#include "src/__support/FPUtil/BasicOperations.h"
-#include "src/__support/FPUtil/bfloat16.h"
-#include "src/__support/macros/config.h"
-
-namespace LIBC_NAMESPACE_DECL {
-namespace math {
-
-LIBC_INLINE constexpr bfloat16 fmaximum_mag_numbf16(bfloat16 x, bfloat16 y) {
-  return fputil::fmaximum_mag_num(x, y);
-}
-
-} // namespace math
-} // namespace LIBC_NAMESPACE_DECL
-
-#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FMAXIMUM_MAG_NUMBF16_H
diff --git a/libc/src/__support/math/fmaximum_mag_numf.h b/libc/src/__support/math/fmaximum_mag_numf.h
deleted file mode 100644
index c2298b85b4c77..0000000000000
--- a/libc/src/__support/math/fmaximum_mag_numf.h
+++ /dev/null
@@ -1,25 +0,0 @@
-//===-- Implementation header for fmaximum_mag_numf -------------*- 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_FMAXIMUM_MAG_NUMF_H
-#define LLVM_LIBC_SRC___SUPPORT_MATH_FMAXIMUM_MAG_NUMF_H
-
-#include "src/__support/FPUtil/BasicOperations.h"
-#include "src/__support/macros/config.h"
-
-namespace LIBC_NAMESPACE_DECL {
-namespace math {
-
-LIBC_INLINE constexpr float fmaximum_mag_numf(float x, float y) {
-  return fputil::fmaximum_mag_num(x, y);
-}
-
-} // namespace math
-} // namespace LIBC_NAMESPACE_DECL
-
-#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FMAXIMUM_MAG_NUMF_H
diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt
index 0b91d1d4404ab..eed816057b934 100644
--- a/libc/src/math/generic/CMakeLists.txt
+++ b/libc/src/math/generic/CMakeLists.txt
@@ -2423,7 +2423,7 @@ add_entrypoint_object(
   HDRS
     ../fmaximum_mag_num.h
   DEPENDS
-    libc.src.__support.math.fmaximum_mag_num
+    libc.src.__support.FPUtil.basic_operations
 )
 
 add_entrypoint_object(
@@ -2433,7 +2433,7 @@ add_entrypoint_object(
   HDRS
     ../fmaximum_mag_numf.h
   DEPENDS
-    libc.src.__support.math.fmaximum_mag_numf
+    libc.src.__support.FPUtil.basic_operations
 )
 
 add_entrypoint_object(
@@ -2475,7 +2475,12 @@ add_entrypoint_object(
   HDRS
     ../fmaximum_mag_numbf16.h
   DEPENDS
-    libc.src.__support.math.fmaximum_mag_numbf16
+    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.FPUtil.bfloat16
+    libc.src.__support.macros.config
+    libc.src.__support.macros.properties.types
+  FLAGS
+    MISC_MATH_BASIC_OPS_OPT
 )
 
 add_entrypoint_object(
diff --git a/libc/src/math/generic/fmaximum_mag_num.cpp b/libc/src/math/generic/fmaximum_mag_num.cpp
index 40c8f6e3755d0..de250bbd32b7b 100644
--- a/libc/src/math/generic/fmaximum_mag_num.cpp
+++ b/libc/src/math/generic/fmaximum_mag_num.cpp
@@ -7,12 +7,14 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/fmaximum_mag_num.h"
-#include "src/__support/math/fmaximum_mag_num.h"
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(double, fmaximum_mag_num, (double x, double y)) {
-  return math::fmaximum_mag_num(x, y);
+  return fputil::fmaximum_mag_num(x, y);
 }
 
 } // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/fmaximum_mag_numbf16.cpp b/libc/src/math/generic/fmaximum_mag_numbf16.cpp
index a54725b7f1eee..485e32959b53a 100644
--- a/libc/src/math/generic/fmaximum_mag_numbf16.cpp
+++ b/libc/src/math/generic/fmaximum_mag_numbf16.cpp
@@ -7,12 +7,15 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/fmaximum_mag_numbf16.h"
-#include "src/__support/math/fmaximum_mag_numbf16.h"
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/FPUtil/bfloat16.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(bfloat16, fmaximum_mag_numbf16, (bfloat16 x, bfloat16 y)) {
-  return math::fmaximum_mag_numbf16(x, y);
+  return fputil::fmaximum_mag_num(x, y);
 }
 
 } // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/fmaximum_mag_numf.cpp b/libc/src/math/generic/fmaximum_mag_numf.cpp
index 97039ef845aec..e372f1bd1f9d3 100644
--- a/libc/src/math/generic/fmaximum_mag_numf.cpp
+++ b/libc/src/math/generic/fmaximum_mag_numf.cpp
@@ -7,12 +7,14 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/fmaximum_mag_numf.h"
-#include "src/__support/math/fmaximum_mag_numf.h"
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(float, fmaximum_mag_numf, (float x, float y)) {
-  return math::fmaximum_mag_numf(x, y);
+  return fputil::fmaximum_mag_num(x, y);
 }
 
 } // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/test/shared/CMakeLists.txt b/libc/test/shared/CMakeLists.txt
index 891b02d2077bb..4a210c81b7a0c 100644
--- a/libc/test/shared/CMakeLists.txt
+++ b/libc/test/shared/CMakeLists.txt
@@ -172,9 +172,6 @@ add_fp_unittest(
     libc.src.__support.math.fmaxf
     libc.src.__support.math.fmaxf128
     libc.src.__support.math.fmaxf16
-    libc.src.__support.math.fmaximum_mag_num
-    libc.src.__support.math.fmaximum_mag_numbf16
-    libc.src.__support.math.fmaximum_mag_numf
     libc.src.__support.math.fmaxl
     libc.src.__support.math.frexpf
     libc.src.__support.math.frexpf128
@@ -327,9 +324,6 @@ add_fp_unittest(
     libc.src.__support.math.fabsf128
     libc.src.__support.math.fabsf16
     libc.src.__support.math.fabsl
-    libc.src.__support.math.fmaximum_mag_num
-    libc.src.__support.math.fmaximum_mag_numbf16
-    libc.src.__support.math.fmaximum_mag_numf
     libc.src.__support.math.log
     libc.src.__support.math.logbbf16
 )
diff --git a/libc/test/shared/shared_math_constexpr_test.cpp b/libc/test/shared/shared_math_constexpr_test.cpp
index 3bc7d2b613d67..93050d14c858d 100644
--- a/libc/test/shared/shared_math_constexpr_test.cpp
+++ b/libc/test/shared/shared_math_constexpr_test.cpp
@@ -19,7 +19,6 @@ static_assert(0.0 == LIBC_NAMESPACE::shared::ceil(0.0));
 static_assert(0.0 == LIBC_NAMESPACE::shared::copysign(0.0, 0.0));
 static_assert(1.0 == LIBC_NAMESPACE::shared::fabs(-1.0));
 static_assert(0.0f == LIBC_NAMESPACE::shared::fdiv(0.0, 1.0));
-static_assert(2.0 == LIBC_NAMESPACE::shared::fmaximum_mag_num(1.0, 2.0));
 static_assert(1.0 == LIBC_NAMESPACE::shared::floor(1.2));
 static_assert(0.0 == LIBC_NAMESPACE::shared::log(1.0));
 
@@ -30,7 +29,6 @@ static_assert(0.0 == LIBC_NAMESPACE::shared::log(1.0));
 static_assert(0.0f == LIBC_NAMESPACE::shared::ceilf(0.0f));
 static_assert(0.0f == LIBC_NAMESPACE::shared::copysignf(0.0f, 0.0f));
 static_assert(1.0f == LIBC_NAMESPACE::shared::fabsf(-1.0f));
-static_assert(2.0f == LIBC_NAMESPACE::shared::fmaximum_mag_numf(1.0f, 2.0f));
 static_assert(0.0f == LIBC_NAMESPACE::shared::floorf(0.0f));
 
 //===----------------------------------------------------------------------===//
@@ -94,9 +92,6 @@ static_assert(bfloat16(0.0) == LIBC_NAMESPACE::shared::asinbf16(bfloat16(0.0)));
 static_assert(bfloat16(0.0) == LIBC_NAMESPACE::shared::ceilbf16(bfloat16(0.0)));
 static_assert(bfloat16(1.0) ==
               LIBC_NAMESPACE::shared::fabsbf16(bfloat16(-1.0)));
-static_assert(bfloat16(2.0) ==
-              LIBC_NAMESPACE::shared::fmaximum_mag_numbf16(bfloat16(1.0),
-                                                           bfloat16(2.0)));
 static_assert(bfloat16(0.0) ==
               LIBC_NAMESPACE::shared::copysignbf16(bfloat16(0.0),
                                                    bfloat16(0.0)));
diff --git a/libc/test/shared/shared_math_test.cpp b/libc/test/shared/shared_math_test.cpp
index d9d5c2c621d4a..d31436267f75b 100644
--- a/libc/test/shared/shared_math_test.cpp
+++ b/libc/test/shared/shared_math_test.cpp
@@ -182,8 +182,6 @@ TEST(LlvmLibcSharedMathTest, AllFloat) {
   EXPECT_FP_EQ(0.0f, LIBC_NAMESPACE::shared::fdimf(0.0f, 0.0f));
   EXPECT_FP_EQ(0.0f, LIBC_NAMESPACE::shared::floorf(0.0f));
   EXPECT_FP_EQ(0.0f, LIBC_NAMESPACE::shared::fmaxf(0.0f, 0.0f));
-  EXPECT_FP_EQ(0.0f, LIBC_NAMESPACE::shared::fmaximum_mag_numf(0.0f, 0.0f));
-
   float getpayloadf_x = 0.0f;
   EXPECT_FP_EQ(-1.0f, LIBC_NAMESPACE::shared::getpayloadf(&getpayloadf_x));
 
@@ -269,8 +267,6 @@ TEST(LlvmLibcSharedMathTest, AllDouble) {
   EXPECT_FP_EQ(1.0f, LIBC_NAMESPACE::shared::fdiv(1.0, 1.0));
   EXPECT_FP_EQ(0.0, LIBC_NAMESPACE::shared::floor(0.0));
   EXPECT_FP_EQ(0.0, LIBC_NAMESPACE::shared::fmax(0.0, 0.0));
-  EXPECT_FP_EQ(0.0, LIBC_NAMESPACE::shared::fmaximum_mag_num(0.0, 0.0));
-
   double getpayload_x = 0.0;
   EXPECT_FP_EQ(-1.0, LIBC_NAMESPACE::shared::getpayload(&getpayload_x));
 
@@ -500,9 +496,6 @@ TEST(LlvmLibcSharedMathTest, AllBFloat16) {
   EXPECT_FP_EQ(bfloat16(0.0),
                LIBC_NAMESPACE::shared::fmaxbf16(bfloat16(0.0), bfloat16(0.0)));
 
-  EXPECT_FP_EQ(0.0f, LIBC_NAMESPACE::shared::fmaximum_mag_numbf16(
-                         bfloat16(0.0), bfloat16(0.0)));
-
   bfloat16 getpayloadbf16_x = bfloat16(0.0);
   EXPECT_FP_EQ(bfloat16(-1.0),
                LIBC_NAMESPACE::shared::getpayloadbf16(&getpayloadbf16_x));
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 1be54084b85bc..b2355202d19ce 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -4822,34 +4822,6 @@ libc_support_library(
     ],
 )
 
-libc_support_library(
-    name = "__support_math_fmaximum_mag_num",
-    hdrs = ["src/__support/math/fmaximum_mag_num.h"],
-    deps = [
-        ":__support_fputil_basic_operations",
-        ":__support_macros_config",
-    ],
-)
-
-libc_support_library(
-    name = "__support_math_fmaximum_mag_numbf16",
-    hdrs = ["src/__support/math/fmaximum_mag_numbf16.h"],
-    deps = [
-        ":__support_fputil_basic_operations",
-        ":__support_fputil_bfloat16",
-        ":__support_macros_config",
-    ],
-)
-
-libc_support_library(
-    name = "__support_math_fmaximum_mag_numf",
-    hdrs = ["src/__support/math/fmaximum_mag_numf.h"],
-    deps = [
-        ":__support_fputil_basic_operations",
-        ":__support_macros_config",
-    ],
-)
-
 libc_support_library(
     name = "__support_math_ffmal",
     hdrs = ["src/__support/math/ffmal.h"],
@@ -7953,26 +7925,9 @@ libc_math_function(
     name = "fmaximum_magf16",
 )
 
-libc_math_function(
-    name = "fmaximum_mag_num",
-    additional_deps = [
-        ":__support_math_fmaximum_mag_num",
-    ],
-)
+libc_math_function(name = "fmaximum_mag_num")
 
-libc_math_function(
-    name = "fmaximum_mag_numbf16",
-    additional_deps = [
-        ":__support_math_fmaximum_mag_numbf16",
-    ],
-)
-
-libc_math_function(
-    name = "fmaximum_mag_numf",
-    additional_deps = [
-        ":__support_math_fmaximum_mag_numf",
-    ],
-)
+libc_math_function(name = "fmaximum_mag_numf")
 
 libc_math_function(name = "fmaximum_mag_numl")
 



More information about the libc-commits mailing list