[libc-commits] [libc] 2bc30bd - [libc][math] Refactor fmaximum-mag-fminimum-mag family to header-only (#195394)

via libc-commits libc-commits at lists.llvm.org
Fri May 1 19:50:25 PDT 2026


Author: Anonmiraj
Date: 2026-05-02T05:50:20+03:00
New Revision: 2bc30bdec89c8cd94f0d354c61daf8e8ccd951a4

URL: https://github.com/llvm/llvm-project/commit/2bc30bdec89c8cd94f0d354c61daf8e8ccd951a4
DIFF: https://github.com/llvm/llvm-project/commit/2bc30bdec89c8cd94f0d354c61daf8e8ccd951a4.diff

LOG: [libc][math] Refactor fmaximum-mag-fminimum-mag family to header-only (#195394)

Refactors the fmaximum-mag-fminimum-mag math family to be header-only.

part of: #147386

Target Functions:
  - fmaximum_mag
  - fmaximum_magbf16
  - fmaximum_magf
  - fmaximum_magf128
  - fmaximum_magf16
  - fmaximum_magl
  - fminimum_mag
  - fminimum_magbf16
  - fminimum_magf
  - fminimum_magf128
  - fminimum_magf16
  - fminimum_magl

Added: 
    libc/shared/math/fmaximum_mag.h
    libc/shared/math/fmaximum_magbf16.h
    libc/shared/math/fmaximum_magf.h
    libc/shared/math/fmaximum_magf128.h
    libc/shared/math/fmaximum_magf16.h
    libc/shared/math/fmaximum_magl.h
    libc/shared/math/fminimum_mag.h
    libc/shared/math/fminimum_magbf16.h
    libc/shared/math/fminimum_magf.h
    libc/shared/math/fminimum_magf128.h
    libc/shared/math/fminimum_magf16.h
    libc/shared/math/fminimum_magl.h
    libc/src/__support/math/fmaximum_mag.h
    libc/src/__support/math/fmaximum_magbf16.h
    libc/src/__support/math/fmaximum_magf.h
    libc/src/__support/math/fmaximum_magf128.h
    libc/src/__support/math/fmaximum_magf16.h
    libc/src/__support/math/fmaximum_magl.h
    libc/src/__support/math/fminimum_mag.h
    libc/src/__support/math/fminimum_magbf16.h
    libc/src/__support/math/fminimum_magf.h
    libc/src/__support/math/fminimum_magf128.h
    libc/src/__support/math/fminimum_magf16.h
    libc/src/__support/math/fminimum_magl.h

Modified: 
    libc/shared/math.h
    libc/src/__support/FPUtil/BasicOperations.h
    libc/src/__support/math/CMakeLists.txt
    libc/src/math/generic/CMakeLists.txt
    libc/src/math/generic/fmaximum_mag.cpp
    libc/src/math/generic/fmaximum_magbf16.cpp
    libc/src/math/generic/fmaximum_magf.cpp
    libc/src/math/generic/fmaximum_magf128.cpp
    libc/src/math/generic/fmaximum_magf16.cpp
    libc/src/math/generic/fmaximum_magl.cpp
    libc/src/math/generic/fminimum_mag.cpp
    libc/src/math/generic/fminimum_magbf16.cpp
    libc/src/math/generic/fminimum_magf.cpp
    libc/src/math/generic/fminimum_magf128.cpp
    libc/src/math/generic/fminimum_magf16.cpp
    libc/src/math/generic/fminimum_magl.cpp
    libc/test/shared/CMakeLists.txt
    libc/test/shared/shared_math_constexpr_test.cpp
    libc/test/shared/shared_math_test.cpp
    utils/bazel/llvm-project-overlay/libc/BUILD.bazel

Removed: 
    


################################################################################
diff  --git a/libc/shared/math.h b/libc/shared/math.h
index 6d2b573244c0c..7ad8c0c68c9a9 100644
--- a/libc/shared/math.h
+++ b/libc/shared/math.h
@@ -178,9 +178,15 @@
 #include "math/fmaxf128.h"
 #include "math/fmaxf16.h"
 #include "math/fmaximum.h"
+#include "math/fmaximum_mag.h"
 #include "math/fmaximum_mag_num.h"
 #include "math/fmaximum_mag_numbf16.h"
 #include "math/fmaximum_mag_numf.h"
+#include "math/fmaximum_magbf16.h"
+#include "math/fmaximum_magf.h"
+#include "math/fmaximum_magf128.h"
+#include "math/fmaximum_magf16.h"
+#include "math/fmaximum_magl.h"
 #include "math/fmaximum_num.h"
 #include "math/fmaximum_numbf16.h"
 #include "math/fmaximum_numf.h"
@@ -199,6 +205,12 @@
 #include "math/fminf128.h"
 #include "math/fminf16.h"
 #include "math/fminimum.h"
+#include "math/fminimum_mag.h"
+#include "math/fminimum_magbf16.h"
+#include "math/fminimum_magf.h"
+#include "math/fminimum_magf128.h"
+#include "math/fminimum_magf16.h"
+#include "math/fminimum_magl.h"
 #include "math/fminimum_num.h"
 #include "math/fminimum_numbf16.h"
 #include "math/fminimum_numf.h"

diff  --git a/libc/shared/math/fmaximum_mag.h b/libc/shared/math/fmaximum_mag.h
new file mode 100644
index 0000000000000..31b2742469e7e
--- /dev/null
+++ b/libc/shared/math/fmaximum_mag.h
@@ -0,0 +1,23 @@
+//===-- Shared fmaximum_mag 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_H
+#define LLVM_LIBC_SHARED_MATH_FMAXIMUM_MAG_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fmaximum_mag.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fmaximum_mag;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_FMAXIMUM_MAG_H

diff  --git a/libc/shared/math/fmaximum_magbf16.h b/libc/shared/math/fmaximum_magbf16.h
new file mode 100644
index 0000000000000..e37167c1035cc
--- /dev/null
+++ b/libc/shared/math/fmaximum_magbf16.h
@@ -0,0 +1,23 @@
+//===-- Shared fmaximum_magbf16 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_MAGBF16_H
+#define LLVM_LIBC_SHARED_MATH_FMAXIMUM_MAGBF16_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fmaximum_magbf16.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fmaximum_magbf16;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_FMAXIMUM_MAGBF16_H

diff  --git a/libc/shared/math/fmaximum_magf.h b/libc/shared/math/fmaximum_magf.h
new file mode 100644
index 0000000000000..ebbcd6be18e1b
--- /dev/null
+++ b/libc/shared/math/fmaximum_magf.h
@@ -0,0 +1,23 @@
+//===-- Shared fmaximum_magf 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_MAGF_H
+#define LLVM_LIBC_SHARED_MATH_FMAXIMUM_MAGF_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fmaximum_magf.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fmaximum_magf;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_FMAXIMUM_MAGF_H

diff  --git a/libc/shared/math/fmaximum_magf128.h b/libc/shared/math/fmaximum_magf128.h
new file mode 100644
index 0000000000000..4e409aa6ed0be
--- /dev/null
+++ b/libc/shared/math/fmaximum_magf128.h
@@ -0,0 +1,29 @@
+//===-- Shared fmaximum_magf128 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_MAGF128_H
+#define LLVM_LIBC_SHARED_MATH_FMAXIMUM_MAGF128_H
+
+#include "include/llvm-libc-types/float128.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT128
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fmaximum_magf128.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fmaximum_magf128;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT128
+
+#endif // LLVM_LIBC_SHARED_MATH_FMAXIMUM_MAGF128_H

diff  --git a/libc/shared/math/fmaximum_magf16.h b/libc/shared/math/fmaximum_magf16.h
new file mode 100644
index 0000000000000..3a7b7ba1addea
--- /dev/null
+++ b/libc/shared/math/fmaximum_magf16.h
@@ -0,0 +1,29 @@
+//===-- Shared fmaximum_magf16 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_MAGF16_H
+#define LLVM_LIBC_SHARED_MATH_FMAXIMUM_MAGF16_H
+
+#include "include/llvm-libc-macros/float16-macros.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT16
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fmaximum_magf16.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fmaximum_magf16;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT16
+
+#endif // LLVM_LIBC_SHARED_MATH_FMAXIMUM_MAGF16_H

diff  --git a/libc/shared/math/fmaximum_magl.h b/libc/shared/math/fmaximum_magl.h
new file mode 100644
index 0000000000000..c109d58621291
--- /dev/null
+++ b/libc/shared/math/fmaximum_magl.h
@@ -0,0 +1,23 @@
+//===-- Shared fmaximum_magl 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_MAGL_H
+#define LLVM_LIBC_SHARED_MATH_FMAXIMUM_MAGL_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fmaximum_magl.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fmaximum_magl;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_FMAXIMUM_MAGL_H

diff  --git a/libc/shared/math/fminimum_mag.h b/libc/shared/math/fminimum_mag.h
new file mode 100644
index 0000000000000..5713d10335c0f
--- /dev/null
+++ b/libc/shared/math/fminimum_mag.h
@@ -0,0 +1,23 @@
+//===-- Shared fminimum_mag 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_FMINIMUM_MAG_H
+#define LLVM_LIBC_SHARED_MATH_FMINIMUM_MAG_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fminimum_mag.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fminimum_mag;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_FMINIMUM_MAG_H

diff  --git a/libc/shared/math/fminimum_magbf16.h b/libc/shared/math/fminimum_magbf16.h
new file mode 100644
index 0000000000000..efc2132109cca
--- /dev/null
+++ b/libc/shared/math/fminimum_magbf16.h
@@ -0,0 +1,23 @@
+//===-- Shared fminimum_magbf16 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_FMINIMUM_MAGBF16_H
+#define LLVM_LIBC_SHARED_MATH_FMINIMUM_MAGBF16_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fminimum_magbf16.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fminimum_magbf16;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_FMINIMUM_MAGBF16_H

diff  --git a/libc/shared/math/fminimum_magf.h b/libc/shared/math/fminimum_magf.h
new file mode 100644
index 0000000000000..33b9230a72a77
--- /dev/null
+++ b/libc/shared/math/fminimum_magf.h
@@ -0,0 +1,23 @@
+//===-- Shared fminimum_magf 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_FMINIMUM_MAGF_H
+#define LLVM_LIBC_SHARED_MATH_FMINIMUM_MAGF_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fminimum_magf.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fminimum_magf;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_FMINIMUM_MAGF_H

diff  --git a/libc/shared/math/fminimum_magf128.h b/libc/shared/math/fminimum_magf128.h
new file mode 100644
index 0000000000000..13ebd6f9404b1
--- /dev/null
+++ b/libc/shared/math/fminimum_magf128.h
@@ -0,0 +1,29 @@
+//===-- Shared fminimum_magf128 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_FMINIMUM_MAGF128_H
+#define LLVM_LIBC_SHARED_MATH_FMINIMUM_MAGF128_H
+
+#include "include/llvm-libc-types/float128.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT128
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fminimum_magf128.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fminimum_magf128;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT128
+
+#endif // LLVM_LIBC_SHARED_MATH_FMINIMUM_MAGF128_H

diff  --git a/libc/shared/math/fminimum_magf16.h b/libc/shared/math/fminimum_magf16.h
new file mode 100644
index 0000000000000..506dc8ac5449c
--- /dev/null
+++ b/libc/shared/math/fminimum_magf16.h
@@ -0,0 +1,29 @@
+//===-- Shared fminimum_magf16 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_FMINIMUM_MAGF16_H
+#define LLVM_LIBC_SHARED_MATH_FMINIMUM_MAGF16_H
+
+#include "include/llvm-libc-macros/float16-macros.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT16
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fminimum_magf16.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fminimum_magf16;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT16
+
+#endif // LLVM_LIBC_SHARED_MATH_FMINIMUM_MAGF16_H

diff  --git a/libc/shared/math/fminimum_magl.h b/libc/shared/math/fminimum_magl.h
new file mode 100644
index 0000000000000..3afe4f6ab79b2
--- /dev/null
+++ b/libc/shared/math/fminimum_magl.h
@@ -0,0 +1,23 @@
+//===-- Shared fminimum_magl 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_FMINIMUM_MAGL_H
+#define LLVM_LIBC_SHARED_MATH_FMINIMUM_MAGL_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fminimum_magl.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fminimum_magl;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_FMINIMUM_MAGL_H

diff  --git a/libc/src/__support/FPUtil/BasicOperations.h b/libc/src/__support/FPUtil/BasicOperations.h
index 99e3f0d43d6cc..87168430257a2 100644
--- a/libc/src/__support/FPUtil/BasicOperations.h
+++ b/libc/src/__support/FPUtil/BasicOperations.h
@@ -215,7 +215,7 @@ LIBC_INLINE constexpr T fminimum_num(T x, T y) {
 }
 
 template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
-LIBC_INLINE T fmaximum_mag(T x, T y) {
+LIBC_INLINE constexpr T fmaximum_mag(T x, T y) {
   FPBits<T> bitx(x), bity(y);
 
   if (abs(x) > abs(y))
@@ -226,7 +226,7 @@ LIBC_INLINE T fmaximum_mag(T x, T y) {
 }
 
 template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
-LIBC_INLINE T fminimum_mag(T x, T y) {
+LIBC_INLINE constexpr T fminimum_mag(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 dad34b0023154..d78450a00c1d2 100644
--- a/libc/src/__support/math/CMakeLists.txt
+++ b/libc/src/__support/math/CMakeLists.txt
@@ -895,6 +895,65 @@ add_header_library(
     libc.src.__support.macros.config
 )
 
+add_header_library(
+  fmaximum_mag
+  HDRS
+    fmaximum_mag.h
+  DEPENDS
+    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.macros.config
+)
+
+add_header_library(
+  fmaximum_magbf16
+  HDRS
+    fmaximum_magbf16.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_magf
+  HDRS
+    fmaximum_magf.h
+  DEPENDS
+    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.macros.config
+)
+
+add_header_library(
+  fmaximum_magf128
+  HDRS
+    fmaximum_magf128.h
+  DEPENDS
+    libc.include.llvm-libc-types.float128
+    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.macros.config
+)
+
+add_header_library(
+  fmaximum_magf16
+  HDRS
+    fmaximum_magf16.h
+  DEPENDS
+    libc.include.llvm-libc-macros.float16_macros
+    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.macros.config
+)
+
+add_header_library(
+  fmaximum_magl
+  HDRS
+    fmaximum_magl.h
+  DEPENDS
+    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.macros.config
+)
+
 add_header_library(
   fmaximum_num
   HDRS
@@ -1083,6 +1142,65 @@ add_header_library(
     libc.src.__support.macros.config
 )
 
+add_header_library(
+  fminimum_mag
+  HDRS
+    fminimum_mag.h
+  DEPENDS
+    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.macros.config
+)
+
+add_header_library(
+  fminimum_magbf16
+  HDRS
+    fminimum_magbf16.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(
+  fminimum_magf
+  HDRS
+    fminimum_magf.h
+  DEPENDS
+    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.macros.config
+)
+
+add_header_library(
+  fminimum_magf128
+  HDRS
+    fminimum_magf128.h
+  DEPENDS
+    libc.include.llvm-libc-types.float128
+    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.macros.config
+)
+
+add_header_library(
+  fminimum_magf16
+  HDRS
+    fminimum_magf16.h
+  DEPENDS
+    libc.include.llvm-libc-macros.float16_macros
+    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.macros.config
+)
+
+add_header_library(
+  fminimum_magl
+  HDRS
+    fminimum_magl.h
+  DEPENDS
+    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.macros.config
+)
+
 add_header_library(
   fminimum_num
   HDRS

diff  --git a/libc/src/__support/math/fmaximum_mag.h b/libc/src/__support/math/fmaximum_mag.h
new file mode 100644
index 0000000000000..a114b48790e33
--- /dev/null
+++ b/libc/src/__support/math/fmaximum_mag.h
@@ -0,0 +1,25 @@
+//===-- Implementation header for fmaximum_mag ------------------*- 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_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FMAXIMUM_MAG_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(double x, double y) {
+  return fputil::fmaximum_mag(x, y);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FMAXIMUM_MAG_H

diff  --git a/libc/src/__support/math/fmaximum_magbf16.h b/libc/src/__support/math/fmaximum_magbf16.h
new file mode 100644
index 0000000000000..ef71618500a39
--- /dev/null
+++ b/libc/src/__support/math/fmaximum_magbf16.h
@@ -0,0 +1,26 @@
+//===-- Implementation header for fmaximum_magbf16 --------------*- 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_MAGBF16_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FMAXIMUM_MAGBF16_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_magbf16(bfloat16 x, bfloat16 y) {
+  return fputil::fmaximum_mag(x, y);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FMAXIMUM_MAGBF16_H

diff  --git a/libc/src/__support/math/fmaximum_magf.h b/libc/src/__support/math/fmaximum_magf.h
new file mode 100644
index 0000000000000..3fea647977b4e
--- /dev/null
+++ b/libc/src/__support/math/fmaximum_magf.h
@@ -0,0 +1,25 @@
+//===-- Implementation header for fmaximum_magf -----------------*- 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_MAGF_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FMAXIMUM_MAGF_H
+
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace math {
+
+LIBC_INLINE constexpr float fmaximum_magf(float x, float y) {
+  return fputil::fmaximum_mag(x, y);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FMAXIMUM_MAGF_H

diff  --git a/libc/src/__support/math/fmaximum_magf128.h b/libc/src/__support/math/fmaximum_magf128.h
new file mode 100644
index 0000000000000..8c89ee5f4982d
--- /dev/null
+++ b/libc/src/__support/math/fmaximum_magf128.h
@@ -0,0 +1,31 @@
+//===-- Implementation header for fmaximum_magf128 --------------*- 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_MAGF128_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FMAXIMUM_MAGF128_H
+
+#include "include/llvm-libc-types/float128.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT128
+
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace math {
+
+LIBC_INLINE constexpr float128 fmaximum_magf128(float128 x, float128 y) {
+  return fputil::fmaximum_mag(x, y);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT128
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FMAXIMUM_MAGF128_H

diff  --git a/libc/src/__support/math/fmaximum_magf16.h b/libc/src/__support/math/fmaximum_magf16.h
new file mode 100644
index 0000000000000..6ace711b33dfa
--- /dev/null
+++ b/libc/src/__support/math/fmaximum_magf16.h
@@ -0,0 +1,31 @@
+//===-- Implementation header for fmaximum_magf16 ---------------*- 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_MAGF16_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FMAXIMUM_MAGF16_H
+
+#include "include/llvm-libc-macros/float16-macros.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT16
+
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace math {
+
+LIBC_INLINE constexpr float16 fmaximum_magf16(float16 x, float16 y) {
+  return fputil::fmaximum_mag(x, y);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT16
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FMAXIMUM_MAGF16_H

diff  --git a/libc/src/__support/math/fmaximum_magl.h b/libc/src/__support/math/fmaximum_magl.h
new file mode 100644
index 0000000000000..2bcd5caab6711
--- /dev/null
+++ b/libc/src/__support/math/fmaximum_magl.h
@@ -0,0 +1,25 @@
+//===-- Implementation header for fmaximum_magl -----------------*- 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_MAGL_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FMAXIMUM_MAGL_H
+
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace math {
+
+LIBC_INLINE constexpr long double fmaximum_magl(long double x, long double y) {
+  return fputil::fmaximum_mag(x, y);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FMAXIMUM_MAGL_H

diff  --git a/libc/src/__support/math/fminimum_mag.h b/libc/src/__support/math/fminimum_mag.h
new file mode 100644
index 0000000000000..c50278cd67c69
--- /dev/null
+++ b/libc/src/__support/math/fminimum_mag.h
@@ -0,0 +1,25 @@
+//===-- Implementation header for fminimum_mag ------------------*- 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_FMINIMUM_MAG_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FMINIMUM_MAG_H
+
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace math {
+
+LIBC_INLINE constexpr double fminimum_mag(double x, double y) {
+  return fputil::fminimum_mag(x, y);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FMINIMUM_MAG_H

diff  --git a/libc/src/__support/math/fminimum_magbf16.h b/libc/src/__support/math/fminimum_magbf16.h
new file mode 100644
index 0000000000000..95bfdc7186588
--- /dev/null
+++ b/libc/src/__support/math/fminimum_magbf16.h
@@ -0,0 +1,26 @@
+//===-- Implementation header for fminimum_magbf16 --------------*- 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_FMINIMUM_MAGBF16_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FMINIMUM_MAGBF16_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 fminimum_magbf16(bfloat16 x, bfloat16 y) {
+  return fputil::fminimum_mag(x, y);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FMINIMUM_MAGBF16_H

diff  --git a/libc/src/__support/math/fminimum_magf.h b/libc/src/__support/math/fminimum_magf.h
new file mode 100644
index 0000000000000..11a5a256bc739
--- /dev/null
+++ b/libc/src/__support/math/fminimum_magf.h
@@ -0,0 +1,25 @@
+//===-- Implementation header for fminimum_magf -----------------*- 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_FMINIMUM_MAGF_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FMINIMUM_MAGF_H
+
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace math {
+
+LIBC_INLINE constexpr float fminimum_magf(float x, float y) {
+  return fputil::fminimum_mag(x, y);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FMINIMUM_MAGF_H

diff  --git a/libc/src/__support/math/fminimum_magf128.h b/libc/src/__support/math/fminimum_magf128.h
new file mode 100644
index 0000000000000..f0f1739583f3f
--- /dev/null
+++ b/libc/src/__support/math/fminimum_magf128.h
@@ -0,0 +1,31 @@
+//===-- Implementation header for fminimum_magf128 --------------*- 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_FMINIMUM_MAGF128_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FMINIMUM_MAGF128_H
+
+#include "include/llvm-libc-types/float128.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT128
+
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace math {
+
+LIBC_INLINE constexpr float128 fminimum_magf128(float128 x, float128 y) {
+  return fputil::fminimum_mag(x, y);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT128
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FMINIMUM_MAGF128_H

diff  --git a/libc/src/__support/math/fminimum_magf16.h b/libc/src/__support/math/fminimum_magf16.h
new file mode 100644
index 0000000000000..64d31748bf392
--- /dev/null
+++ b/libc/src/__support/math/fminimum_magf16.h
@@ -0,0 +1,31 @@
+//===-- Implementation header for fminimum_magf16 ---------------*- 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_FMINIMUM_MAGF16_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FMINIMUM_MAGF16_H
+
+#include "include/llvm-libc-macros/float16-macros.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT16
+
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace math {
+
+LIBC_INLINE constexpr float16 fminimum_magf16(float16 x, float16 y) {
+  return fputil::fminimum_mag(x, y);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT16
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FMINIMUM_MAGF16_H

diff  --git a/libc/src/__support/math/fminimum_magl.h b/libc/src/__support/math/fminimum_magl.h
new file mode 100644
index 0000000000000..18e9e152d6972
--- /dev/null
+++ b/libc/src/__support/math/fminimum_magl.h
@@ -0,0 +1,25 @@
+//===-- Implementation header for fminimum_magl -----------------*- 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_FMINIMUM_MAGL_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FMINIMUM_MAGL_H
+
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace math {
+
+LIBC_INLINE constexpr long double fminimum_magl(long double x, long double y) {
+  return fputil::fminimum_mag(x, y);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FMINIMUM_MAGL_H

diff  --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt
index df6e2dd9dbfc0..55d26c2ef25fb 100644
--- a/libc/src/math/generic/CMakeLists.txt
+++ b/libc/src/math/generic/CMakeLists.txt
@@ -2307,7 +2307,7 @@ add_entrypoint_object(
   HDRS
     ../fmaximum_mag.h
   DEPENDS
-    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.math.fmaximum_mag
 )
 
 add_entrypoint_object(
@@ -2317,7 +2317,7 @@ add_entrypoint_object(
   HDRS
     ../fmaximum_magf.h
   DEPENDS
-    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.math.fmaximum_magf
 )
 
 add_entrypoint_object(
@@ -2327,7 +2327,7 @@ add_entrypoint_object(
   HDRS
     ../fmaximum_magl.h
   DEPENDS
-    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.math.fmaximum_magl
 )
 
 add_entrypoint_object(
@@ -2337,8 +2337,7 @@ add_entrypoint_object(
   HDRS
     ../fmaximum_magf16.h
   DEPENDS
-    libc.src.__support.macros.properties.types
-    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.math.fmaximum_magf16
 )
 
 add_entrypoint_object(
@@ -2348,8 +2347,7 @@ add_entrypoint_object(
   HDRS
     ../fmaximum_magf128.h
   DEPENDS
-    libc.src.__support.macros.properties.types
-    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.math.fmaximum_magf128
 )
 
 add_entrypoint_object(
@@ -2359,12 +2357,7 @@ add_entrypoint_object(
   HDRS
     ../fmaximum_magbf16.h
   DEPENDS
-    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
+    libc.src.__support.math.fmaximum_magbf16
 )
 
 add_entrypoint_object(
@@ -2556,7 +2549,7 @@ add_entrypoint_object(
   HDRS
     ../fminimum_mag.h
   DEPENDS
-    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.math.fminimum_mag
 )
 
 add_entrypoint_object(
@@ -2566,7 +2559,7 @@ add_entrypoint_object(
   HDRS
     ../fminimum_magf.h
   DEPENDS
-    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.math.fminimum_magf
 )
 
 add_entrypoint_object(
@@ -2576,7 +2569,7 @@ add_entrypoint_object(
   HDRS
     ../fminimum_magl.h
   DEPENDS
-    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.math.fminimum_magl
 )
 
 add_entrypoint_object(
@@ -2586,8 +2579,7 @@ add_entrypoint_object(
   HDRS
     ../fminimum_magf16.h
   DEPENDS
-    libc.src.__support.macros.properties.types
-    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.math.fminimum_magf16
 )
 
 add_entrypoint_object(
@@ -2597,8 +2589,7 @@ add_entrypoint_object(
   HDRS
     ../fminimum_magf128.h
   DEPENDS
-    libc.src.__support.macros.properties.types
-    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.math.fminimum_magf128
 )
 
 add_entrypoint_object(
@@ -2608,12 +2599,7 @@ add_entrypoint_object(
   HDRS
     ../fminimum_magbf16.h
   DEPENDS
-    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
+    libc.src.__support.math.fminimum_magbf16
 )
 
 add_entrypoint_object(

diff  --git a/libc/src/math/generic/fmaximum_mag.cpp b/libc/src/math/generic/fmaximum_mag.cpp
index a0152bf73a62d..bed19158df7f0 100644
--- a/libc/src/math/generic/fmaximum_mag.cpp
+++ b/libc/src/math/generic/fmaximum_mag.cpp
@@ -7,14 +7,12 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/fmaximum_mag.h"
-#include "src/__support/FPUtil/BasicOperations.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/fmaximum_mag.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(double, fmaximum_mag, (double x, double y)) {
-  return fputil::fmaximum_mag(x, y);
+  return math::fmaximum_mag(x, y);
 }
 
 } // namespace LIBC_NAMESPACE_DECL

diff  --git a/libc/src/math/generic/fmaximum_magbf16.cpp b/libc/src/math/generic/fmaximum_magbf16.cpp
index 0654ed904e549..815648c5949ff 100644
--- a/libc/src/math/generic/fmaximum_magbf16.cpp
+++ b/libc/src/math/generic/fmaximum_magbf16.cpp
@@ -7,15 +7,12 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/fmaximum_magbf16.h"
-#include "src/__support/FPUtil/BasicOperations.h"
-#include "src/__support/FPUtil/bfloat16.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/fmaximum_magbf16.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(bfloat16, fmaximum_magbf16, (bfloat16 x, bfloat16 y)) {
-  return fputil::fmaximum_mag(x, y);
+  return math::fmaximum_magbf16(x, y);
 }
 
 } // namespace LIBC_NAMESPACE_DECL

diff  --git a/libc/src/math/generic/fmaximum_magf.cpp b/libc/src/math/generic/fmaximum_magf.cpp
index 41099a157b2e8..c673066457187 100644
--- a/libc/src/math/generic/fmaximum_magf.cpp
+++ b/libc/src/math/generic/fmaximum_magf.cpp
@@ -7,14 +7,12 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/fmaximum_magf.h"
-#include "src/__support/FPUtil/BasicOperations.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/fmaximum_magf.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(float, fmaximum_magf, (float x, float y)) {
-  return fputil::fmaximum_mag(x, y);
+  return math::fmaximum_magf(x, y);
 }
 
 } // namespace LIBC_NAMESPACE_DECL

diff  --git a/libc/src/math/generic/fmaximum_magf128.cpp b/libc/src/math/generic/fmaximum_magf128.cpp
index 671d0fb69ee53..d75d6a0a69b0c 100644
--- a/libc/src/math/generic/fmaximum_magf128.cpp
+++ b/libc/src/math/generic/fmaximum_magf128.cpp
@@ -7,14 +7,12 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/fmaximum_magf128.h"
-#include "src/__support/FPUtil/BasicOperations.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/fmaximum_magf128.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(float128, fmaximum_magf128, (float128 x, float128 y)) {
-  return fputil::fmaximum_mag(x, y);
+  return math::fmaximum_magf128(x, y);
 }
 
 } // namespace LIBC_NAMESPACE_DECL

diff  --git a/libc/src/math/generic/fmaximum_magf16.cpp b/libc/src/math/generic/fmaximum_magf16.cpp
index 79e75ab376ccd..03f81bf6f5d71 100644
--- a/libc/src/math/generic/fmaximum_magf16.cpp
+++ b/libc/src/math/generic/fmaximum_magf16.cpp
@@ -7,14 +7,12 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/fmaximum_magf16.h"
-#include "src/__support/FPUtil/BasicOperations.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/fmaximum_magf16.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(float16, fmaximum_magf16, (float16 x, float16 y)) {
-  return fputil::fmaximum_mag(x, y);
+  return math::fmaximum_magf16(x, y);
 }
 
 } // namespace LIBC_NAMESPACE_DECL

diff  --git a/libc/src/math/generic/fmaximum_magl.cpp b/libc/src/math/generic/fmaximum_magl.cpp
index 1230076dadb64..3907f3e5f81e5 100644
--- a/libc/src/math/generic/fmaximum_magl.cpp
+++ b/libc/src/math/generic/fmaximum_magl.cpp
@@ -7,14 +7,12 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/fmaximum_magl.h"
-#include "src/__support/FPUtil/BasicOperations.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/fmaximum_magl.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(long double, fmaximum_magl, (long double x, long double y)) {
-  return fputil::fmaximum_mag(x, y);
+  return math::fmaximum_magl(x, y);
 }
 
 } // namespace LIBC_NAMESPACE_DECL

diff  --git a/libc/src/math/generic/fminimum_mag.cpp b/libc/src/math/generic/fminimum_mag.cpp
index 8d8001df659cb..ee2cd0d2b2baf 100644
--- a/libc/src/math/generic/fminimum_mag.cpp
+++ b/libc/src/math/generic/fminimum_mag.cpp
@@ -7,14 +7,12 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/fminimum_mag.h"
-#include "src/__support/FPUtil/BasicOperations.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/fminimum_mag.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(double, fminimum_mag, (double x, double y)) {
-  return fputil::fminimum_mag(x, y);
+  return math::fminimum_mag(x, y);
 }
 
 } // namespace LIBC_NAMESPACE_DECL

diff  --git a/libc/src/math/generic/fminimum_magbf16.cpp b/libc/src/math/generic/fminimum_magbf16.cpp
index f61d2d27b4a60..170766f2ed501 100644
--- a/libc/src/math/generic/fminimum_magbf16.cpp
+++ b/libc/src/math/generic/fminimum_magbf16.cpp
@@ -7,15 +7,12 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/fminimum_magbf16.h"
-#include "src/__support/FPUtil/BasicOperations.h"
-#include "src/__support/FPUtil/bfloat16.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/fminimum_magbf16.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(bfloat16, fminimum_magbf16, (bfloat16 x, bfloat16 y)) {
-  return fputil::fminimum_mag(x, y);
+  return math::fminimum_magbf16(x, y);
 }
 
 } // namespace LIBC_NAMESPACE_DECL

diff  --git a/libc/src/math/generic/fminimum_magf.cpp b/libc/src/math/generic/fminimum_magf.cpp
index fcc2e056f2bff..0b9f7d12c32b0 100644
--- a/libc/src/math/generic/fminimum_magf.cpp
+++ b/libc/src/math/generic/fminimum_magf.cpp
@@ -7,14 +7,12 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/fminimum_magf.h"
-#include "src/__support/FPUtil/BasicOperations.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/fminimum_magf.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(float, fminimum_magf, (float x, float y)) {
-  return fputil::fminimum_mag(x, y);
+  return math::fminimum_magf(x, y);
 }
 
 } // namespace LIBC_NAMESPACE_DECL

diff  --git a/libc/src/math/generic/fminimum_magf128.cpp b/libc/src/math/generic/fminimum_magf128.cpp
index 3e7e01f4239eb..56c6a48d291aa 100644
--- a/libc/src/math/generic/fminimum_magf128.cpp
+++ b/libc/src/math/generic/fminimum_magf128.cpp
@@ -7,14 +7,12 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/fminimum_magf128.h"
-#include "src/__support/FPUtil/BasicOperations.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/fminimum_magf128.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(float128, fminimum_magf128, (float128 x, float128 y)) {
-  return fputil::fminimum_mag(x, y);
+  return math::fminimum_magf128(x, y);
 }
 
 } // namespace LIBC_NAMESPACE_DECL

diff  --git a/libc/src/math/generic/fminimum_magf16.cpp b/libc/src/math/generic/fminimum_magf16.cpp
index 4417f75321c5d..07b55e5cec438 100644
--- a/libc/src/math/generic/fminimum_magf16.cpp
+++ b/libc/src/math/generic/fminimum_magf16.cpp
@@ -7,14 +7,12 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/fminimum_magf16.h"
-#include "src/__support/FPUtil/BasicOperations.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/fminimum_magf16.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(float16, fminimum_magf16, (float16 x, float16 y)) {
-  return fputil::fminimum_mag(x, y);
+  return math::fminimum_magf16(x, y);
 }
 
 } // namespace LIBC_NAMESPACE_DECL

diff  --git a/libc/src/math/generic/fminimum_magl.cpp b/libc/src/math/generic/fminimum_magl.cpp
index befc4ac94c1bb..2a4630959976a 100644
--- a/libc/src/math/generic/fminimum_magl.cpp
+++ b/libc/src/math/generic/fminimum_magl.cpp
@@ -7,14 +7,12 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/fminimum_magl.h"
-#include "src/__support/FPUtil/BasicOperations.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/fminimum_magl.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(long double, fminimum_magl, (long double x, long double y)) {
-  return fputil::fminimum_mag(x, y);
+  return math::fminimum_magl(x, y);
 }
 
 } // namespace LIBC_NAMESPACE_DECL

diff  --git a/libc/test/shared/CMakeLists.txt b/libc/test/shared/CMakeLists.txt
index b716d246d3f7b..1e4d3acaa2f0b 100644
--- a/libc/test/shared/CMakeLists.txt
+++ b/libc/test/shared/CMakeLists.txt
@@ -175,9 +175,15 @@ add_fp_unittest(
     libc.src.__support.math.fmaxf128
     libc.src.__support.math.fmaxf16
     libc.src.__support.math.fmaximum
+    libc.src.__support.math.fmaximum_mag
     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.fmaximum_magbf16
+    libc.src.__support.math.fmaximum_magf
+    libc.src.__support.math.fmaximum_magf128
+    libc.src.__support.math.fmaximum_magf16
+    libc.src.__support.math.fmaximum_magl
     libc.src.__support.math.fmaximum_num
     libc.src.__support.math.fmaximum_numbf16
     libc.src.__support.math.fmaximum_numf
@@ -196,6 +202,12 @@ add_fp_unittest(
     libc.src.__support.math.fminf128
     libc.src.__support.math.fminf16
     libc.src.__support.math.fminimum
+    libc.src.__support.math.fminimum_mag
+    libc.src.__support.math.fminimum_magbf16
+    libc.src.__support.math.fminimum_magf
+    libc.src.__support.math.fminimum_magf128
+    libc.src.__support.math.fminimum_magf16
+    libc.src.__support.math.fminimum_magl
     libc.src.__support.math.fminimum_num
     libc.src.__support.math.fminimum_numbf16
     libc.src.__support.math.fminimum_numf
@@ -371,9 +383,15 @@ add_fp_unittest(
     libc.src.__support.math.fabsf16
     libc.src.__support.math.fabsl
     libc.src.__support.math.fmaximum
+    libc.src.__support.math.fmaximum_mag
     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.fmaximum_magbf16
+    libc.src.__support.math.fmaximum_magf
+    libc.src.__support.math.fmaximum_magf128
+    libc.src.__support.math.fmaximum_magf16
+    libc.src.__support.math.fmaximum_magl
     libc.src.__support.math.fmaximum_num
     libc.src.__support.math.fmaximum_numbf16
     libc.src.__support.math.fmaximum_numf
@@ -391,6 +409,12 @@ add_fp_unittest(
     libc.src.__support.math.fminf128
     libc.src.__support.math.fminf16
     libc.src.__support.math.fminimum
+    libc.src.__support.math.fminimum_mag
+    libc.src.__support.math.fminimum_magbf16
+    libc.src.__support.math.fminimum_magf
+    libc.src.__support.math.fminimum_magf128
+    libc.src.__support.math.fminimum_magf16
+    libc.src.__support.math.fminimum_magl
     libc.src.__support.math.fminimum_num
     libc.src.__support.math.fminimum_numbf16
     libc.src.__support.math.fminimum_numf

diff  --git a/libc/test/shared/shared_math_constexpr_test.cpp b/libc/test/shared/shared_math_constexpr_test.cpp
index 403a010c3c59d..98141f641df45 100644
--- a/libc/test/shared/shared_math_constexpr_test.cpp
+++ b/libc/test/shared/shared_math_constexpr_test.cpp
@@ -29,6 +29,8 @@ static_assert(0.0 == LIBC_NAMESPACE::shared::fmin(0.0, 0.0));
 static_assert(0.0 == LIBC_NAMESPACE::shared::fmax(0.0, 0.0));
 static_assert(0.0 == LIBC_NAMESPACE::shared::fmaximum_num(0.0, 0.0));
 static_assert(0.0 == LIBC_NAMESPACE::shared::fminimum_num(0.0, 0.0));
+static_assert(0.0 == LIBC_NAMESPACE::shared::fmaximum_mag(0.0, 0.0));
+static_assert(0.0 == LIBC_NAMESPACE::shared::fminimum_mag(0.0, 0.0));
 
 //===----------------------------------------------------------------------===//
 //                       Float Tests
@@ -46,6 +48,8 @@ static_assert(0.0f == LIBC_NAMESPACE::shared::fminf(0.0f, 0.0f));
 static_assert(0.0f == LIBC_NAMESPACE::shared::fmaxf(0.0f, 0.0f));
 static_assert(0.0f == LIBC_NAMESPACE::shared::fmaximum_numf(0.0f, 0.0f));
 static_assert(0.0f == LIBC_NAMESPACE::shared::fminimum_numf(0.0f, 0.0f));
+static_assert(0.0f == LIBC_NAMESPACE::shared::fmaximum_magf(0.0f, 0.0f));
+static_assert(0.0f == LIBC_NAMESPACE::shared::fminimum_magf(0.0f, 0.0f));
 
 //===----------------------------------------------------------------------===//
 //                       Float16 Tests
@@ -66,6 +70,10 @@ static_assert(0.0f16 ==
               LIBC_NAMESPACE::shared::fmaximum_numf16(0.0f16, 0.0f16));
 static_assert(0.0f16 ==
               LIBC_NAMESPACE::shared::fminimum_numf16(0.0f16, 0.0f16));
+static_assert(0.0f16 ==
+              LIBC_NAMESPACE::shared::fmaximum_magf16(0.0f16, 0.0f16));
+static_assert(0.0f16 ==
+              LIBC_NAMESPACE::shared::fminimum_magf16(0.0f16, 0.0f16));
 
 #endif // LIBC_TYPES_HAS_FLOAT16
 
@@ -92,6 +100,8 @@ static_assert(0.0L == LIBC_NAMESPACE::shared::fminl(0.0L, 0.0L));
 static_assert(0.0L == LIBC_NAMESPACE::shared::fmaxl(0.0L, 0.0L));
 static_assert(0.0L == LIBC_NAMESPACE::shared::fmaximum_numl(0.0L, 0.0L));
 static_assert(0.0L == LIBC_NAMESPACE::shared::fminimum_numl(0.0L, 0.0L));
+static_assert(0.0L == LIBC_NAMESPACE::shared::fmaximum_magl(0.0L, 0.0L));
+static_assert(0.0L == LIBC_NAMESPACE::shared::fminimum_magl(0.0L, 0.0L));
 
 #endif
 
@@ -135,6 +145,12 @@ static_assert(float128(0.0) ==
 static_assert(float128(0.0) ==
               LIBC_NAMESPACE::shared::fminimum_numf128(float128(0.0),
                                                        float128(0.0)));
+static_assert(float128(0.0) ==
+              LIBC_NAMESPACE::shared::fmaximum_magf128(float128(0.0),
+                                                       float128(0.0)));
+static_assert(float128(0.0) ==
+              LIBC_NAMESPACE::shared::fminimum_magf128(float128(0.0),
+                                                       float128(0.0)));
 
 #endif // LIBC_TYPES_HAS_FLOAT128
 
@@ -176,5 +192,11 @@ static_assert(bfloat16(0.0) ==
 static_assert(bfloat16(0.0) ==
               LIBC_NAMESPACE::shared::fminimum_numbf16(bfloat16(0.0),
                                                        bfloat16(0.0)));
+static_assert(bfloat16(0.0) ==
+              LIBC_NAMESPACE::shared::fmaximum_magbf16(bfloat16(0.0),
+                                                       bfloat16(0.0)));
+static_assert(bfloat16(0.0) ==
+              LIBC_NAMESPACE::shared::fminimum_magbf16(bfloat16(0.0),
+                                                       bfloat16(0.0)));
 
 TEST(LlvmLibcSharedMathTest, ConstantEvaluation) {}

diff  --git a/libc/test/shared/shared_math_test.cpp b/libc/test/shared/shared_math_test.cpp
index a71cc858d8b21..bff09e769cd43 100644
--- a/libc/test/shared/shared_math_test.cpp
+++ b/libc/test/shared/shared_math_test.cpp
@@ -110,6 +110,10 @@ TEST(LlvmLibcSharedMathTest, AllFloat16) {
                LIBC_NAMESPACE::shared::fmaximum_numf16(0.0f16, 0.0f16));
   EXPECT_FP_EQ(0x0p+0f16,
                LIBC_NAMESPACE::shared::fminimum_numf16(0.0f16, 0.0f16));
+  EXPECT_FP_EQ(0x0p+0f16,
+               LIBC_NAMESPACE::shared::fmaximum_magf16(0.0f16, 0.0f16));
+  EXPECT_FP_EQ(0x0p+0f16,
+               LIBC_NAMESPACE::shared::fminimum_magf16(0.0f16, 0.0f16));
 }
 
 #endif // LIBC_TYPES_HAS_FLOAT16
@@ -226,6 +230,8 @@ TEST(LlvmLibcSharedMathTest, AllFloat) {
   EXPECT_FP_EQ(0x0p+0f, LIBC_NAMESPACE::shared::fminf(0.0f, 0.0f));
   EXPECT_FP_EQ(0x0p+0f, LIBC_NAMESPACE::shared::fmaximum_numf(0.0f, 0.0f));
   EXPECT_FP_EQ(0x0p+0f, LIBC_NAMESPACE::shared::fminimum_numf(0.0f, 0.0f));
+  EXPECT_FP_EQ(0x0p+0f, LIBC_NAMESPACE::shared::fmaximum_magf(0.0f, 0.0f));
+  EXPECT_FP_EQ(0x0p+0f, LIBC_NAMESPACE::shared::fminimum_magf(0.0f, 0.0f));
 }
 
 TEST(LlvmLibcSharedMathTest, AllDouble) {
@@ -318,6 +324,8 @@ TEST(LlvmLibcSharedMathTest, AllDouble) {
   EXPECT_FP_EQ(0.0, LIBC_NAMESPACE::shared::fmin(0.0, 0.0));
   EXPECT_FP_EQ(0.0, LIBC_NAMESPACE::shared::fmaximum_num(0.0, 0.0));
   EXPECT_FP_EQ(0.0, LIBC_NAMESPACE::shared::fminimum_num(0.0, 0.0));
+  EXPECT_FP_EQ(0.0, LIBC_NAMESPACE::shared::fmaximum_mag(0.0, 0.0));
+  EXPECT_FP_EQ(0.0, LIBC_NAMESPACE::shared::fminimum_mag(0.0, 0.0));
 }
 
 // TODO: Enable the tests when double-double type is supported.
@@ -391,6 +399,8 @@ TEST(LlvmLibcSharedMathTest, AllLongDouble) {
   EXPECT_FP_EQ(0x0p+0L, LIBC_NAMESPACE::shared::fminl(0.0L, 0.0L));
   EXPECT_FP_EQ(0x0p+0L, LIBC_NAMESPACE::shared::fmaximum_numl(0.0L, 0.0L));
   EXPECT_FP_EQ(0x0p+0L, LIBC_NAMESPACE::shared::fminimum_numl(0.0L, 0.0L));
+  EXPECT_FP_EQ(0x0p+0L, LIBC_NAMESPACE::shared::fmaximum_magl(0.0L, 0.0L));
+  EXPECT_FP_EQ(0x0p+0L, LIBC_NAMESPACE::shared::fminimum_magl(0.0L, 0.0L));
 }
 
 #endif // LIBC_TYPES_LONG_DOUBLE_IS_DOUBLE_DOUBLE
@@ -509,6 +519,10 @@ TEST(LlvmLibcSharedMathTest, AllFloat128) {
                                   float128(0.0), float128(0.0)));
   EXPECT_FP_EQ(float128(0.0), LIBC_NAMESPACE::shared::fminimum_numf128(
                                   float128(0.0), float128(0.0)));
+  EXPECT_FP_EQ(float128(0.0), LIBC_NAMESPACE::shared::fmaximum_magf128(
+                                  float128(0.0), float128(0.0)));
+  EXPECT_FP_EQ(float128(0.0), LIBC_NAMESPACE::shared::fminimum_magf128(
+                                  float128(0.0), float128(0.0)));
 }
 
 #endif // LIBC_TYPES_HAS_FLOAT128
@@ -590,4 +604,8 @@ TEST(LlvmLibcSharedMathTest, AllBFloat16) {
                                   bfloat16(0.0), bfloat16(0.0)));
   EXPECT_FP_EQ(bfloat16(0.0), LIBC_NAMESPACE::shared::fminimum_numbf16(
                                   bfloat16(0.0), bfloat16(0.0)));
+  EXPECT_FP_EQ(bfloat16(0.0), LIBC_NAMESPACE::shared::fmaximum_magbf16(
+                                  bfloat16(0.0), bfloat16(0.0)));
+  EXPECT_FP_EQ(bfloat16(0.0), LIBC_NAMESPACE::shared::fminimum_magbf16(
+                                  bfloat16(0.0), bfloat16(0.0)));
 }

diff  --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 652b0819fa31e..7d5687bb8dae5 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -4134,6 +4134,63 @@ libc_support_library(
     ],
 )
 
+libc_support_library(
+    name = "__support_math_fmaximum_mag",
+    hdrs = ["src/__support/math/fmaximum_mag.h"],
+    deps = [
+        ":__support_fputil_basic_operations",
+        ":__support_macros_config",
+    ],
+)
+
+libc_support_library(
+    name = "__support_math_fmaximum_magbf16",
+    hdrs = ["src/__support/math/fmaximum_magbf16.h"],
+    deps = [
+        ":__support_fputil_basic_operations",
+        ":__support_fputil_bfloat16",
+        ":__support_macros_config",
+    ],
+)
+
+libc_support_library(
+    name = "__support_math_fmaximum_magf",
+    hdrs = ["src/__support/math/fmaximum_magf.h"],
+    deps = [
+        ":__support_fputil_basic_operations",
+        ":__support_macros_config",
+    ],
+)
+
+libc_support_library(
+    name = "__support_math_fmaximum_magf128",
+    hdrs = ["src/__support/math/fmaximum_magf128.h"],
+    deps = [
+        ":__support_fputil_basic_operations",
+        ":__support_macros_config",
+        ":llvm_libc_types_float128",
+    ],
+)
+
+libc_support_library(
+    name = "__support_math_fmaximum_magf16",
+    hdrs = ["src/__support/math/fmaximum_magf16.h"],
+    deps = [
+        ":__support_fputil_basic_operations",
+        ":__support_macros_config",
+        ":llvm_libc_macros_float16_macros",
+    ],
+)
+
+libc_support_library(
+    name = "__support_math_fmaximum_magl",
+    hdrs = ["src/__support/math/fmaximum_magl.h"],
+    deps = [
+        ":__support_fputil_basic_operations",
+        ":__support_macros_config",
+    ],
+)
+
 libc_support_library(
     name = "__support_math_fmaximum_num",
     hdrs = ["src/__support/math/fmaximum_num.h"],
@@ -4296,6 +4353,63 @@ libc_support_library(
     ],
 )
 
+libc_support_library(
+    name = "__support_math_fminimum_mag",
+    hdrs = ["src/__support/math/fminimum_mag.h"],
+    deps = [
+        ":__support_fputil_basic_operations",
+        ":__support_macros_config",
+    ],
+)
+
+libc_support_library(
+    name = "__support_math_fminimum_magbf16",
+    hdrs = ["src/__support/math/fminimum_magbf16.h"],
+    deps = [
+        ":__support_fputil_basic_operations",
+        ":__support_fputil_bfloat16",
+        ":__support_macros_config",
+    ],
+)
+
+libc_support_library(
+    name = "__support_math_fminimum_magf",
+    hdrs = ["src/__support/math/fminimum_magf.h"],
+    deps = [
+        ":__support_fputil_basic_operations",
+        ":__support_macros_config",
+    ],
+)
+
+libc_support_library(
+    name = "__support_math_fminimum_magf128",
+    hdrs = ["src/__support/math/fminimum_magf128.h"],
+    deps = [
+        ":__support_fputil_basic_operations",
+        ":__support_macros_config",
+        ":llvm_libc_types_float128",
+    ],
+)
+
+libc_support_library(
+    name = "__support_math_fminimum_magf16",
+    hdrs = ["src/__support/math/fminimum_magf16.h"],
+    deps = [
+        ":__support_fputil_basic_operations",
+        ":__support_macros_config",
+        ":llvm_libc_macros_float16_macros",
+    ],
+)
+
+libc_support_library(
+    name = "__support_math_fminimum_magl",
+    hdrs = ["src/__support/math/fminimum_magl.h"],
+    deps = [
+        ":__support_fputil_basic_operations",
+        ":__support_macros_config",
+    ],
+)
+
 libc_support_library(
     name = "__support_math_fminimum_num",
     hdrs = ["src/__support/math/fminimum_num.h"],
@@ -7646,6 +7760,13 @@ libc_math_function(
     ],
 )
 
+libc_math_function(
+    name = "fmaximum_magbf16",
+    additional_deps = [
+        ":__support_math_fmaximum_magbf16",
+    ],
+)
+
 libc_math_function(
     name = "fmaximum_numbf16",
     additional_deps = [
@@ -7667,6 +7788,13 @@ libc_math_function(
     ],
 )
 
+libc_math_function(
+    name = "fminimum_magbf16",
+    additional_deps = [
+        ":__support_math_fminimum_magbf16",
+    ],
+)
+
 libc_math_function(
     name = "fminimum_numbf16",
     additional_deps = [
@@ -8508,18 +8636,39 @@ libc_math_function(
     ],
 )
 
-libc_math_function(name = "fmaximum_mag")
+libc_math_function(
+    name = "fmaximum_mag",
+    additional_deps = [
+        ":__support_math_fmaximum_mag",
+    ],
+)
 
-libc_math_function(name = "fmaximum_magf")
+libc_math_function(
+    name = "fmaximum_magf",
+    additional_deps = [
+        ":__support_math_fmaximum_magf",
+    ],
+)
 
-libc_math_function(name = "fmaximum_magl")
+libc_math_function(
+    name = "fmaximum_magl",
+    additional_deps = [
+        ":__support_math_fmaximum_magl",
+    ],
+)
 
 libc_math_function(
     name = "fmaximum_magf128",
+    additional_deps = [
+        ":__support_math_fmaximum_magf128",
+    ],
 )
 
 libc_math_function(
     name = "fmaximum_magf16",
+    additional_deps = [
+        ":__support_math_fmaximum_magf16",
+    ],
 )
 
 libc_math_function(
@@ -8658,18 +8807,39 @@ libc_math_function(
     ],
 )
 
-libc_math_function(name = "fminimum_mag")
+libc_math_function(
+    name = "fminimum_mag",
+    additional_deps = [
+        ":__support_math_fminimum_mag",
+    ],
+)
 
-libc_math_function(name = "fminimum_magf")
+libc_math_function(
+    name = "fminimum_magf",
+    additional_deps = [
+        ":__support_math_fminimum_magf",
+    ],
+)
 
-libc_math_function(name = "fminimum_magl")
+libc_math_function(
+    name = "fminimum_magl",
+    additional_deps = [
+        ":__support_math_fminimum_magl",
+    ],
+)
 
 libc_math_function(
     name = "fminimum_magf128",
+    additional_deps = [
+        ":__support_math_fminimum_magf128",
+    ],
 )
 
 libc_math_function(
     name = "fminimum_magf16",
+    additional_deps = [
+        ":__support_math_fminimum_magf16",
+    ],
 )
 
 libc_math_function(name = "fminimum_mag_num")


        


More information about the libc-commits mailing list