[libc-commits] [libc] [llvm] [libc][math] Refactor fmaximum-fminimum family to header-only (PR #194533)

via libc-commits libc-commits at lists.llvm.org
Mon Apr 27 22:46:59 PDT 2026


https://github.com/AnonMiraj updated https://github.com/llvm/llvm-project/pull/194533

>From 39e7e322752044a891c352b6608bd0b735b0cead Mon Sep 17 00:00:00 2001
From: Anonmiraj <ezzibrahimx at gmail.com>
Date: Tue, 28 Apr 2026 07:38:14 +0300
Subject: [PATCH] [libc][math] Refactor fmaximum-fminimum family to header-only

Refactored functions:
  - fmaximum
  - fmaximumbf16
  - fmaximumf
  - fmaximumf128
  - fmaximumf16
  - fmaximuml
  - fminimum
  - fminimumbf16
  - fminimumf
  - fminimumf128
  - fminimumf16
  - fminimuml
---
 libc/shared/math.h                            |  12 ++
 libc/shared/math/fmaximum.h                   |  23 +++
 libc/shared/math/fmaximumbf16.h               |  23 +++
 libc/shared/math/fmaximumf.h                  |  23 +++
 libc/shared/math/fmaximumf128.h               |  29 +++
 libc/shared/math/fmaximumf16.h                |  29 +++
 libc/shared/math/fmaximuml.h                  |  23 +++
 libc/shared/math/fminimum.h                   |  23 +++
 libc/shared/math/fminimumbf16.h               |  23 +++
 libc/shared/math/fminimumf.h                  |  23 +++
 libc/shared/math/fminimumf128.h               |  29 +++
 libc/shared/math/fminimumf16.h                |  29 +++
 libc/shared/math/fminimuml.h                  |  23 +++
 libc/src/__support/FPUtil/BasicOperations.h   |  27 ++-
 libc/src/__support/math/CMakeLists.txt        | 130 +++++++++++++
 libc/src/__support/math/fmaximum.h            |  25 +++
 libc/src/__support/math/fmaximumbf16.h        |  26 +++
 libc/src/__support/math/fmaximumf.h           |  25 +++
 libc/src/__support/math/fmaximumf128.h        |  31 +++
 libc/src/__support/math/fmaximumf16.h         |  31 +++
 libc/src/__support/math/fmaximuml.h           |  25 +++
 libc/src/__support/math/fminimum.h            |  25 +++
 libc/src/__support/math/fminimumbf16.h        |  26 +++
 libc/src/__support/math/fminimumf.h           |  25 +++
 libc/src/__support/math/fminimumf128.h        |  31 +++
 libc/src/__support/math/fminimumf16.h         |  31 +++
 libc/src/__support/math/fminimuml.h           |  25 +++
 libc/src/math/generic/CMakeLists.txt          |  50 ++---
 libc/src/math/generic/fmaximum.cpp            |   6 +-
 libc/src/math/generic/fmaximumbf16.cpp        |   7 +-
 libc/src/math/generic/fmaximumf.cpp           |   6 +-
 libc/src/math/generic/fmaximumf128.cpp        |   6 +-
 libc/src/math/generic/fmaximumf16.cpp         |   6 +-
 libc/src/math/generic/fmaximuml.cpp           |   6 +-
 libc/src/math/generic/fminimum.cpp            |   6 +-
 libc/src/math/generic/fminimumbf16.cpp        |   7 +-
 libc/src/math/generic/fminimumf.cpp           |   6 +-
 libc/src/math/generic/fminimumf128.cpp        |   6 +-
 libc/src/math/generic/fminimumf16.cpp         |   6 +-
 libc/src/math/generic/fminimuml.cpp           |   6 +-
 libc/test/shared/CMakeLists.txt               |  24 +++
 .../shared/shared_math_constexpr_test.cpp     |  20 ++
 libc/test/shared/shared_math_test.cpp         |  21 ++
 .../llvm-project-overlay/libc/BUILD.bazel     | 182 +++++++++++++++++-
 44 files changed, 1065 insertions(+), 101 deletions(-)
 create mode 100644 libc/shared/math/fmaximum.h
 create mode 100644 libc/shared/math/fmaximumbf16.h
 create mode 100644 libc/shared/math/fmaximumf.h
 create mode 100644 libc/shared/math/fmaximumf128.h
 create mode 100644 libc/shared/math/fmaximumf16.h
 create mode 100644 libc/shared/math/fmaximuml.h
 create mode 100644 libc/shared/math/fminimum.h
 create mode 100644 libc/shared/math/fminimumbf16.h
 create mode 100644 libc/shared/math/fminimumf.h
 create mode 100644 libc/shared/math/fminimumf128.h
 create mode 100644 libc/shared/math/fminimumf16.h
 create mode 100644 libc/shared/math/fminimuml.h
 create mode 100644 libc/src/__support/math/fmaximum.h
 create mode 100644 libc/src/__support/math/fmaximumbf16.h
 create mode 100644 libc/src/__support/math/fmaximumf.h
 create mode 100644 libc/src/__support/math/fmaximumf128.h
 create mode 100644 libc/src/__support/math/fmaximumf16.h
 create mode 100644 libc/src/__support/math/fmaximuml.h
 create mode 100644 libc/src/__support/math/fminimum.h
 create mode 100644 libc/src/__support/math/fminimumbf16.h
 create mode 100644 libc/src/__support/math/fminimumf.h
 create mode 100644 libc/src/__support/math/fminimumf128.h
 create mode 100644 libc/src/__support/math/fminimumf16.h
 create mode 100644 libc/src/__support/math/fminimuml.h

diff --git a/libc/shared/math.h b/libc/shared/math.h
index 9892da63043e6..90c4f7397b79a 100644
--- a/libc/shared/math.h
+++ b/libc/shared/math.h
@@ -176,10 +176,22 @@
 #include "math/fmaxf.h"
 #include "math/fmaxf128.h"
 #include "math/fmaxf16.h"
+#include "math/fmaximum.h"
 #include "math/fmaximum_mag_num.h"
 #include "math/fmaximum_mag_numbf16.h"
 #include "math/fmaximum_mag_numf.h"
+#include "math/fmaximumbf16.h"
+#include "math/fmaximumf.h"
+#include "math/fmaximumf128.h"
+#include "math/fmaximumf16.h"
+#include "math/fmaximuml.h"
 #include "math/fmaxl.h"
+#include "math/fminimum.h"
+#include "math/fminimumbf16.h"
+#include "math/fminimumf.h"
+#include "math/fminimumf128.h"
+#include "math/fminimumf16.h"
+#include "math/fminimuml.h"
 #include "math/frexpf.h"
 #include "math/frexpf128.h"
 #include "math/frexpf16.h"
diff --git a/libc/shared/math/fmaximum.h b/libc/shared/math/fmaximum.h
new file mode 100644
index 0000000000000..bfb4180c8ee58
--- /dev/null
+++ b/libc/shared/math/fmaximum.h
@@ -0,0 +1,23 @@
+//===-- Shared fmaximum 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_H
+#define LLVM_LIBC_SHARED_MATH_FMAXIMUM_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fmaximum.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fmaximum;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_FMAXIMUM_H
diff --git a/libc/shared/math/fmaximumbf16.h b/libc/shared/math/fmaximumbf16.h
new file mode 100644
index 0000000000000..9f9e8ad14779a
--- /dev/null
+++ b/libc/shared/math/fmaximumbf16.h
@@ -0,0 +1,23 @@
+//===-- Shared fmaximumbf16 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_FMAXIMUMBF16_H
+#define LLVM_LIBC_SHARED_MATH_FMAXIMUMBF16_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fmaximumbf16.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fmaximumbf16;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_FMAXIMUMBF16_H
diff --git a/libc/shared/math/fmaximumf.h b/libc/shared/math/fmaximumf.h
new file mode 100644
index 0000000000000..fda4a59a4261f
--- /dev/null
+++ b/libc/shared/math/fmaximumf.h
@@ -0,0 +1,23 @@
+//===-- Shared fmaximumf 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_FMAXIMUMF_H
+#define LLVM_LIBC_SHARED_MATH_FMAXIMUMF_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fmaximumf.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fmaximumf;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_FMAXIMUMF_H
diff --git a/libc/shared/math/fmaximumf128.h b/libc/shared/math/fmaximumf128.h
new file mode 100644
index 0000000000000..01e563c6eb6ff
--- /dev/null
+++ b/libc/shared/math/fmaximumf128.h
@@ -0,0 +1,29 @@
+//===-- Shared fmaximumf128 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_FMAXIMUMF128_H
+#define LLVM_LIBC_SHARED_MATH_FMAXIMUMF128_H
+
+#include "include/llvm-libc-types/float128.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT128
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fmaximumf128.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fmaximumf128;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT128
+
+#endif // LLVM_LIBC_SHARED_MATH_FMAXIMUMF128_H
diff --git a/libc/shared/math/fmaximumf16.h b/libc/shared/math/fmaximumf16.h
new file mode 100644
index 0000000000000..4a7fdd5f21d4c
--- /dev/null
+++ b/libc/shared/math/fmaximumf16.h
@@ -0,0 +1,29 @@
+//===-- Shared fmaximumf16 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_FMAXIMUMF16_H
+#define LLVM_LIBC_SHARED_MATH_FMAXIMUMF16_H
+
+#include "include/llvm-libc-macros/float16-macros.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT16
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fmaximumf16.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fmaximumf16;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT16
+
+#endif // LLVM_LIBC_SHARED_MATH_FMAXIMUMF16_H
diff --git a/libc/shared/math/fmaximuml.h b/libc/shared/math/fmaximuml.h
new file mode 100644
index 0000000000000..5a85ebb564837
--- /dev/null
+++ b/libc/shared/math/fmaximuml.h
@@ -0,0 +1,23 @@
+//===-- Shared fmaximuml 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_FMAXIMUML_H
+#define LLVM_LIBC_SHARED_MATH_FMAXIMUML_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fmaximuml.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fmaximuml;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_FMAXIMUML_H
diff --git a/libc/shared/math/fminimum.h b/libc/shared/math/fminimum.h
new file mode 100644
index 0000000000000..d011ddbba8869
--- /dev/null
+++ b/libc/shared/math/fminimum.h
@@ -0,0 +1,23 @@
+//===-- Shared fminimum 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_H
+#define LLVM_LIBC_SHARED_MATH_FMINIMUM_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fminimum.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fminimum;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_FMINIMUM_H
diff --git a/libc/shared/math/fminimumbf16.h b/libc/shared/math/fminimumbf16.h
new file mode 100644
index 0000000000000..30950e5fd5e05
--- /dev/null
+++ b/libc/shared/math/fminimumbf16.h
@@ -0,0 +1,23 @@
+//===-- Shared fminimumbf16 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_FMINIMUMBF16_H
+#define LLVM_LIBC_SHARED_MATH_FMINIMUMBF16_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fminimumbf16.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fminimumbf16;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_FMINIMUMBF16_H
diff --git a/libc/shared/math/fminimumf.h b/libc/shared/math/fminimumf.h
new file mode 100644
index 0000000000000..576702409d6f5
--- /dev/null
+++ b/libc/shared/math/fminimumf.h
@@ -0,0 +1,23 @@
+//===-- Shared fminimumf 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_FMINIMUMF_H
+#define LLVM_LIBC_SHARED_MATH_FMINIMUMF_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fminimumf.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fminimumf;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_FMINIMUMF_H
diff --git a/libc/shared/math/fminimumf128.h b/libc/shared/math/fminimumf128.h
new file mode 100644
index 0000000000000..9faa71c486cb8
--- /dev/null
+++ b/libc/shared/math/fminimumf128.h
@@ -0,0 +1,29 @@
+//===-- Shared fminimumf128 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_FMINIMUMF128_H
+#define LLVM_LIBC_SHARED_MATH_FMINIMUMF128_H
+
+#include "include/llvm-libc-types/float128.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT128
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fminimumf128.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fminimumf128;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT128
+
+#endif // LLVM_LIBC_SHARED_MATH_FMINIMUMF128_H
diff --git a/libc/shared/math/fminimumf16.h b/libc/shared/math/fminimumf16.h
new file mode 100644
index 0000000000000..522213d210bf3
--- /dev/null
+++ b/libc/shared/math/fminimumf16.h
@@ -0,0 +1,29 @@
+//===-- Shared fminimumf16 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_FMINIMUMF16_H
+#define LLVM_LIBC_SHARED_MATH_FMINIMUMF16_H
+
+#include "include/llvm-libc-macros/float16-macros.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT16
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fminimumf16.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fminimumf16;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT16
+
+#endif // LLVM_LIBC_SHARED_MATH_FMINIMUMF16_H
diff --git a/libc/shared/math/fminimuml.h b/libc/shared/math/fminimuml.h
new file mode 100644
index 0000000000000..9af4033d16907
--- /dev/null
+++ b/libc/shared/math/fminimuml.h
@@ -0,0 +1,23 @@
+//===-- Shared fminimuml 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_FMINIMUML_H
+#define LLVM_LIBC_SHARED_MATH_FMINIMUML_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fminimuml.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fminimuml;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_FMINIMUML_H
diff --git a/libc/src/__support/FPUtil/BasicOperations.h b/libc/src/__support/FPUtil/BasicOperations.h
index 3216740aa74f9..7587439d4eb05 100644
--- a/libc/src/__support/FPUtil/BasicOperations.h
+++ b/libc/src/__support/FPUtil/BasicOperations.h
@@ -86,7 +86,8 @@ template <> LIBC_INLINE constexpr double max(double x, double y) {
 #endif
 
 template <typename T>
-LIBC_INLINE cpp::enable_if_t<cpp::is_floating_point_v<T>, T> min(T x, T y) {
+LIBC_INLINE constexpr cpp::enable_if_t<cpp::is_floating_point_v<T>, T>
+constexpr_min(T x, T y) {
   FPBits<T> x_bits(x);
   FPBits<T> y_bits(y);
 
@@ -98,13 +99,21 @@ LIBC_INLINE cpp::enable_if_t<cpp::is_floating_point_v<T>, T> min(T x, T y) {
   return x < y ? x : y;
 }
 
+template <typename T>
+LIBC_INLINE constexpr cpp::enable_if_t<cpp::is_floating_point_v<T>, T>
+min(T x, T y) {
+  return constexpr_min(x, y);
+}
+
 #ifdef LIBC_TYPES_HAS_FLOAT16
 #if defined(__LIBC_USE_BUILTIN_FMAXF16_FMINF16)
-template <> LIBC_INLINE float16 min(float16 x, float16 y) {
+template <> LIBC_INLINE constexpr float16 min(float16 x, float16 y) {
+  if (cpp::is_constant_evaluated())
+    return constexpr_min(x, y);
   return __builtin_fminf16(x, y);
 }
 #elif !defined(LIBC_TARGET_ARCH_IS_AARCH64)
-template <> LIBC_INLINE float16 min(float16 x, float16 y) {
+template <> LIBC_INLINE constexpr float16 min(float16 x, float16 y) {
   FPBits<float16> x_bits(x);
   FPBits<float16> y_bits(y);
 
@@ -116,11 +125,15 @@ template <> LIBC_INLINE float16 min(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 float min(float x, float y) {
+template <> LIBC_INLINE constexpr float min(float x, float y) {
+  if (cpp::is_constant_evaluated())
+    return constexpr_min(x, y);
   return __builtin_fminf(x, y);
 }
 
-template <> LIBC_INLINE double min(double x, double y) {
+template <> LIBC_INLINE constexpr double min(double x, double y) {
+  if (cpp::is_constant_evaluated())
+    return constexpr_min(x, y);
   return __builtin_fmin(x, y);
 }
 #endif
@@ -150,7 +163,7 @@ LIBC_INLINE T fmax(T x, T y) {
 }
 
 template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
-LIBC_INLINE T fmaximum(T x, T y) {
+LIBC_INLINE constexpr T fmaximum(T x, T y) {
   FPBits<T> bitx(x), bity(y);
 
   if (bitx.is_nan())
@@ -161,7 +174,7 @@ LIBC_INLINE T fmaximum(T x, T y) {
 }
 
 template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
-LIBC_INLINE T fminimum(T x, T y) {
+LIBC_INLINE constexpr T fminimum(T x, T y) {
   const FPBits<T> bitx(x), bity(y);
 
   if (bitx.is_nan())
diff --git a/libc/src/__support/math/CMakeLists.txt b/libc/src/__support/math/CMakeLists.txt
index f62dc5998053f..dd9c350c507d9 100644
--- a/libc/src/__support/math/CMakeLists.txt
+++ b/libc/src/__support/math/CMakeLists.txt
@@ -819,6 +819,136 @@ add_header_library(
     libc.src.__support.macros.config
     libc.src.__support.number_pair
 )
+add_header_library(
+  fmaximum
+  HDRS
+    fmaximum.h
+  DEPENDS
+    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.macros.config
+  FLAGS
+    MISC_MATH_BASIC_OPS_OPT
+)
+
+add_header_library(
+  fmaximumbf16
+  HDRS
+    fmaximumbf16.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(
+  fmaximumf
+  HDRS
+    fmaximumf.h
+  DEPENDS
+    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.macros.config
+  FLAGS
+    MISC_MATH_BASIC_OPS_OPT
+)
+
+add_header_library(
+  fmaximumf128
+  HDRS
+    fmaximumf128.h
+  DEPENDS
+    libc.include.llvm-libc-types.float128
+    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.macros.config
+)
+
+add_header_library(
+  fmaximumf16
+  HDRS
+    fmaximumf16.h
+  DEPENDS
+    libc.include.llvm-libc-macros.float16_macros
+    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.macros.config
+  FLAGS
+    MISC_MATH_BASIC_OPS_OPT
+)
+
+add_header_library(
+  fmaximuml
+  HDRS
+    fmaximuml.h
+  DEPENDS
+    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.macros.config
+)
+
+add_header_library(
+  fminimum
+  HDRS
+    fminimum.h
+  DEPENDS
+    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.macros.config
+  FLAGS
+    MISC_MATH_BASIC_OPS_OPT
+)
+
+add_header_library(
+  fminimumbf16
+  HDRS
+    fminimumbf16.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(
+  fminimumf
+  HDRS
+    fminimumf.h
+  DEPENDS
+    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.macros.config
+  FLAGS
+    MISC_MATH_BASIC_OPS_OPT
+)
+
+add_header_library(
+  fminimumf128
+  HDRS
+    fminimumf128.h
+  DEPENDS
+    libc.include.llvm-libc-types.float128
+    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.macros.config
+)
+
+add_header_library(
+  fminimumf16
+  HDRS
+    fminimumf16.h
+  DEPENDS
+    libc.include.llvm-libc-macros.float16_macros
+    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.macros.config
+  FLAGS
+    MISC_MATH_BASIC_OPS_OPT
+)
+
+add_header_library(
+  fminimuml
+  HDRS
+    fminimuml.h
+  DEPENDS
+    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.macros.config
+)
+
 
 add_header_library(
   llogbbf16
diff --git a/libc/src/__support/math/fmaximum.h b/libc/src/__support/math/fmaximum.h
new file mode 100644
index 0000000000000..184df020e0713
--- /dev/null
+++ b/libc/src/__support/math/fmaximum.h
@@ -0,0 +1,25 @@
+//===-- Implementation header for fmaximum ----------------------*- 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_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FMAXIMUM_H
+
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace math {
+
+LIBC_INLINE constexpr double fmaximum(double x, double y) {
+  return fputil::fmaximum(x, y);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FMAXIMUM_H
diff --git a/libc/src/__support/math/fmaximumbf16.h b/libc/src/__support/math/fmaximumbf16.h
new file mode 100644
index 0000000000000..108aa013a8f59
--- /dev/null
+++ b/libc/src/__support/math/fmaximumbf16.h
@@ -0,0 +1,26 @@
+//===-- Implementation header for fmaximumbf16 ------------------*- 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_FMAXIMUMBF16_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FMAXIMUMBF16_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 fmaximumbf16(bfloat16 x, bfloat16 y) {
+  return fputil::fmaximum(x, y);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FMAXIMUMBF16_H
diff --git a/libc/src/__support/math/fmaximumf.h b/libc/src/__support/math/fmaximumf.h
new file mode 100644
index 0000000000000..478e7a1b849fa
--- /dev/null
+++ b/libc/src/__support/math/fmaximumf.h
@@ -0,0 +1,25 @@
+//===-- Implementation header for fmaximumf ---------------------*- 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_FMAXIMUMF_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FMAXIMUMF_H
+
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace math {
+
+LIBC_INLINE constexpr float fmaximumf(float x, float y) {
+  return fputil::fmaximum(x, y);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FMAXIMUMF_H
diff --git a/libc/src/__support/math/fmaximumf128.h b/libc/src/__support/math/fmaximumf128.h
new file mode 100644
index 0000000000000..a769cd954c864
--- /dev/null
+++ b/libc/src/__support/math/fmaximumf128.h
@@ -0,0 +1,31 @@
+//===-- Implementation header for fmaximumf128 ------------------*- 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_FMAXIMUMF128_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FMAXIMUMF128_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 fmaximumf128(float128 x, float128 y) {
+  return fputil::fmaximum(x, y);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT128
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FMAXIMUMF128_H
diff --git a/libc/src/__support/math/fmaximumf16.h b/libc/src/__support/math/fmaximumf16.h
new file mode 100644
index 0000000000000..184cb9d2ede4f
--- /dev/null
+++ b/libc/src/__support/math/fmaximumf16.h
@@ -0,0 +1,31 @@
+//===-- Implementation header for fmaximumf16 -------------------*- 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_FMAXIMUMF16_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FMAXIMUMF16_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 fmaximumf16(float16 x, float16 y) {
+  return fputil::fmaximum(x, y);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT16
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FMAXIMUMF16_H
diff --git a/libc/src/__support/math/fmaximuml.h b/libc/src/__support/math/fmaximuml.h
new file mode 100644
index 0000000000000..b47543ee5f1d4
--- /dev/null
+++ b/libc/src/__support/math/fmaximuml.h
@@ -0,0 +1,25 @@
+//===-- Implementation header for fmaximuml ---------------------*- 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_FMAXIMUML_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FMAXIMUML_H
+
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace math {
+
+LIBC_INLINE constexpr long double fmaximuml(long double x, long double y) {
+  return fputil::fmaximum(x, y);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FMAXIMUML_H
diff --git a/libc/src/__support/math/fminimum.h b/libc/src/__support/math/fminimum.h
new file mode 100644
index 0000000000000..6b0f5ddbd2ba1
--- /dev/null
+++ b/libc/src/__support/math/fminimum.h
@@ -0,0 +1,25 @@
+//===-- Implementation header for fminimum ----------------------*- 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_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FMINIMUM_H
+
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace math {
+
+LIBC_INLINE constexpr double fminimum(double x, double y) {
+  return fputil::fminimum(x, y);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FMINIMUM_H
diff --git a/libc/src/__support/math/fminimumbf16.h b/libc/src/__support/math/fminimumbf16.h
new file mode 100644
index 0000000000000..b448d0b50f366
--- /dev/null
+++ b/libc/src/__support/math/fminimumbf16.h
@@ -0,0 +1,26 @@
+//===-- Implementation header for fminimumbf16 ------------------*- 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_FMINIMUMBF16_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FMINIMUMBF16_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 fminimumbf16(bfloat16 x, bfloat16 y) {
+  return fputil::fminimum(x, y);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FMINIMUMBF16_H
diff --git a/libc/src/__support/math/fminimumf.h b/libc/src/__support/math/fminimumf.h
new file mode 100644
index 0000000000000..dcbfd8d2a67ab
--- /dev/null
+++ b/libc/src/__support/math/fminimumf.h
@@ -0,0 +1,25 @@
+//===-- Implementation header for fminimumf ---------------------*- 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_FMINIMUMF_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FMINIMUMF_H
+
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace math {
+
+LIBC_INLINE constexpr float fminimumf(float x, float y) {
+  return fputil::fminimum(x, y);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FMINIMUMF_H
diff --git a/libc/src/__support/math/fminimumf128.h b/libc/src/__support/math/fminimumf128.h
new file mode 100644
index 0000000000000..ee8fb1a9c6b5d
--- /dev/null
+++ b/libc/src/__support/math/fminimumf128.h
@@ -0,0 +1,31 @@
+//===-- Implementation header for fminimumf128 ------------------*- 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_FMINIMUMF128_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FMINIMUMF128_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 fminimumf128(float128 x, float128 y) {
+  return fputil::fminimum(x, y);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT128
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FMINIMUMF128_H
diff --git a/libc/src/__support/math/fminimumf16.h b/libc/src/__support/math/fminimumf16.h
new file mode 100644
index 0000000000000..4dc12c6ba1d05
--- /dev/null
+++ b/libc/src/__support/math/fminimumf16.h
@@ -0,0 +1,31 @@
+//===-- Implementation header for fminimumf16 -------------------*- 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_FMINIMUMF16_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FMINIMUMF16_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 fminimumf16(float16 x, float16 y) {
+  return fputil::fminimum(x, y);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT16
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FMINIMUMF16_H
diff --git a/libc/src/__support/math/fminimuml.h b/libc/src/__support/math/fminimuml.h
new file mode 100644
index 0000000000000..534f32c7ca9dc
--- /dev/null
+++ b/libc/src/__support/math/fminimuml.h
@@ -0,0 +1,25 @@
+//===-- Implementation header for fminimuml ---------------------*- 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_FMINIMUML_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FMINIMUML_H
+
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace math {
+
+LIBC_INLINE constexpr long double fminimuml(long double x, long double y) {
+  return fputil::fminimum(x, y);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FMINIMUML_H
diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt
index d72131a608ddb..dce67f3929288 100644
--- a/libc/src/math/generic/CMakeLists.txt
+++ b/libc/src/math/generic/CMakeLists.txt
@@ -2202,9 +2202,7 @@ add_entrypoint_object(
   HDRS
     ../fmaximum.h
   DEPENDS
-    libc.src.__support.FPUtil.basic_operations
-  FLAGS
-    MISC_MATH_BASIC_OPS_OPT
+    libc.src.__support.math.fmaximum
 )
 
 add_entrypoint_object(
@@ -2214,9 +2212,7 @@ add_entrypoint_object(
   HDRS
     ../fmaximumf.h
   DEPENDS
-    libc.src.__support.FPUtil.basic_operations
-  FLAGS
-    MISC_MATH_BASIC_OPS_OPT
+    libc.src.__support.math.fmaximumf
 )
 
 add_entrypoint_object(
@@ -2226,7 +2222,7 @@ add_entrypoint_object(
   HDRS
     ../fmaximuml.h
   DEPENDS
-    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.math.fmaximuml
 )
 
 add_entrypoint_object(
@@ -2236,10 +2232,7 @@ add_entrypoint_object(
   HDRS
     ../fmaximumf16.h
   DEPENDS
-    libc.src.__support.macros.properties.types
-    libc.src.__support.FPUtil.basic_operations
-  FLAGS
-    MISC_MATH_BASIC_OPS_OPT
+    libc.src.__support.math.fmaximumf16
 )
 
 add_entrypoint_object(
@@ -2249,8 +2242,7 @@ add_entrypoint_object(
   HDRS
     ../fmaximumf128.h
   DEPENDS
-    libc.src.__support.macros.properties.types
-    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.math.fmaximumf128
 )
 
 add_entrypoint_object(
@@ -2260,12 +2252,7 @@ add_entrypoint_object(
   HDRS
     ../fmaximumbf16.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.fmaximumbf16
 )
 
 add_entrypoint_object(
@@ -2477,9 +2464,7 @@ add_entrypoint_object(
   HDRS
     ../fminimum.h
   DEPENDS
-    libc.src.__support.FPUtil.basic_operations
-  FLAGS
-    MISC_MATH_BASIC_OPS_OPT
+    libc.src.__support.math.fminimum
 )
 
 add_entrypoint_object(
@@ -2489,9 +2474,7 @@ add_entrypoint_object(
   HDRS
     ../fminimumf.h
   DEPENDS
-    libc.src.__support.FPUtil.basic_operations
-  FLAGS
-    MISC_MATH_BASIC_OPS_OPT
+    libc.src.__support.math.fminimumf
 )
 
 add_entrypoint_object(
@@ -2501,7 +2484,7 @@ add_entrypoint_object(
   HDRS
     ../fminimuml.h
   DEPENDS
-    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.math.fminimuml
 )
 
 add_entrypoint_object(
@@ -2511,10 +2494,7 @@ add_entrypoint_object(
   HDRS
     ../fminimumf16.h
   DEPENDS
-    libc.src.__support.macros.properties.types
-    libc.src.__support.FPUtil.basic_operations
-  FLAGS
-    MISC_MATH_BASIC_OPS_OPT
+    libc.src.__support.math.fminimumf16
 )
 
 add_entrypoint_object(
@@ -2524,8 +2504,7 @@ add_entrypoint_object(
   HDRS
     ../fminimumf128.h
   DEPENDS
-    libc.src.__support.macros.properties.types
-    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.math.fminimumf128
 )
 
 add_entrypoint_object(
@@ -2535,12 +2514,7 @@ add_entrypoint_object(
   HDRS
     ../fminimumbf16.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.fminimumbf16
 )
 
 add_entrypoint_object(
diff --git a/libc/src/math/generic/fmaximum.cpp b/libc/src/math/generic/fmaximum.cpp
index 1493521affd93..71cc47e84e29c 100644
--- a/libc/src/math/generic/fmaximum.cpp
+++ b/libc/src/math/generic/fmaximum.cpp
@@ -7,14 +7,12 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/fmaximum.h"
-#include "src/__support/FPUtil/BasicOperations.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/fmaximum.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(double, fmaximum, (double x, double y)) {
-  return fputil::fmaximum(x, y);
+  return math::fmaximum(x, y);
 }
 
 } // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/fmaximumbf16.cpp b/libc/src/math/generic/fmaximumbf16.cpp
index e10830b4693d5..2196d2da7886f 100644
--- a/libc/src/math/generic/fmaximumbf16.cpp
+++ b/libc/src/math/generic/fmaximumbf16.cpp
@@ -7,15 +7,12 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/fmaximumbf16.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/fmaximumbf16.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(bfloat16, fmaximumbf16, (bfloat16 x, bfloat16 y)) {
-  return fputil::fmaximum(x, y);
+  return math::fmaximumbf16(x, y);
 }
 
 } // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/fmaximumf.cpp b/libc/src/math/generic/fmaximumf.cpp
index faa00a6301894..b7684070dae8b 100644
--- a/libc/src/math/generic/fmaximumf.cpp
+++ b/libc/src/math/generic/fmaximumf.cpp
@@ -7,14 +7,12 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/fmaximumf.h"
-#include "src/__support/FPUtil/BasicOperations.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/fmaximumf.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(float, fmaximumf, (float x, float y)) {
-  return fputil::fmaximum(x, y);
+  return math::fmaximumf(x, y);
 }
 
 } // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/fmaximumf128.cpp b/libc/src/math/generic/fmaximumf128.cpp
index 362b583822872..88b698c19ccea 100644
--- a/libc/src/math/generic/fmaximumf128.cpp
+++ b/libc/src/math/generic/fmaximumf128.cpp
@@ -7,14 +7,12 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/fmaximumf128.h"
-#include "src/__support/FPUtil/BasicOperations.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/fmaximumf128.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(float128, fmaximumf128, (float128 x, float128 y)) {
-  return fputil::fmaximum(x, y);
+  return math::fmaximumf128(x, y);
 }
 
 } // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/fmaximumf16.cpp b/libc/src/math/generic/fmaximumf16.cpp
index aa4982d26bccb..bc81548d1ccd2 100644
--- a/libc/src/math/generic/fmaximumf16.cpp
+++ b/libc/src/math/generic/fmaximumf16.cpp
@@ -7,14 +7,12 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/fmaximumf16.h"
-#include "src/__support/FPUtil/BasicOperations.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/fmaximumf16.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(float16, fmaximumf16, (float16 x, float16 y)) {
-  return fputil::fmaximum(x, y);
+  return math::fmaximumf16(x, y);
 }
 
 } // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/fmaximuml.cpp b/libc/src/math/generic/fmaximuml.cpp
index 65e3b6935eee4..91d5619469efa 100644
--- a/libc/src/math/generic/fmaximuml.cpp
+++ b/libc/src/math/generic/fmaximuml.cpp
@@ -7,14 +7,12 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/fmaximuml.h"
-#include "src/__support/FPUtil/BasicOperations.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/fmaximuml.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(long double, fmaximuml, (long double x, long double y)) {
-  return fputil::fmaximum(x, y);
+  return math::fmaximuml(x, y);
 }
 
 } // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/fminimum.cpp b/libc/src/math/generic/fminimum.cpp
index 2f14e64cd7575..9fd2c1cc72a3b 100644
--- a/libc/src/math/generic/fminimum.cpp
+++ b/libc/src/math/generic/fminimum.cpp
@@ -7,14 +7,12 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/fminimum.h"
-#include "src/__support/FPUtil/BasicOperations.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/fminimum.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(double, fminimum, (double x, double y)) {
-  return fputil::fminimum(x, y);
+  return math::fminimum(x, y);
 }
 
 } // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/fminimumbf16.cpp b/libc/src/math/generic/fminimumbf16.cpp
index da976b96b987c..e42d777ad6ac8 100644
--- a/libc/src/math/generic/fminimumbf16.cpp
+++ b/libc/src/math/generic/fminimumbf16.cpp
@@ -7,15 +7,12 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/fminimumbf16.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/fminimumbf16.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(bfloat16, fminimumbf16, (bfloat16 x, bfloat16 y)) {
-  return fputil::fminimum(x, y);
+  return math::fminimumbf16(x, y);
 }
 
 } // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/fminimumf.cpp b/libc/src/math/generic/fminimumf.cpp
index 57e33c184ccf1..08e6e945619f4 100644
--- a/libc/src/math/generic/fminimumf.cpp
+++ b/libc/src/math/generic/fminimumf.cpp
@@ -7,14 +7,12 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/fminimumf.h"
-#include "src/__support/FPUtil/BasicOperations.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/fminimumf.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(float, fminimumf, (float x, float y)) {
-  return fputil::fminimum(x, y);
+  return math::fminimumf(x, y);
 }
 
 } // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/fminimumf128.cpp b/libc/src/math/generic/fminimumf128.cpp
index 3dbd18d65362e..b8fb50f0d424c 100644
--- a/libc/src/math/generic/fminimumf128.cpp
+++ b/libc/src/math/generic/fminimumf128.cpp
@@ -7,14 +7,12 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/fminimumf128.h"
-#include "src/__support/FPUtil/BasicOperations.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/fminimumf128.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(float128, fminimumf128, (float128 x, float128 y)) {
-  return fputil::fminimum(x, y);
+  return math::fminimumf128(x, y);
 }
 
 } // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/fminimumf16.cpp b/libc/src/math/generic/fminimumf16.cpp
index 42ad9a55e4d60..c8c9b9a8ac938 100644
--- a/libc/src/math/generic/fminimumf16.cpp
+++ b/libc/src/math/generic/fminimumf16.cpp
@@ -7,14 +7,12 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/fminimumf16.h"
-#include "src/__support/FPUtil/BasicOperations.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/fminimumf16.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(float16, fminimumf16, (float16 x, float16 y)) {
-  return fputil::fminimum(x, y);
+  return math::fminimumf16(x, y);
 }
 
 } // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/fminimuml.cpp b/libc/src/math/generic/fminimuml.cpp
index c80cb0a5fc440..4d35988434fc4 100644
--- a/libc/src/math/generic/fminimuml.cpp
+++ b/libc/src/math/generic/fminimuml.cpp
@@ -7,14 +7,12 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/fminimuml.h"
-#include "src/__support/FPUtil/BasicOperations.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/fminimuml.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(long double, fminimuml, (long double x, long double y)) {
-  return fputil::fminimum(x, y);
+  return math::fminimuml(x, y);
 }
 
 } // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/test/shared/CMakeLists.txt b/libc/test/shared/CMakeLists.txt
index e9664b18a9e98..5539aff926648 100644
--- a/libc/test/shared/CMakeLists.txt
+++ b/libc/test/shared/CMakeLists.txt
@@ -173,10 +173,22 @@ add_fp_unittest(
     libc.src.__support.math.fmaxf
     libc.src.__support.math.fmaxf128
     libc.src.__support.math.fmaxf16
+    libc.src.__support.math.fmaximum
     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.fmaximumbf16
+    libc.src.__support.math.fmaximumf
+    libc.src.__support.math.fmaximumf128
+    libc.src.__support.math.fmaximumf16
+    libc.src.__support.math.fmaximuml
     libc.src.__support.math.fmaxl
+    libc.src.__support.math.fminimum
+    libc.src.__support.math.fminimumbf16
+    libc.src.__support.math.fminimumf
+    libc.src.__support.math.fminimumf128
+    libc.src.__support.math.fminimumf16
+    libc.src.__support.math.fminimuml
     libc.src.__support.math.frexpf
     libc.src.__support.math.frexpf128
     libc.src.__support.math.frexpf16
@@ -338,9 +350,21 @@ add_fp_unittest(
     libc.src.__support.math.fabsf128
     libc.src.__support.math.fabsf16
     libc.src.__support.math.fabsl
+    libc.src.__support.math.fmaximum
     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.fmaximumbf16
+    libc.src.__support.math.fmaximumf
+    libc.src.__support.math.fmaximumf128
+    libc.src.__support.math.fmaximumf16
+    libc.src.__support.math.fmaximuml
+    libc.src.__support.math.fminimum
+    libc.src.__support.math.fminimumbf16
+    libc.src.__support.math.fminimumf
+    libc.src.__support.math.fminimumf128
+    libc.src.__support.math.fminimumf16
+    libc.src.__support.math.fminimuml
     libc.src.__support.math.llogbbf16
     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 2bb9a15cb4684..b0d9e36b2f3a6 100644
--- a/libc/test/shared/shared_math_constexpr_test.cpp
+++ b/libc/test/shared/shared_math_constexpr_test.cpp
@@ -23,6 +23,8 @@ static_assert(0.0f == LIBC_NAMESPACE::shared::fdiv(0.0, 1.0));
 static_assert(1.0 == LIBC_NAMESPACE::shared::floor(1.2));
 static_assert(2.0 == LIBC_NAMESPACE::shared::fmaximum_mag_num(1.0, 2.0));
 static_assert(0.0 == LIBC_NAMESPACE::shared::log(1.0));
+static_assert(0.0 == LIBC_NAMESPACE::shared::fmaximum(0.0, 0.0));
+static_assert(0.0 == LIBC_NAMESPACE::shared::fminimum(0.0, 0.0));
 
 //===----------------------------------------------------------------------===//
 //                       Float Tests
@@ -34,6 +36,8 @@ static_assert(1.0f == LIBC_NAMESPACE::shared::fabsf(-1.0f));
 static_assert(1.0f == LIBC_NAMESPACE::shared::fdimf(1.0f, 0.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));
+static_assert(0.0f == LIBC_NAMESPACE::shared::fmaximumf(0.0f, 0.0f));
+static_assert(0.0f == LIBC_NAMESPACE::shared::fminimumf(0.0f, 0.0f));
 
 //===----------------------------------------------------------------------===//
 //                       Float16 Tests
@@ -46,6 +50,8 @@ static_assert(0.0f16 == LIBC_NAMESPACE::shared::copysignf16(0.0f16, 0.0f16));
 static_assert(1.0f16 == LIBC_NAMESPACE::shared::fabsf16(-1.0f16));
 static_assert(1.0f16 == LIBC_NAMESPACE::shared::fdimf16(1.0f16, 0.0f16));
 static_assert(3.0f16 == LIBC_NAMESPACE::shared::floorf16(3.7f16));
+static_assert(0.0f16 == LIBC_NAMESPACE::shared::fmaximumf16(0.0f16, 0.0f16));
+static_assert(0.0f16 == LIBC_NAMESPACE::shared::fminimumf16(0.0f16, 0.0f16));
 
 #endif // LIBC_TYPES_HAS_FLOAT16
 
@@ -66,6 +72,8 @@ static_assert(0.0f == LIBC_NAMESPACE::shared::fdivl(0.0L, 1.0L));
 static_assert(0.0L == LIBC_NAMESPACE::shared::floorl(0.0L));
 static_assert(bfloat16(0.0) == LIBC_NAMESPACE::shared::bf16subl(0.0L, 0.0L));
 static_assert(0.0L == LIBC_NAMESPACE::shared::sqrtl(0.0L));
+static_assert(0.0L == LIBC_NAMESPACE::shared::fmaximuml(0.0L, 0.0L));
+static_assert(0.0L == LIBC_NAMESPACE::shared::fminimuml(0.0L, 0.0L));
 
 #endif
 
@@ -91,6 +99,12 @@ static_assert(0.0f ==
               LIBC_NAMESPACE::shared::fdivf128(float128(0.0), float128(1.0)));
 static_assert(float128(0.0) ==
               LIBC_NAMESPACE::shared::floorf128(float128(0.0)));
+static_assert(float128(0.0) ==
+              LIBC_NAMESPACE::shared::fmaximumf128(float128(0.0),
+                                                   float128(0.0)));
+static_assert(float128(0.0) ==
+              LIBC_NAMESPACE::shared::fminimumf128(float128(0.0),
+                                                   float128(0.0)));
 
 #endif // LIBC_TYPES_HAS_FLOAT128
 
@@ -116,5 +130,11 @@ static_assert(bfloat16(0.0) ==
               LIBC_NAMESPACE::shared::logbbf16(bfloat16(1.0f)));
 static_assert(0 == LIBC_NAMESPACE::shared::ilogbbf16(bfloat16(1.0)));
 static_assert(0L == LIBC_NAMESPACE::shared::llogbbf16(bfloat16(1.0)));
+static_assert(bfloat16(0.0) ==
+              LIBC_NAMESPACE::shared::fmaximumbf16(bfloat16(0.0),
+                                                   bfloat16(0.0)));
+static_assert(bfloat16(0.0) ==
+              LIBC_NAMESPACE::shared::fminimumbf16(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 7ba056a08fa9d..34644f86d2646 100644
--- a/libc/test/shared/shared_math_test.cpp
+++ b/libc/test/shared/shared_math_test.cpp
@@ -102,6 +102,9 @@ TEST(LlvmLibcSharedMathTest, AllFloat16) {
 #ifndef LIBC_TYPES_LONG_DOUBLE_IS_DOUBLE_DOUBLE
   EXPECT_FP_EQ(0.0f16, LIBC_NAMESPACE::shared::nexttowardf16(0.0f16, 0.0L));
 #endif // LIBC_TYPES_LONG_DOUBLE_IS_DOUBLE_DOUBLE
+
+  EXPECT_FP_EQ(0x0p+0f16, LIBC_NAMESPACE::shared::fmaximumf16(0.0f16, 0.0f16));
+  EXPECT_FP_EQ(0x0p+0f16, LIBC_NAMESPACE::shared::fminimumf16(0.0f16, 0.0f16));
 }
 
 #endif // LIBC_TYPES_HAS_FLOAT16
@@ -212,6 +215,9 @@ TEST(LlvmLibcSharedMathTest, AllFloat) {
   EXPECT_FP_EQ(0.0f16, LIBC_NAMESPACE::shared::f16sqrtf(0.0f));
   EXPECT_FP_EQ(10.0f16, LIBC_NAMESPACE::shared::f16fmaf(2.0f, 3.0f, 4.0f));
 #endif // LIBC_TYPES_HAS_FLOAT16
+
+  EXPECT_FP_EQ(0x0p+0f, LIBC_NAMESPACE::shared::fmaximumf(0.0f, 0.0f));
+  EXPECT_FP_EQ(0x0p+0f, LIBC_NAMESPACE::shared::fminimumf(0.0f, 0.0f));
 }
 
 TEST(LlvmLibcSharedMathTest, AllDouble) {
@@ -298,6 +304,9 @@ TEST(LlvmLibcSharedMathTest, AllDouble) {
   EXPECT_FP_EQ(0.0f16, LIBC_NAMESPACE::shared::f16sqrt(0.0));
   EXPECT_FP_EQ(10.0f16, LIBC_NAMESPACE::shared::f16fma(2.0, 3.0, 4.0));
 #endif // LIBC_TYPES_HAS_FLOAT16
+
+  EXPECT_FP_EQ(0.0, LIBC_NAMESPACE::shared::fmaximum(0.0, 0.0));
+  EXPECT_FP_EQ(0.0, LIBC_NAMESPACE::shared::fminimum(0.0, 0.0));
 }
 
 // TODO: Enable the tests when double-double type is supported.
@@ -366,6 +375,8 @@ TEST(LlvmLibcSharedMathTest, AllLongDouble) {
 #endif // LIBC_TYPES_HAS_FLOAT16
 
   EXPECT_FP_EQ(0.0L, LIBC_NAMESPACE::shared::sqrtl(0.0L));
+  EXPECT_FP_EQ(0x0p+0L, LIBC_NAMESPACE::shared::fmaximuml(0.0L, 0.0L));
+  EXPECT_FP_EQ(0x0p+0L, LIBC_NAMESPACE::shared::fminimuml(0.0L, 0.0L));
 }
 
 #endif // LIBC_TYPES_LONG_DOUBLE_IS_DOUBLE_DOUBLE
@@ -472,6 +483,11 @@ TEST(LlvmLibcSharedMathTest, AllFloat128) {
       0.0f16, LIBC_NAMESPACE::shared::f16subf128(float128(0.0), float128(0.0)));
   EXPECT_FP_EQ(0.0f16, LIBC_NAMESPACE::shared::f16sqrtf128(float128(0.0)));
 #endif // LIBC_TYPES_HAS_FLOAT16
+
+  EXPECT_FP_EQ(float128(0.0), LIBC_NAMESPACE::shared::fmaximumf128(
+                                  float128(0.0), float128(0.0)));
+  EXPECT_FP_EQ(float128(0.0), LIBC_NAMESPACE::shared::fminimumf128(
+                                  float128(0.0), float128(0.0)));
 }
 
 #endif // LIBC_TYPES_HAS_FLOAT128
@@ -542,4 +558,9 @@ TEST(LlvmLibcSharedMathTest, AllBFloat16) {
 
   EXPECT_EQ(0, LIBC_NAMESPACE::shared::ilogbbf16(bfloat16(1.0)));
   EXPECT_EQ(0L, LIBC_NAMESPACE::shared::llogbbf16(bfloat16(1.0)));
+
+  EXPECT_FP_EQ(bfloat16(0.0), LIBC_NAMESPACE::shared::fmaximumbf16(
+                                  bfloat16(0.0), bfloat16(0.0)));
+  EXPECT_FP_EQ(bfloat16(0.0), LIBC_NAMESPACE::shared::fminimumbf16(
+                                  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 822292fc70202..4d3670353c793 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -3946,6 +3946,120 @@ libc_support_library(
     ],
 )
 
+libc_support_library(
+    name = "__support_math_fmaximum",
+    hdrs = ["src/__support/math/fmaximum.h"],
+    deps = [
+        ":__support_fputil_basic_operations",
+        ":__support_macros_config",
+    ],
+)
+
+libc_support_library(
+    name = "__support_math_fmaximumbf16",
+    hdrs = ["src/__support/math/fmaximumbf16.h"],
+    deps = [
+        ":__support_fputil_basic_operations",
+        ":__support_fputil_bfloat16",
+        ":__support_macros_config",
+    ],
+)
+
+libc_support_library(
+    name = "__support_math_fmaximumf",
+    hdrs = ["src/__support/math/fmaximumf.h"],
+    deps = [
+        ":__support_fputil_basic_operations",
+        ":__support_macros_config",
+    ],
+)
+
+libc_support_library(
+    name = "__support_math_fmaximumf128",
+    hdrs = ["src/__support/math/fmaximumf128.h"],
+    deps = [
+        ":__support_fputil_basic_operations",
+        ":__support_macros_config",
+        ":llvm_libc_types_float128",
+    ],
+)
+
+libc_support_library(
+    name = "__support_math_fmaximumf16",
+    hdrs = ["src/__support/math/fmaximumf16.h"],
+    deps = [
+        ":__support_fputil_basic_operations",
+        ":__support_macros_config",
+        ":llvm_libc_macros_float16_macros",
+    ],
+)
+
+libc_support_library(
+    name = "__support_math_fmaximuml",
+    hdrs = ["src/__support/math/fmaximuml.h"],
+    deps = [
+        ":__support_fputil_basic_operations",
+        ":__support_macros_config",
+    ],
+)
+
+libc_support_library(
+    name = "__support_math_fminimum",
+    hdrs = ["src/__support/math/fminimum.h"],
+    deps = [
+        ":__support_fputil_basic_operations",
+        ":__support_macros_config",
+    ],
+)
+
+libc_support_library(
+    name = "__support_math_fminimumbf16",
+    hdrs = ["src/__support/math/fminimumbf16.h"],
+    deps = [
+        ":__support_fputil_basic_operations",
+        ":__support_fputil_bfloat16",
+        ":__support_macros_config",
+    ],
+)
+
+libc_support_library(
+    name = "__support_math_fminimumf",
+    hdrs = ["src/__support/math/fminimumf.h"],
+    deps = [
+        ":__support_fputil_basic_operations",
+        ":__support_macros_config",
+    ],
+)
+
+libc_support_library(
+    name = "__support_math_fminimumf128",
+    hdrs = ["src/__support/math/fminimumf128.h"],
+    deps = [
+        ":__support_fputil_basic_operations",
+        ":__support_macros_config",
+        ":llvm_libc_types_float128",
+    ],
+)
+
+libc_support_library(
+    name = "__support_math_fminimumf16",
+    hdrs = ["src/__support/math/fminimumf16.h"],
+    deps = [
+        ":__support_fputil_basic_operations",
+        ":__support_macros_config",
+        ":llvm_libc_macros_float16_macros",
+    ],
+)
+
+libc_support_library(
+    name = "__support_math_fminimuml",
+    hdrs = ["src/__support/math/fminimuml.h"],
+    deps = [
+        ":__support_fputil_basic_operations",
+        ":__support_macros_config",
+    ],
+)
+
 libc_support_library(
     name = "__support_math_ilogbbf16",
     hdrs = ["src/__support/math/ilogbbf16.h"],
@@ -7223,6 +7337,20 @@ libc_math_function(
     ],
 )
 
+libc_math_function(
+    name = "fmaximumbf16",
+    additional_deps = [
+        ":__support_math_fmaximumbf16",
+    ],
+)
+
+libc_math_function(
+    name = "fminimumbf16",
+    additional_deps = [
+        ":__support_math_fminimumbf16",
+    ],
+)
+
 libc_math_function(
     name = "ilogbbf16",
     additional_deps = [
@@ -8022,18 +8150,39 @@ libc_math_function(
     ],
 )
 
-libc_math_function(name = "fmaximum")
+libc_math_function(
+    name = "fmaximum",
+    additional_deps = [
+        ":__support_math_fmaximum",
+    ],
+)
 
-libc_math_function(name = "fmaximumf")
+libc_math_function(
+    name = "fmaximumf",
+    additional_deps = [
+        ":__support_math_fmaximumf",
+    ],
+)
 
-libc_math_function(name = "fmaximuml")
+libc_math_function(
+    name = "fmaximuml",
+    additional_deps = [
+        ":__support_math_fmaximuml",
+    ],
+)
 
 libc_math_function(
     name = "fmaximumf128",
+    additional_deps = [
+        ":__support_math_fmaximumf128",
+    ],
 )
 
 libc_math_function(
     name = "fmaximumf16",
+    additional_deps = [
+        ":__support_math_fmaximumf16",
+    ],
 )
 
 libc_math_function(name = "fmaximum_mag")
@@ -8109,18 +8258,39 @@ libc_math_function(
     name = "fminf16",
 )
 
-libc_math_function(name = "fminimum")
+libc_math_function(
+    name = "fminimum",
+    additional_deps = [
+        ":__support_math_fminimum",
+    ],
+)
 
-libc_math_function(name = "fminimumf")
+libc_math_function(
+    name = "fminimumf",
+    additional_deps = [
+        ":__support_math_fminimumf",
+    ],
+)
 
-libc_math_function(name = "fminimuml")
+libc_math_function(
+    name = "fminimuml",
+    additional_deps = [
+        ":__support_math_fminimuml",
+    ],
+)
 
 libc_math_function(
     name = "fminimumf128",
+    additional_deps = [
+        ":__support_math_fminimumf128",
+    ],
 )
 
 libc_math_function(
     name = "fminimumf16",
+    additional_deps = [
+        ":__support_math_fminimumf16",
+    ],
 )
 
 libc_math_function(name = "fminimum_mag")



More information about the libc-commits mailing list