[libc-commits] [libc] [llvm] [libc][math] Refactor fmin family to header-only (PR #194549)

via libc-commits libc-commits at lists.llvm.org
Mon Apr 27 23:08:58 PDT 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Anonmiraj (AnonMiraj)

<details>
<summary>Changes</summary>

Refactors the fmin math family to be header-only.

part of: #<!-- -->147386

Target Functions:
  - fmin
  - fminbf16
  - fminf
  - fminf128
  - fminf16
  - fminl

---

Patch is 30.39 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/194549.diff


25 Files Affected:

- (modified) libc/shared/math.h (+6) 
- (added) libc/shared/math/fmin.h (+23) 
- (added) libc/shared/math/fminbf16.h (+23) 
- (added) libc/shared/math/fminf.h (+23) 
- (added) libc/shared/math/fminf128.h (+29) 
- (added) libc/shared/math/fminf16.h (+29) 
- (added) libc/shared/math/fminl.h (+23) 
- (modified) libc/src/__support/FPUtil/BasicOperations.h (+1-1) 
- (modified) libc/src/__support/math/CMakeLists.txt (+65) 
- (added) libc/src/__support/math/fmin.h (+25) 
- (added) libc/src/__support/math/fminbf16.h (+26) 
- (added) libc/src/__support/math/fminf.h (+25) 
- (added) libc/src/__support/math/fminf128.h (+31) 
- (added) libc/src/__support/math/fminf16.h (+31) 
- (added) libc/src/__support/math/fminl.h (+25) 
- (modified) libc/src/math/generic/CMakeLists.txt (+6-20) 
- (modified) libc/src/math/generic/fmin.cpp (+2-4) 
- (modified) libc/src/math/generic/fminbf16.cpp (+2-5) 
- (modified) libc/src/math/generic/fminf.cpp (+2-4) 
- (modified) libc/src/math/generic/fminf128.cpp (+2-4) 
- (modified) libc/src/math/generic/fminf16.cpp (+2-4) 
- (modified) libc/src/math/generic/fminl.cpp (+2-4) 
- (modified) libc/test/shared/CMakeLists.txt (+12) 
- (modified) libc/test/shared/shared_math_constexpr_test.cpp (+8) 
- (modified) libc/test/shared/shared_math_test.cpp (+8) 
- (modified) utils/bazel/llvm-project-overlay/libc/BUILD.bazel (+88-3) 


``````````diff
diff --git a/libc/shared/math.h b/libc/shared/math.h
index 90c4f7397b79a..a2a2bddd3576e 100644
--- a/libc/shared/math.h
+++ b/libc/shared/math.h
@@ -186,12 +186,18 @@
 #include "math/fmaximumf16.h"
 #include "math/fmaximuml.h"
 #include "math/fmaxl.h"
+#include "math/fmin.h"
+#include "math/fminbf16.h"
+#include "math/fminf.h"
+#include "math/fminf128.h"
+#include "math/fminf16.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/fminl.h"
 #include "math/frexpf.h"
 #include "math/frexpf128.h"
 #include "math/frexpf16.h"
diff --git a/libc/shared/math/fmin.h b/libc/shared/math/fmin.h
new file mode 100644
index 0000000000000..3266b6650f653
--- /dev/null
+++ b/libc/shared/math/fmin.h
@@ -0,0 +1,23 @@
+//===-- Shared fmin 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_FMIN_H
+#define LLVM_LIBC_SHARED_MATH_FMIN_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fmin.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fmin;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_FMIN_H
diff --git a/libc/shared/math/fminbf16.h b/libc/shared/math/fminbf16.h
new file mode 100644
index 0000000000000..b8660cb72d39c
--- /dev/null
+++ b/libc/shared/math/fminbf16.h
@@ -0,0 +1,23 @@
+//===-- Shared fminbf16 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_FMINBF16_H
+#define LLVM_LIBC_SHARED_MATH_FMINBF16_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fminbf16.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fminbf16;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_FMINBF16_H
diff --git a/libc/shared/math/fminf.h b/libc/shared/math/fminf.h
new file mode 100644
index 0000000000000..aa6c04fb8c154
--- /dev/null
+++ b/libc/shared/math/fminf.h
@@ -0,0 +1,23 @@
+//===-- Shared fminf 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_FMINF_H
+#define LLVM_LIBC_SHARED_MATH_FMINF_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fminf.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fminf;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_FMINF_H
diff --git a/libc/shared/math/fminf128.h b/libc/shared/math/fminf128.h
new file mode 100644
index 0000000000000..2970bc3fd1c4c
--- /dev/null
+++ b/libc/shared/math/fminf128.h
@@ -0,0 +1,29 @@
+//===-- Shared fminf128 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_FMINF128_H
+#define LLVM_LIBC_SHARED_MATH_FMINF128_H
+
+#include "include/llvm-libc-types/float128.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT128
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fminf128.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fminf128;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT128
+
+#endif // LLVM_LIBC_SHARED_MATH_FMINF128_H
diff --git a/libc/shared/math/fminf16.h b/libc/shared/math/fminf16.h
new file mode 100644
index 0000000000000..c9be529060c0d
--- /dev/null
+++ b/libc/shared/math/fminf16.h
@@ -0,0 +1,29 @@
+//===-- Shared fminf16 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_FMINF16_H
+#define LLVM_LIBC_SHARED_MATH_FMINF16_H
+
+#include "include/llvm-libc-macros/float16-macros.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT16
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fminf16.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fminf16;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT16
+
+#endif // LLVM_LIBC_SHARED_MATH_FMINF16_H
diff --git a/libc/shared/math/fminl.h b/libc/shared/math/fminl.h
new file mode 100644
index 0000000000000..cef534ff287e7
--- /dev/null
+++ b/libc/shared/math/fminl.h
@@ -0,0 +1,23 @@
+//===-- Shared fminl 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_FMINL_H
+#define LLVM_LIBC_SHARED_MATH_FMINL_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fminl.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fminl;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_FMINL_H
diff --git a/libc/src/__support/FPUtil/BasicOperations.h b/libc/src/__support/FPUtil/BasicOperations.h
index 7587439d4eb05..bbdba52e129cf 100644
--- a/libc/src/__support/FPUtil/BasicOperations.h
+++ b/libc/src/__support/FPUtil/BasicOperations.h
@@ -141,7 +141,7 @@ template <> LIBC_INLINE constexpr double min(double x, double y) {
 } // namespace internal
 
 template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
-LIBC_INLINE T fmin(T x, T y) {
+LIBC_INLINE constexpr T fmin(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 dd9c350c507d9..a1ffac95a3434 100644
--- a/libc/src/__support/math/CMakeLists.txt
+++ b/libc/src/__support/math/CMakeLists.txt
@@ -883,6 +883,62 @@ add_header_library(
     libc.src.__support.FPUtil.basic_operations
     libc.src.__support.macros.config
 )
+add_header_library(
+  fmin
+  HDRS
+    fmin.h
+  DEPENDS
+    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.macros.config
+  FLAGS
+    MISC_MATH_BASIC_OPS_OPT
+)
+
+add_header_library(
+  fminbf16
+  HDRS
+    fminbf16.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(
+  fminf
+  HDRS
+    fminf.h
+  DEPENDS
+    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.macros.config
+  FLAGS
+    MISC_MATH_BASIC_OPS_OPT
+)
+
+add_header_library(
+  fminf128
+  HDRS
+    fminf128.h
+  DEPENDS
+    libc.include.llvm-libc-types.float128
+    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.macros.config
+)
+
+add_header_library(
+  fminf16
+  HDRS
+    fminf16.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(
   fminimum
@@ -949,6 +1005,15 @@ add_header_library(
     libc.src.__support.macros.config
 )
 
+add_header_library(
+  fminl
+  HDRS
+    fminl.h
+  DEPENDS
+    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.macros.config
+)
+
 
 add_header_library(
   llogbbf16
diff --git a/libc/src/__support/math/fmin.h b/libc/src/__support/math/fmin.h
new file mode 100644
index 0000000000000..5bce93c1e7488
--- /dev/null
+++ b/libc/src/__support/math/fmin.h
@@ -0,0 +1,25 @@
+//===-- Implementation header for fmin --------------------------*- 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_FMIN_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FMIN_H
+
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace math {
+
+LIBC_INLINE constexpr double fmin(double x, double y) {
+  return fputil::fmin(x, y);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FMIN_H
diff --git a/libc/src/__support/math/fminbf16.h b/libc/src/__support/math/fminbf16.h
new file mode 100644
index 0000000000000..c7b1f89398dd5
--- /dev/null
+++ b/libc/src/__support/math/fminbf16.h
@@ -0,0 +1,26 @@
+//===-- Implementation header for fminbf16 ----------------------*- 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_FMINBF16_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FMINBF16_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 fminbf16(bfloat16 x, bfloat16 y) {
+  return fputil::fmin(x, y);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FMINBF16_H
diff --git a/libc/src/__support/math/fminf.h b/libc/src/__support/math/fminf.h
new file mode 100644
index 0000000000000..9280e77000929
--- /dev/null
+++ b/libc/src/__support/math/fminf.h
@@ -0,0 +1,25 @@
+//===-- Implementation header for fminf -------------------------*- 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_FMINF_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FMINF_H
+
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace math {
+
+LIBC_INLINE constexpr float fminf(float x, float y) {
+  return fputil::fmin(x, y);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FMINF_H
diff --git a/libc/src/__support/math/fminf128.h b/libc/src/__support/math/fminf128.h
new file mode 100644
index 0000000000000..ccea1a7ee11d5
--- /dev/null
+++ b/libc/src/__support/math/fminf128.h
@@ -0,0 +1,31 @@
+//===-- Implementation header for fminf128 ----------------------*- 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_FMINF128_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FMINF128_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 fminf128(float128 x, float128 y) {
+  return fputil::fmin(x, y);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT128
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FMINF128_H
diff --git a/libc/src/__support/math/fminf16.h b/libc/src/__support/math/fminf16.h
new file mode 100644
index 0000000000000..f379688b3da8d
--- /dev/null
+++ b/libc/src/__support/math/fminf16.h
@@ -0,0 +1,31 @@
+//===-- Implementation header for fminf16 -----------------------*- 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_FMINF16_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FMINF16_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 fminf16(float16 x, float16 y) {
+  return fputil::fmin(x, y);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT16
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FMINF16_H
diff --git a/libc/src/__support/math/fminl.h b/libc/src/__support/math/fminl.h
new file mode 100644
index 0000000000000..0a87782d20da7
--- /dev/null
+++ b/libc/src/__support/math/fminl.h
@@ -0,0 +1,25 @@
+//===-- Implementation header for fminl -------------------------*- 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_FMINL_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FMINL_H
+
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace math {
+
+LIBC_INLINE constexpr long double fminl(long double x, long double y) {
+  return fputil::fmin(x, y);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FMINL_H
diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt
index dce67f3929288..b29110cca7062 100644
--- a/libc/src/math/generic/CMakeLists.txt
+++ b/libc/src/math/generic/CMakeLists.txt
@@ -2068,9 +2068,7 @@ add_entrypoint_object(
   HDRS
     ../fmin.h
   DEPENDS
-    libc.src.__support.FPUtil.basic_operations
-  FLAGS
-    MISC_MATH_BASIC_OPS_OPT
+    libc.src.__support.math.fmin
 )
 
 add_entrypoint_object(
@@ -2080,9 +2078,7 @@ add_entrypoint_object(
   HDRS
     ../fminf.h
   DEPENDS
-    libc.src.__support.FPUtil.basic_operations
-  FLAGS
-    MISC_MATH_BASIC_OPS_OPT
+    libc.src.__support.math.fminf
 )
 
 add_entrypoint_object(
@@ -2092,7 +2088,7 @@ add_entrypoint_object(
   HDRS
     ../fminl.h
   DEPENDS
-    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.math.fminl
 )
 
 add_entrypoint_object(
@@ -2102,8 +2098,7 @@ add_entrypoint_object(
   HDRS
     ../fminf128.h
   DEPENDS
-    libc.src.__support.macros.properties.types
-    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.math.fminf128
 )
 
 add_entrypoint_object(
@@ -2113,10 +2108,7 @@ add_entrypoint_object(
   HDRS
     ../fminf16.h
   DEPENDS
-    libc.src.__support.macros.properties.types
-    libc.src.__support.FPUtil.basic_operations
-  FLAGS
-    MISC_MATH_BASIC_OPS_OPT
+    libc.src.__support.math.fminf16
 )
 
 add_entrypoint_object(
@@ -2126,13 +2118,7 @@ add_entrypoint_object(
   HDRS
     ../fminbf16.h
   DEPENDS
-    libc.src.__support.common
-    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.fminbf16
 )
 
 add_entrypoint_object(
diff --git a/libc/src/math/generic/fmin.cpp b/libc/src/math/generic/fmin.cpp
index 2351874029c72..b3bb623dc414b 100644
--- a/libc/src/math/generic/fmin.cpp
+++ b/libc/src/math/generic/fmin.cpp
@@ -7,14 +7,12 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/fmin.h"
-#include "src/__support/FPUtil/BasicOperations.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/fmin.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(double, fmin, (double x, double y)) {
-  return fputil::fmin(x, y);
+  return math::fmin(x, y);
 }
 
 } // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/fminbf16.cpp b/libc/src/math/generic/fminbf16.cpp
index c3e29ee10c8b6..514f38f55cacd 100644
--- a/libc/src/math/generic/fminbf16.cpp
+++ b/libc/src/math/generic/fminbf16.cpp
@@ -7,15 +7,12 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/fminbf16.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/fminbf16.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(bfloat16, fminbf16, (bfloat16 x, bfloat16 y)) {
-  return fputil::fmin(x, y);
+  return math::fminbf16(x, y);
 }
 
 } // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/fminf.cpp b/libc/src/math/generic/fminf.cpp
index 83dd0aa66b54a..495f2d1f9cfba 100644
--- a/libc/src/math/generic/fminf.cpp
+++ b/libc/src/math/generic/fminf.cpp
@@ -7,14 +7,12 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/fminf.h"
-#include "src/__support/FPUtil/BasicOperations.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/fminf.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(float, fminf, (float x, float y)) {
-  return fputil::fmin(x, y);
+  return math::fminf(x, y);
 }
 
 } // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/fminf128.cpp b/libc/src/math/generic/fminf128.cpp
index 184b7e3c21532..fa5591ad5941e 100644
--- a/libc/src/math/generic/fminf128.cpp
+++ b/libc/src/math/generic/fminf128.cpp
@@ -7,14 +7,12 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/fminf128.h"
-#include "src/__support/FPUtil/BasicOperations.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/fminf128.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(float128, fminf128, (float128 x, float128 y)) {
-  return fputil::fmin(x, y);
+  return math::fminf128(x, y);
 }
 
 } // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/fminf16.cpp b/libc/src/math/generic/fminf16.cpp
index 8b69273a906ec..00ff5dd6138fb 100644
--- a/libc/src/math/generic/fminf16.cpp
+++ b/libc/src/math/generic/fminf16.cpp
@@ -7,14 +7,12 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/fminf16.h"
-#include "src/__support/FPUtil/BasicOperations.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/fminf16.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(float16, fminf16, (float16 x, float16 y)) {
-  return fputil::fmin(x, y);
+  return math::fminf16(x, y);
 }
 
 } // names...
[truncated]

``````````

</details>


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


More information about the libc-commits mailing list