[libc-commits] [libc] [llvm] [libc][math] Refactor fmaximum-mag-fminimum-mag family to header-only (PR #195394)
via libc-commits
libc-commits at lists.llvm.org
Fri May 1 17:59:34 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-fminimum-mag math family to be header-only.
part of: #<!-- -->147386
Target Functions:
- fmaximum_mag
- fmaximum_magbf16
- fmaximum_magf
- fmaximum_magf128
- fmaximum_magf16
- fmaximum_magl
- fminimum_mag
- fminimum_magbf16
- fminimum_magf
- fminimum_magf128
- fminimum_magf16
- fminimum_magl
---
Patch is 57.53 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/195394.diff
44 Files Affected:
- (modified) libc/shared/math.h (+12)
- (added) libc/shared/math/fmaximum_mag.h (+23)
- (added) libc/shared/math/fmaximum_magbf16.h (+23)
- (added) libc/shared/math/fmaximum_magf.h (+23)
- (added) libc/shared/math/fmaximum_magf128.h (+29)
- (added) libc/shared/math/fmaximum_magf16.h (+29)
- (added) libc/shared/math/fmaximum_magl.h (+23)
- (added) libc/shared/math/fminimum_mag.h (+23)
- (added) libc/shared/math/fminimum_magbf16.h (+23)
- (added) libc/shared/math/fminimum_magf.h (+23)
- (added) libc/shared/math/fminimum_magf128.h (+29)
- (added) libc/shared/math/fminimum_magf16.h (+29)
- (added) libc/shared/math/fminimum_magl.h (+23)
- (modified) libc/src/__support/FPUtil/BasicOperations.h (+2-2)
- (modified) libc/src/__support/math/CMakeLists.txt (+118)
- (added) libc/src/__support/math/fmaximum_mag.h (+25)
- (added) libc/src/__support/math/fmaximum_magbf16.h (+26)
- (added) libc/src/__support/math/fmaximum_magf.h (+25)
- (added) libc/src/__support/math/fmaximum_magf128.h (+31)
- (added) libc/src/__support/math/fmaximum_magf16.h (+31)
- (added) libc/src/__support/math/fmaximum_magl.h (+25)
- (added) libc/src/__support/math/fminimum_mag.h (+25)
- (added) libc/src/__support/math/fminimum_magbf16.h (+26)
- (added) libc/src/__support/math/fminimum_magf.h (+25)
- (added) libc/src/__support/math/fminimum_magf128.h (+31)
- (added) libc/src/__support/math/fminimum_magf16.h (+31)
- (added) libc/src/__support/math/fminimum_magl.h (+25)
- (modified) libc/src/math/generic/CMakeLists.txt (+12-26)
- (modified) libc/src/math/generic/fmaximum_mag.cpp (+2-4)
- (modified) libc/src/math/generic/fmaximum_magbf16.cpp (+2-5)
- (modified) libc/src/math/generic/fmaximum_magf.cpp (+2-4)
- (modified) libc/src/math/generic/fmaximum_magf128.cpp (+2-4)
- (modified) libc/src/math/generic/fmaximum_magf16.cpp (+2-4)
- (modified) libc/src/math/generic/fmaximum_magl.cpp (+2-4)
- (modified) libc/src/math/generic/fminimum_mag.cpp (+2-4)
- (modified) libc/src/math/generic/fminimum_magbf16.cpp (+2-5)
- (modified) libc/src/math/generic/fminimum_magf.cpp (+2-4)
- (modified) libc/src/math/generic/fminimum_magf128.cpp (+2-4)
- (modified) libc/src/math/generic/fminimum_magf16.cpp (+2-4)
- (modified) libc/src/math/generic/fminimum_magl.cpp (+2-4)
- (modified) libc/test/shared/CMakeLists.txt (+24)
- (modified) libc/test/shared/shared_math_constexpr_test.cpp (+22)
- (modified) libc/test/shared/shared_math_test.cpp (+18)
- (modified) utils/bazel/llvm-project-overlay/libc/BUILD.bazel (+176-6)
``````````diff
diff --git a/libc/shared/math.h b/libc/shared/math.h
index 6d2b573244c0c..7ad8c0c68c9a9 100644
--- a/libc/shared/math.h
+++ b/libc/shared/math.h
@@ -178,9 +178,15 @@
#include "math/fmaxf128.h"
#include "math/fmaxf16.h"
#include "math/fmaximum.h"
+#include "math/fmaximum_mag.h"
#include "math/fmaximum_mag_num.h"
#include "math/fmaximum_mag_numbf16.h"
#include "math/fmaximum_mag_numf.h"
+#include "math/fmaximum_magbf16.h"
+#include "math/fmaximum_magf.h"
+#include "math/fmaximum_magf128.h"
+#include "math/fmaximum_magf16.h"
+#include "math/fmaximum_magl.h"
#include "math/fmaximum_num.h"
#include "math/fmaximum_numbf16.h"
#include "math/fmaximum_numf.h"
@@ -199,6 +205,12 @@
#include "math/fminf128.h"
#include "math/fminf16.h"
#include "math/fminimum.h"
+#include "math/fminimum_mag.h"
+#include "math/fminimum_magbf16.h"
+#include "math/fminimum_magf.h"
+#include "math/fminimum_magf128.h"
+#include "math/fminimum_magf16.h"
+#include "math/fminimum_magl.h"
#include "math/fminimum_num.h"
#include "math/fminimum_numbf16.h"
#include "math/fminimum_numf.h"
diff --git a/libc/shared/math/fmaximum_mag.h b/libc/shared/math/fmaximum_mag.h
new file mode 100644
index 0000000000000..31b2742469e7e
--- /dev/null
+++ b/libc/shared/math/fmaximum_mag.h
@@ -0,0 +1,23 @@
+//===-- Shared fmaximum_mag function ----------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_MATH_FMAXIMUM_MAG_H
+#define LLVM_LIBC_SHARED_MATH_FMAXIMUM_MAG_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fmaximum_mag.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fmaximum_mag;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_FMAXIMUM_MAG_H
diff --git a/libc/shared/math/fmaximum_magbf16.h b/libc/shared/math/fmaximum_magbf16.h
new file mode 100644
index 0000000000000..e37167c1035cc
--- /dev/null
+++ b/libc/shared/math/fmaximum_magbf16.h
@@ -0,0 +1,23 @@
+//===-- Shared fmaximum_magbf16 function ------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_MATH_FMAXIMUM_MAGBF16_H
+#define LLVM_LIBC_SHARED_MATH_FMAXIMUM_MAGBF16_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fmaximum_magbf16.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fmaximum_magbf16;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_FMAXIMUM_MAGBF16_H
diff --git a/libc/shared/math/fmaximum_magf.h b/libc/shared/math/fmaximum_magf.h
new file mode 100644
index 0000000000000..ebbcd6be18e1b
--- /dev/null
+++ b/libc/shared/math/fmaximum_magf.h
@@ -0,0 +1,23 @@
+//===-- Shared fmaximum_magf function ---------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_MATH_FMAXIMUM_MAGF_H
+#define LLVM_LIBC_SHARED_MATH_FMAXIMUM_MAGF_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fmaximum_magf.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fmaximum_magf;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_FMAXIMUM_MAGF_H
diff --git a/libc/shared/math/fmaximum_magf128.h b/libc/shared/math/fmaximum_magf128.h
new file mode 100644
index 0000000000000..4e409aa6ed0be
--- /dev/null
+++ b/libc/shared/math/fmaximum_magf128.h
@@ -0,0 +1,29 @@
+//===-- Shared fmaximum_magf128 function ------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_MATH_FMAXIMUM_MAGF128_H
+#define LLVM_LIBC_SHARED_MATH_FMAXIMUM_MAGF128_H
+
+#include "include/llvm-libc-types/float128.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT128
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fmaximum_magf128.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fmaximum_magf128;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT128
+
+#endif // LLVM_LIBC_SHARED_MATH_FMAXIMUM_MAGF128_H
diff --git a/libc/shared/math/fmaximum_magf16.h b/libc/shared/math/fmaximum_magf16.h
new file mode 100644
index 0000000000000..3a7b7ba1addea
--- /dev/null
+++ b/libc/shared/math/fmaximum_magf16.h
@@ -0,0 +1,29 @@
+//===-- Shared fmaximum_magf16 function -------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_MATH_FMAXIMUM_MAGF16_H
+#define LLVM_LIBC_SHARED_MATH_FMAXIMUM_MAGF16_H
+
+#include "include/llvm-libc-macros/float16-macros.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT16
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fmaximum_magf16.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fmaximum_magf16;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT16
+
+#endif // LLVM_LIBC_SHARED_MATH_FMAXIMUM_MAGF16_H
diff --git a/libc/shared/math/fmaximum_magl.h b/libc/shared/math/fmaximum_magl.h
new file mode 100644
index 0000000000000..c109d58621291
--- /dev/null
+++ b/libc/shared/math/fmaximum_magl.h
@@ -0,0 +1,23 @@
+//===-- Shared fmaximum_magl function ---------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_MATH_FMAXIMUM_MAGL_H
+#define LLVM_LIBC_SHARED_MATH_FMAXIMUM_MAGL_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fmaximum_magl.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fmaximum_magl;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_FMAXIMUM_MAGL_H
diff --git a/libc/shared/math/fminimum_mag.h b/libc/shared/math/fminimum_mag.h
new file mode 100644
index 0000000000000..5713d10335c0f
--- /dev/null
+++ b/libc/shared/math/fminimum_mag.h
@@ -0,0 +1,23 @@
+//===-- Shared fminimum_mag function ----------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_MATH_FMINIMUM_MAG_H
+#define LLVM_LIBC_SHARED_MATH_FMINIMUM_MAG_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fminimum_mag.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fminimum_mag;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_FMINIMUM_MAG_H
diff --git a/libc/shared/math/fminimum_magbf16.h b/libc/shared/math/fminimum_magbf16.h
new file mode 100644
index 0000000000000..efc2132109cca
--- /dev/null
+++ b/libc/shared/math/fminimum_magbf16.h
@@ -0,0 +1,23 @@
+//===-- Shared fminimum_magbf16 function ------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_MATH_FMINIMUM_MAGBF16_H
+#define LLVM_LIBC_SHARED_MATH_FMINIMUM_MAGBF16_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fminimum_magbf16.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fminimum_magbf16;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_FMINIMUM_MAGBF16_H
diff --git a/libc/shared/math/fminimum_magf.h b/libc/shared/math/fminimum_magf.h
new file mode 100644
index 0000000000000..33b9230a72a77
--- /dev/null
+++ b/libc/shared/math/fminimum_magf.h
@@ -0,0 +1,23 @@
+//===-- Shared fminimum_magf function ---------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_MATH_FMINIMUM_MAGF_H
+#define LLVM_LIBC_SHARED_MATH_FMINIMUM_MAGF_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fminimum_magf.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fminimum_magf;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_FMINIMUM_MAGF_H
diff --git a/libc/shared/math/fminimum_magf128.h b/libc/shared/math/fminimum_magf128.h
new file mode 100644
index 0000000000000..13ebd6f9404b1
--- /dev/null
+++ b/libc/shared/math/fminimum_magf128.h
@@ -0,0 +1,29 @@
+//===-- Shared fminimum_magf128 function ------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_MATH_FMINIMUM_MAGF128_H
+#define LLVM_LIBC_SHARED_MATH_FMINIMUM_MAGF128_H
+
+#include "include/llvm-libc-types/float128.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT128
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fminimum_magf128.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fminimum_magf128;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT128
+
+#endif // LLVM_LIBC_SHARED_MATH_FMINIMUM_MAGF128_H
diff --git a/libc/shared/math/fminimum_magf16.h b/libc/shared/math/fminimum_magf16.h
new file mode 100644
index 0000000000000..506dc8ac5449c
--- /dev/null
+++ b/libc/shared/math/fminimum_magf16.h
@@ -0,0 +1,29 @@
+//===-- Shared fminimum_magf16 function -------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_MATH_FMINIMUM_MAGF16_H
+#define LLVM_LIBC_SHARED_MATH_FMINIMUM_MAGF16_H
+
+#include "include/llvm-libc-macros/float16-macros.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT16
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fminimum_magf16.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fminimum_magf16;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT16
+
+#endif // LLVM_LIBC_SHARED_MATH_FMINIMUM_MAGF16_H
diff --git a/libc/shared/math/fminimum_magl.h b/libc/shared/math/fminimum_magl.h
new file mode 100644
index 0000000000000..3afe4f6ab79b2
--- /dev/null
+++ b/libc/shared/math/fminimum_magl.h
@@ -0,0 +1,23 @@
+//===-- Shared fminimum_magl function ---------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_MATH_FMINIMUM_MAGL_H
+#define LLVM_LIBC_SHARED_MATH_FMINIMUM_MAGL_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/fminimum_magl.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fminimum_magl;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_FMINIMUM_MAGL_H
diff --git a/libc/src/__support/FPUtil/BasicOperations.h b/libc/src/__support/FPUtil/BasicOperations.h
index 99e3f0d43d6cc..87168430257a2 100644
--- a/libc/src/__support/FPUtil/BasicOperations.h
+++ b/libc/src/__support/FPUtil/BasicOperations.h
@@ -215,7 +215,7 @@ LIBC_INLINE constexpr T fminimum_num(T x, T y) {
}
template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
-LIBC_INLINE T fmaximum_mag(T x, T y) {
+LIBC_INLINE constexpr T fmaximum_mag(T x, T y) {
FPBits<T> bitx(x), bity(y);
if (abs(x) > abs(y))
@@ -226,7 +226,7 @@ LIBC_INLINE T fmaximum_mag(T x, T y) {
}
template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
-LIBC_INLINE T fminimum_mag(T x, T y) {
+LIBC_INLINE constexpr T fminimum_mag(T x, T y) {
FPBits<T> bitx(x), bity(y);
if (abs(x) < abs(y))
diff --git a/libc/src/__support/math/CMakeLists.txt b/libc/src/__support/math/CMakeLists.txt
index dad34b0023154..fa33ffcafa8c1 100644
--- a/libc/src/__support/math/CMakeLists.txt
+++ b/libc/src/__support/math/CMakeLists.txt
@@ -894,6 +894,65 @@ add_header_library(
libc.src.__support.FPUtil.basic_operations
libc.src.__support.macros.config
)
+add_header_library(
+ fmaximum_mag
+ HDRS
+ fmaximum_mag.h
+ DEPENDS
+ libc.src.__support.FPUtil.basic_operations
+ libc.src.__support.macros.config
+)
+
+add_header_library(
+ fmaximum_magbf16
+ HDRS
+ fmaximum_magbf16.h
+ DEPENDS
+ libc.src.__support.FPUtil.basic_operations
+ libc.src.__support.FPUtil.bfloat16
+ libc.src.__support.macros.config
+ FLAGS
+ MISC_MATH_BASIC_OPS_OPT
+)
+
+add_header_library(
+ fmaximum_magf
+ HDRS
+ fmaximum_magf.h
+ DEPENDS
+ libc.src.__support.FPUtil.basic_operations
+ libc.src.__support.macros.config
+)
+
+add_header_library(
+ fmaximum_magf128
+ HDRS
+ fmaximum_magf128.h
+ DEPENDS
+ libc.include.llvm-libc-types.float128
+ libc.src.__support.FPUtil.basic_operations
+ libc.src.__support.macros.config
+)
+
+add_header_library(
+ fmaximum_magf16
+ HDRS
+ fmaximum_magf16.h
+ DEPENDS
+ libc.include.llvm-libc-macros.float16_macros
+ libc.src.__support.FPUtil.basic_operations
+ libc.src.__support.macros.config
+)
+
+add_header_library(
+ fmaximum_magl
+ HDRS
+ fmaximum_magl.h
+ DEPENDS
+ libc.src.__support.FPUtil.basic_operations
+ libc.src.__support.macros.config
+)
+
add_header_library(
fmaximum_num
@@ -1082,6 +1141,65 @@ add_header_library(
libc.src.__support.FPUtil.basic_operations
libc.src.__support.macros.config
)
+add_header_library(
+ fminimum_mag
+ HDRS
+ fminimum_mag.h
+ DEPENDS
+ libc.src.__support.FPUtil.basic_operations
+ libc.src.__support.macros.config
+)
+
+add_header_library(
+ fminimum_magbf16
+ HDRS
+ fminimum_magbf16.h
+ DEPENDS
+ libc.src.__support.FPUtil.basic_operations
+ libc.src.__support.FPUtil.bfloat16
+ libc.src.__support.macros.config
+ FLAGS
+ MISC_MATH_BASIC_OPS_OPT
+)
+
+add_header_library(
+ fminimum_magf
+ HDRS
+ fminimum_magf.h
+ DEPENDS
+ libc.src.__support.FPUtil.basic_operations
+ libc.src.__support.macros.config
+)
+
+add_header_library(
+ fminimum_magf128
+ HDRS
+ fminimum_magf128.h
+ DEPENDS
+ libc.include.llvm-libc-types.float128
+ libc.src.__support.FPUtil.basic_operations
+ libc.src.__support.macros.config
+)
+
+add_header_library(
+ fminimum_magf16
+ HDRS
+ fminimum_magf16.h
+ DEPENDS
+ libc.include.llvm-libc-macros.float16_macros
+ libc.src.__support.FPUtil.basic_operations
+ libc.src.__support.macros.config
+)
+
+add_header_library(
+ fminimum_magl
+ HDRS
+ fminimum_magl.h
+ DEPENDS
+ libc.src.__support.FPUtil.basic_operations
+ libc.src.__support.macros.config
+)
+
add_header_library(
fminimum_num
diff --git a/libc/src/__support/math/fmaximum_mag.h b/libc/src/__support/math/fmaximum_mag.h
new file mode 100644
index 0000000000000..a114b48790e33
--- /dev/null
+++ b/libc/src/__support/math/fmaximum_mag.h
@@ -0,0 +1,25 @@
+//===-- Implementation header for fmaximum_mag ------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC___SUPPORT_MATH_FMAXIMUM_MAG_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FMAXIMUM_MAG_H
+
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace math {
+
+LIBC_INLINE constexpr double fmaximum_mag(double x, double y) {
+ return fputil::fmaximum_mag(x, y);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FMAXIMUM_MAG_H
diff --git a/libc/src/__support/math/fmaximum_magbf16.h b/libc/src/__support/math/fmaximum_magbf16.h
new file mode 100644
index 0000000000000..ef71618500a39
--- /dev/null
+++ b/libc/src/__support/math/fmaximum_magbf16.h
@@ -0,0 +1,26 @@
+//===-- Implementation header for fmaximum_magbf16 --------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC___SUPPORT_MATH_FMAXIMUM_MAGBF16_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FMAXIMUM_MAGBF16_H
+
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/FPUtil/bfloat16.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace math {
+
+LIBC_INLINE constexpr bfloat16 fmaximum_magbf16(bfloat16 x, bfloat16 y) {
+ return fputil::fmaximum_mag(x, y);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FMAXIMUM_MAGBF16_H
diff --git a/libc/src/__support/math/fmaximum_magf.h b/libc/src/__support/math/fmaximum_magf.h
new file mode 100644
index 0000000000000..3fea647977b4e
--- /dev/null
+++ b/libc/src/__support/math/fmaximum_magf.h
@@ -0,0 +1,25 @@
+//===-- Implementation header for fmaximum_magf -----------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC___SUPPORT_MATH_FMAXIMUM_MAGF_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FMAXIMUM_MAGF_H
+
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace math {
+
+LIBC_INLINE constexpr float fmaximum_magf(float x, float y) {
+ return fputil::fmaximum_mag(x, y);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FMAXIMUM_MAGF_H
diff --git a/libc/src/__support/math/fmaximum_magf128.h b/libc/src/__support/math/fmaximum_magf128.h
new file mode 100644
index 0000000000000..8c89ee5f4982d
--- /dev/null
+++ b/libc...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/195394
More information about the libc-commits
mailing list