[libc-commits] [libc] [llvm] [libc][math] Refactor fmaximum-mag-num-fminimum-mag-num family to header-only (PR #195415)
via libc-commits
libc-commits at lists.llvm.org
Fri May 1 22:36:06 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libc
Author: Anonmiraj (AnonMiraj)
<details>
<summary>Changes</summary>
Refactors the fmaximum-mag-num-fminimum-mag-num math family to be header-only.
part of: #<!-- -->147386
Target Functions:
- fmaximum_mag_numf128
- fmaximum_mag_numf16
- fmaximum_mag_numl
- fminimum_mag_num
- fminimum_mag_numbf16
- fminimum_mag_numf
- fminimum_mag_numf128
- fminimum_mag_numf16
- fminimum_mag_numl
---
Patch is 45.48 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/195415.diff
35 Files Affected:
- (modified) libc/shared/math.h (+9)
- (added) libc/shared/math/fmaximum_mag_numf128.h (+29)
- (added) libc/shared/math/fmaximum_mag_numf16.h (+29)
- (added) libc/shared/math/fmaximum_mag_numl.h (+23)
- (added) libc/shared/math/fminimum_mag_num.h (+23)
- (added) libc/shared/math/fminimum_mag_numbf16.h (+23)
- (added) libc/shared/math/fminimum_mag_numf.h (+23)
- (added) libc/shared/math/fminimum_mag_numf128.h (+29)
- (added) libc/shared/math/fminimum_mag_numf16.h (+29)
- (added) libc/shared/math/fminimum_mag_numl.h (+23)
- (modified) libc/src/__support/FPUtil/BasicOperations.h (+1-1)
- (modified) libc/src/__support/math/CMakeLists.txt (+88)
- (added) libc/src/__support/math/fmaximum_mag_numf128.h (+31)
- (added) libc/src/__support/math/fmaximum_mag_numf16.h (+31)
- (added) libc/src/__support/math/fmaximum_mag_numl.h (+26)
- (added) libc/src/__support/math/fminimum_mag_num.h (+25)
- (added) libc/src/__support/math/fminimum_mag_numbf16.h (+26)
- (added) libc/src/__support/math/fminimum_mag_numf.h (+25)
- (added) libc/src/__support/math/fminimum_mag_numf128.h (+31)
- (added) libc/src/__support/math/fminimum_mag_numf16.h (+31)
- (added) libc/src/__support/math/fminimum_mag_numl.h (+26)
- (modified) libc/src/math/generic/CMakeLists.txt (+9-18)
- (modified) libc/src/math/generic/fmaximum_mag_numf128.cpp (+2-4)
- (modified) libc/src/math/generic/fmaximum_mag_numf16.cpp (+2-4)
- (modified) libc/src/math/generic/fmaximum_mag_numl.cpp (+2-4)
- (modified) libc/src/math/generic/fminimum_mag_num.cpp (+2-4)
- (modified) libc/src/math/generic/fminimum_mag_numbf16.cpp (+2-5)
- (modified) libc/src/math/generic/fminimum_mag_numf.cpp (+2-4)
- (modified) libc/src/math/generic/fminimum_mag_numf128.cpp (+2-4)
- (modified) libc/src/math/generic/fminimum_mag_numf16.cpp (+2-4)
- (modified) libc/src/math/generic/fminimum_mag_numl.cpp (+2-4)
- (modified) libc/test/shared/CMakeLists.txt (+18)
- (modified) libc/test/shared/shared_math_constexpr_test.cpp (+17)
- (modified) libc/test/shared/shared_math_test.cpp (+14)
- (modified) utils/bazel/llvm-project-overlay/libc/BUILD.bazel (+129-4)
``````````diff
diff --git a/libc/shared/math.h b/libc/shared/math.h
index b5fd88dd026f5..7ee760ed2c156 100644
--- a/libc/shared/math.h
+++ b/libc/shared/math.h
@@ -182,6 +182,9 @@
#include "math/fmaximum_mag_num.h"
#include "math/fmaximum_mag_numbf16.h"
#include "math/fmaximum_mag_numf.h"
+#include "math/fmaximum_mag_numf128.h"
+#include "math/fmaximum_mag_numf16.h"
+#include "math/fmaximum_mag_numl.h"
#include "math/fmaximum_magbf16.h"
#include "math/fmaximum_magf.h"
#include "math/fmaximum_magf128.h"
@@ -206,6 +209,12 @@
#include "math/fminf16.h"
#include "math/fminimum.h"
#include "math/fminimum_mag.h"
+#include "math/fminimum_mag_num.h"
+#include "math/fminimum_mag_numbf16.h"
+#include "math/fminimum_mag_numf.h"
+#include "math/fminimum_mag_numf128.h"
+#include "math/fminimum_mag_numf16.h"
+#include "math/fminimum_mag_numl.h"
#include "math/fminimum_magbf16.h"
#include "math/fminimum_magf.h"
#include "math/fminimum_magf128.h"
diff --git a/libc/shared/math/fmaximum_mag_numf128.h b/libc/shared/math/fmaximum_mag_numf128.h
new file mode 100644
index 0000000000000..26fcc8e1db585
--- /dev/null
+++ b/libc/shared/math/fmaximum_mag_numf128.h
@@ -0,0 +1,29 @@
+//===-- Shared fmaximum_mag_numf128 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_NUMF128_H
+#define LLVM_LIBC_SHARED_MATH_FMAXIMUM_MAG_NUMF128_H
+
+#include "include/llvm-libc-types/float128.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT128
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fmaximum_mag_numf128.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fmaximum_mag_numf128;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT128
+
+#endif // LLVM_LIBC_SHARED_MATH_FMAXIMUM_MAG_NUMF128_H
diff --git a/libc/shared/math/fmaximum_mag_numf16.h b/libc/shared/math/fmaximum_mag_numf16.h
new file mode 100644
index 0000000000000..db5861c0222f0
--- /dev/null
+++ b/libc/shared/math/fmaximum_mag_numf16.h
@@ -0,0 +1,29 @@
+//===-- Shared fmaximum_mag_numf16 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_NUMF16_H
+#define LLVM_LIBC_SHARED_MATH_FMAXIMUM_MAG_NUMF16_H
+
+#include "include/llvm-libc-macros/float16-macros.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT16
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fmaximum_mag_numf16.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fmaximum_mag_numf16;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT16
+
+#endif // LLVM_LIBC_SHARED_MATH_FMAXIMUM_MAG_NUMF16_H
diff --git a/libc/shared/math/fmaximum_mag_numl.h b/libc/shared/math/fmaximum_mag_numl.h
new file mode 100644
index 0000000000000..359d19323a102
--- /dev/null
+++ b/libc/shared/math/fmaximum_mag_numl.h
@@ -0,0 +1,23 @@
+//===-- Shared fmaximum_mag_numl 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_NUML_H
+#define LLVM_LIBC_SHARED_MATH_FMAXIMUM_MAG_NUML_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fmaximum_mag_numl.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fmaximum_mag_numl;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_FMAXIMUM_MAG_NUML_H
diff --git a/libc/shared/math/fminimum_mag_num.h b/libc/shared/math/fminimum_mag_num.h
new file mode 100644
index 0000000000000..74944eec036ed
--- /dev/null
+++ b/libc/shared/math/fminimum_mag_num.h
@@ -0,0 +1,23 @@
+//===-- Shared fminimum_mag_num function ------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_MATH_FMINIMUM_MAG_NUM_H
+#define LLVM_LIBC_SHARED_MATH_FMINIMUM_MAG_NUM_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fminimum_mag_num.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fminimum_mag_num;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_FMINIMUM_MAG_NUM_H
diff --git a/libc/shared/math/fminimum_mag_numbf16.h b/libc/shared/math/fminimum_mag_numbf16.h
new file mode 100644
index 0000000000000..4e17a99b016c0
--- /dev/null
+++ b/libc/shared/math/fminimum_mag_numbf16.h
@@ -0,0 +1,23 @@
+//===-- Shared fminimum_mag_numbf16 function --------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_MATH_FMINIMUM_MAG_NUMBF16_H
+#define LLVM_LIBC_SHARED_MATH_FMINIMUM_MAG_NUMBF16_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fminimum_mag_numbf16.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fminimum_mag_numbf16;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_FMINIMUM_MAG_NUMBF16_H
diff --git a/libc/shared/math/fminimum_mag_numf.h b/libc/shared/math/fminimum_mag_numf.h
new file mode 100644
index 0000000000000..cf7824634a356
--- /dev/null
+++ b/libc/shared/math/fminimum_mag_numf.h
@@ -0,0 +1,23 @@
+//===-- Shared fminimum_mag_numf function -----------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_MATH_FMINIMUM_MAG_NUMF_H
+#define LLVM_LIBC_SHARED_MATH_FMINIMUM_MAG_NUMF_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fminimum_mag_numf.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fminimum_mag_numf;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_FMINIMUM_MAG_NUMF_H
diff --git a/libc/shared/math/fminimum_mag_numf128.h b/libc/shared/math/fminimum_mag_numf128.h
new file mode 100644
index 0000000000000..3a386602c9fd8
--- /dev/null
+++ b/libc/shared/math/fminimum_mag_numf128.h
@@ -0,0 +1,29 @@
+//===-- Shared fminimum_mag_numf128 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_NUMF128_H
+#define LLVM_LIBC_SHARED_MATH_FMINIMUM_MAG_NUMF128_H
+
+#include "include/llvm-libc-types/float128.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT128
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fminimum_mag_numf128.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fminimum_mag_numf128;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT128
+
+#endif // LLVM_LIBC_SHARED_MATH_FMINIMUM_MAG_NUMF128_H
diff --git a/libc/shared/math/fminimum_mag_numf16.h b/libc/shared/math/fminimum_mag_numf16.h
new file mode 100644
index 0000000000000..5ab40512aeb62
--- /dev/null
+++ b/libc/shared/math/fminimum_mag_numf16.h
@@ -0,0 +1,29 @@
+//===-- Shared fminimum_mag_numf16 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_NUMF16_H
+#define LLVM_LIBC_SHARED_MATH_FMINIMUM_MAG_NUMF16_H
+
+#include "include/llvm-libc-macros/float16-macros.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT16
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fminimum_mag_numf16.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fminimum_mag_numf16;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT16
+
+#endif // LLVM_LIBC_SHARED_MATH_FMINIMUM_MAG_NUMF16_H
diff --git a/libc/shared/math/fminimum_mag_numl.h b/libc/shared/math/fminimum_mag_numl.h
new file mode 100644
index 0000000000000..6d0b534306540
--- /dev/null
+++ b/libc/shared/math/fminimum_mag_numl.h
@@ -0,0 +1,23 @@
+//===-- Shared fminimum_mag_numl 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_NUML_H
+#define LLVM_LIBC_SHARED_MATH_FMINIMUM_MAG_NUML_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fminimum_mag_numl.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fminimum_mag_numl;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_FMINIMUM_MAG_NUML_H
diff --git a/libc/src/__support/FPUtil/BasicOperations.h b/libc/src/__support/FPUtil/BasicOperations.h
index e9a357c53a670..2cbb1f8a04ee7 100644
--- a/libc/src/__support/FPUtil/BasicOperations.h
+++ b/libc/src/__support/FPUtil/BasicOperations.h
@@ -248,7 +248,7 @@ LIBC_INLINE constexpr T fmaximum_mag_num(T x, T y) {
}
template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
-LIBC_INLINE T fminimum_mag_num(T x, T y) {
+LIBC_INLINE constexpr T fminimum_mag_num(T x, T y) {
FPBits<T> bitx(x), bity(y);
if (abs(x) < abs(y))
diff --git a/libc/src/__support/math/CMakeLists.txt b/libc/src/__support/math/CMakeLists.txt
index eb36df1e823c9..9c7338995226c 100644
--- a/libc/src/__support/math/CMakeLists.txt
+++ b/libc/src/__support/math/CMakeLists.txt
@@ -954,6 +954,35 @@ add_header_library(
libc.src.__support.macros.config
)
+add_header_library(
+ fmaximum_mag_numf128
+ HDRS
+ fmaximum_mag_numf128.h
+ DEPENDS
+ libc.include.llvm-libc-types.float128
+ libc.src.__support.FPUtil.basic_operations
+ libc.src.__support.macros.config
+)
+
+add_header_library(
+ fmaximum_mag_numf16
+ HDRS
+ fmaximum_mag_numf16.h
+ DEPENDS
+ libc.include.llvm-libc-macros.float16_macros
+ libc.src.__support.FPUtil.basic_operations
+ libc.src.__support.macros.config
+)
+
+add_header_library(
+ fmaximum_mag_numl
+ HDRS
+ fmaximum_mag_numl.h
+ DEPENDS
+ libc.src.__support.FPUtil.basic_operations
+ libc.src.__support.macros.config
+)
+
add_header_library(
fmaximum_num
HDRS
@@ -1201,6 +1230,65 @@ add_header_library(
libc.src.__support.macros.config
)
+add_header_library(
+ fminimum_mag_num
+ HDRS
+ fminimum_mag_num.h
+ DEPENDS
+ libc.src.__support.FPUtil.basic_operations
+ libc.src.__support.macros.config
+)
+
+add_header_library(
+ fminimum_mag_numbf16
+ HDRS
+ fminimum_mag_numbf16.h
+ DEPENDS
+ libc.src.__support.FPUtil.basic_operations
+ libc.src.__support.FPUtil.bfloat16
+ libc.src.__support.macros.config
+ FLAGS
+ MISC_MATH_BASIC_OPS_OPT
+)
+
+add_header_library(
+ fminimum_mag_numf
+ HDRS
+ fminimum_mag_numf.h
+ DEPENDS
+ libc.src.__support.FPUtil.basic_operations
+ libc.src.__support.macros.config
+)
+
+add_header_library(
+ fminimum_mag_numf128
+ HDRS
+ fminimum_mag_numf128.h
+ DEPENDS
+ libc.include.llvm-libc-types.float128
+ libc.src.__support.FPUtil.basic_operations
+ libc.src.__support.macros.config
+)
+
+add_header_library(
+ fminimum_mag_numf16
+ HDRS
+ fminimum_mag_numf16.h
+ DEPENDS
+ libc.include.llvm-libc-macros.float16_macros
+ libc.src.__support.FPUtil.basic_operations
+ libc.src.__support.macros.config
+)
+
+add_header_library(
+ fminimum_mag_numl
+ HDRS
+ fminimum_mag_numl.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_numf128.h b/libc/src/__support/math/fmaximum_mag_numf128.h
new file mode 100644
index 0000000000000..656ef803559bb
--- /dev/null
+++ b/libc/src/__support/math/fmaximum_mag_numf128.h
@@ -0,0 +1,31 @@
+//===-- Implementation header for fmaximum_mag_numf128 ----------*- 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_NUMF128_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FMAXIMUM_MAG_NUMF128_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_mag_numf128(float128 x, float128 y) {
+ return fputil::fmaximum_mag_num(x, y);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT128
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FMAXIMUM_MAG_NUMF128_H
diff --git a/libc/src/__support/math/fmaximum_mag_numf16.h b/libc/src/__support/math/fmaximum_mag_numf16.h
new file mode 100644
index 0000000000000..f321f62746ee1
--- /dev/null
+++ b/libc/src/__support/math/fmaximum_mag_numf16.h
@@ -0,0 +1,31 @@
+//===-- Implementation header for fmaximum_mag_numf16 -----------*- 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_NUMF16_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FMAXIMUM_MAG_NUMF16_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_mag_numf16(float16 x, float16 y) {
+ return fputil::fmaximum_mag_num(x, y);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT16
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FMAXIMUM_MAG_NUMF16_H
diff --git a/libc/src/__support/math/fmaximum_mag_numl.h b/libc/src/__support/math/fmaximum_mag_numl.h
new file mode 100644
index 0000000000000..c96ff362ea004
--- /dev/null
+++ b/libc/src/__support/math/fmaximum_mag_numl.h
@@ -0,0 +1,26 @@
+//===-- Implementation header for fmaximum_mag_numl -------------*- 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_NUML_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FMAXIMUM_MAG_NUML_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_mag_numl(long double x,
+ long double y) {
+ return fputil::fmaximum_mag_num(x, y);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FMAXIMUM_MAG_NUML_H
diff --git a/libc/src/__support/math/fminimum_mag_num.h b/libc/src/__support/math/fminimum_mag_num.h
new file mode 100644
index 0000000000000..0c6a73b259ea6
--- /dev/null
+++ b/libc/src/__support/math/fminimum_mag_num.h
@@ -0,0 +1,25 @@
+//===-- Implementation header for fminimum_mag_num --------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC___SUPPORT_MATH_FMINIMUM_MAG_NUM_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FMINIMUM_MAG_NUM_H
+
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace math {
+
+LIBC_INLINE constexpr double fminimum_mag_num(double x, double y) {
+ return fputil::fminimum_mag_num(x, y);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FMINIMUM_MAG_NUM_H
diff --git a/libc/src/__support/math/fminimum_mag_numbf16.h b/libc/src/__support/math/fminimum_mag_numbf16.h
new file mode 100644
index 0000000000000..cd876873576ae
--- /dev/null
+++ b/libc/src/__support/math/fminimum_mag_numbf16.h
@@ -0,0 +1,26 @@
+//===-- Implementation header for fminimum_mag_numbf16 ----------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC___SUPPORT_MATH_FMINIMUM_MAG_NUMBF16_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FMINIMUM_MAG_NUMBF16_H
+
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/FPUtil/bfloat16.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace math {
+
+LIBC_INLINE constexpr bfloat16 fminimum_mag_numbf16(bfloat16 x, bfloat16 y) {
+ return fputil::fminimum_mag_num(x, y);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FMINIMUM_MAG_NUMBF16_H
diff --git a/libc/src/__support/math/fminimum_mag_numf.h b/libc/src/__support/math/fminimum_mag_numf.h
new file mode 100644
index 0000000000000..0c9eba2571fe7
--- /dev/null
+++ b/libc/src/__support/math/fminimum_mag_numf.h
@@ -0,0 +1,25 @@
+//===-- Implementation header for fminimum_mag_numf -------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC___SUPPORT_MATH_FMINIMUM_MAG_NUMF_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FMINIMUM_MAG_NUMF_H
+
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace math {
+
+LIBC_INLINE constexpr float fminimum_mag_numf(float x, float y) {
+ return fputil::fminimum_mag_num(x, y);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FM...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/195415
More information about the libc-commits
mailing list