[libc-commits] [libc] [llvm] [libc][math] Refactor fdim family to header-only (PR #182190)
via libc-commits
libc-commits at lists.llvm.org
Wed Feb 18 16:08:22 PST 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libc
Author: Mohamed Emad (hulxv)
<details>
<summary>Changes</summary>
Refactors the fdim math family to be header-only.
Closes https://github.com/llvm/llvm-project/issues/182188
Target Functions:
- fdim
- fdimbf16
- fdimf
- fdimf128
- fdimf16
- fdiml
---
Patch is 25.17 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/182190.diff
24 Files Affected:
- (modified) libc/shared/math.h (+6)
- (added) libc/shared/math/fdim.h (+22)
- (added) libc/shared/math/fdimbf16.h (+22)
- (added) libc/shared/math/fdimf.h (+22)
- (added) libc/shared/math/fdimf128.h (+28)
- (added) libc/shared/math/fdimf16.h (+28)
- (added) libc/shared/math/fdiml.h (+22)
- (modified) libc/src/__support/math/CMakeLists.txt (+51)
- (added) libc/src/__support/math/fdim.h (+24)
- (added) libc/src/__support/math/fdimbf16.h (+27)
- (added) libc/src/__support/math/fdimf.h (+24)
- (added) libc/src/__support/math/fdimf128.h (+32)
- (added) libc/src/__support/math/fdimf16.h (+30)
- (added) libc/src/__support/math/fdiml.h (+26)
- (modified) libc/src/math/generic/CMakeLists.txt (+6-12)
- (modified) libc/src/math/generic/fdim.cpp (+2-4)
- (modified) libc/src/math/generic/fdimbf16.cpp (+2-5)
- (modified) libc/src/math/generic/fdimf.cpp (+2-4)
- (modified) libc/src/math/generic/fdimf128.cpp (+2-4)
- (modified) libc/src/math/generic/fdimf16.cpp (+2-4)
- (modified) libc/src/math/generic/fdiml.cpp (+2-4)
- (modified) libc/test/shared/CMakeLists.txt (+6)
- (modified) libc/test/shared/shared_math_test.cpp (+14)
- (modified) utils/bazel/llvm-project-overlay/libc/BUILD.bazel (+94-5)
``````````diff
diff --git a/libc/shared/math.h b/libc/shared/math.h
index 8a5aca82c6ec3..b13607b6aa7f1 100644
--- a/libc/shared/math.h
+++ b/libc/shared/math.h
@@ -83,6 +83,12 @@
#include "math/f16sqrt.h"
#include "math/f16sqrtf.h"
#include "math/f16sqrtl.h"
+#include "math/fdim.h"
+#include "math/fdimbf16.h"
+#include "math/fdimf.h"
+#include "math/fdimf128.h"
+#include "math/fdimf16.h"
+#include "math/fdiml.h"
#include "math/ffma.h"
#include "math/ffmal.h"
#include "math/frexpf.h"
diff --git a/libc/shared/math/fdim.h b/libc/shared/math/fdim.h
new file mode 100644
index 0000000000000..394a1339915e1
--- /dev/null
+++ b/libc/shared/math/fdim.h
@@ -0,0 +1,22 @@
+//===-- Shared fdim 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_FDIM_H
+#define LLVM_LIBC_SHARED_MATH_FDIM_H
+
+#include "src/__support/math/fdim.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fdim;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_FDIM_H
diff --git a/libc/shared/math/fdimbf16.h b/libc/shared/math/fdimbf16.h
new file mode 100644
index 0000000000000..a642d770abf2a
--- /dev/null
+++ b/libc/shared/math/fdimbf16.h
@@ -0,0 +1,22 @@
+//===-- Shared fdimbf16 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_FDIMBF16_H
+#define LLVM_LIBC_SHARED_MATH_FDIMBF16_H
+
+#include "src/__support/math/fdimbf16.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fdimbf16;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_FDIMBF16_H
diff --git a/libc/shared/math/fdimf.h b/libc/shared/math/fdimf.h
new file mode 100644
index 0000000000000..ba29a0bb0b5dd
--- /dev/null
+++ b/libc/shared/math/fdimf.h
@@ -0,0 +1,22 @@
+//===-- Shared fdimf 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_FDIMF_H
+#define LLVM_LIBC_SHARED_MATH_FDIMF_H
+
+#include "src/__support/math/fdimf.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fdimf;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_FDIMF_H
diff --git a/libc/shared/math/fdimf128.h b/libc/shared/math/fdimf128.h
new file mode 100644
index 0000000000000..4795c0f418517
--- /dev/null
+++ b/libc/shared/math/fdimf128.h
@@ -0,0 +1,28 @@
+//===-- Shared fdimf128 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_FDIMF128_H
+#define LLVM_LIBC_SHARED_MATH_FDIMF128_H
+
+#include "include/llvm-libc-types/float128.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT128
+
+#include "src/__support/math/fdimf128.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fdimf128;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT128
+
+#endif // LLVM_LIBC_SHARED_MATH_FDIMF128_H
diff --git a/libc/shared/math/fdimf16.h b/libc/shared/math/fdimf16.h
new file mode 100644
index 0000000000000..5325022b7e965
--- /dev/null
+++ b/libc/shared/math/fdimf16.h
@@ -0,0 +1,28 @@
+//===-- Shared fdimf16 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_FDIMF16_H
+#define LLVM_LIBC_SHARED_MATH_FDIMF16_H
+
+#include "include/llvm-libc-macros/float16-macros.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT16
+
+#include "src/__support/math/fdimf16.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fdimf16;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT16
+
+#endif // LLVM_LIBC_SHARED_MATH_FDIMF16_H
diff --git a/libc/shared/math/fdiml.h b/libc/shared/math/fdiml.h
new file mode 100644
index 0000000000000..ed84cad129274
--- /dev/null
+++ b/libc/shared/math/fdiml.h
@@ -0,0 +1,22 @@
+//===-- Shared fdiml 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_FDIML_H
+#define LLVM_LIBC_SHARED_MATH_FDIML_H
+
+#include "src/__support/math/fdiml.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::fdiml;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_FDIML_H
diff --git a/libc/src/__support/math/CMakeLists.txt b/libc/src/__support/math/CMakeLists.txt
index e21fe8ef0ab93..93b8457744852 100644
--- a/libc/src/__support/math/CMakeLists.txt
+++ b/libc/src/__support/math/CMakeLists.txt
@@ -751,6 +751,57 @@ add_header_library(
libc.src.__support.FPUtil.generic.add_sub
libc.src.__support.macros.config
)
+add_header_library(
+ fdim
+ HDRS
+ fdim.h
+ DEPENDS
+ libc.src.__support.FPUtil.basic_operations
+ libc.src.__support.macros.config
+)
+add_header_library(
+ fdimbf16
+ HDRS
+ fdimbf16.h
+ DEPENDS
+ libc.src.__support.FPUtil.basic_operations
+ libc.src.__support.FPUtil.bfloat16
+ libc.src.__support.macros.config
+)
+add_header_library(
+ fdimf
+ HDRS
+ fdimf.h
+ DEPENDS
+ libc.src.__support.FPUtil.basic_operations
+ libc.src.__support.macros.config
+)
+add_header_library(
+ fdimf128
+ HDRS
+ fdimf128.h
+ DEPENDS
+ libc.include.llvm-libc-types.float128
+ libc.src.__support.FPUtil.basic_operations
+ libc.src.__support.macros.config
+)
+add_header_library(
+ fdimf16
+ HDRS
+ fdimf16.h
+ DEPENDS
+ libc.include.llvm-libc-macros.float16_macros
+ libc.src.__support.FPUtil.basic_operations
+ libc.src.__support.macros.config
+)
+add_header_library(
+ fdiml
+ HDRS
+ fdiml.h
+ DEPENDS
+ libc.src.__support.FPUtil.basic_operations
+ libc.src.__support.macros.config
+)
add_header_library(
ffmal
diff --git a/libc/src/__support/math/fdim.h b/libc/src/__support/math/fdim.h
new file mode 100644
index 0000000000000..b85d6ed4d20c1
--- /dev/null
+++ b/libc/src/__support/math/fdim.h
@@ -0,0 +1,24 @@
+//===-- Implementation header for fdim --------------------------*- 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_FDIM_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FDIM_H
+
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+namespace math {
+
+LIBC_INLINE double fdim(double x, double y) { return fputil::fdim(x, y); }
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FDIM_H
diff --git a/libc/src/__support/math/fdimbf16.h b/libc/src/__support/math/fdimbf16.h
new file mode 100644
index 0000000000000..c67da2fa43b4d
--- /dev/null
+++ b/libc/src/__support/math/fdimbf16.h
@@ -0,0 +1,27 @@
+//===-- Implementation header for fdimbf16 ----------------------*- 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_FDIMBF16_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FDIMBF16_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 bfloat16 fdimbf16(bfloat16 x, bfloat16 y) {
+ return fputil::fdim(x, y);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FDIMBF16_H
diff --git a/libc/src/__support/math/fdimf.h b/libc/src/__support/math/fdimf.h
new file mode 100644
index 0000000000000..eb9538b4e3707
--- /dev/null
+++ b/libc/src/__support/math/fdimf.h
@@ -0,0 +1,24 @@
+//===-- Implementation header for fdimf -------------------------*- 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_FDIMF_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FDIMF_H
+
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+namespace math {
+
+LIBC_INLINE float fdimf(float x, float y) { return fputil::fdim(x, y); }
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FDIMF_H
diff --git a/libc/src/__support/math/fdimf128.h b/libc/src/__support/math/fdimf128.h
new file mode 100644
index 0000000000000..342b72ffb0745
--- /dev/null
+++ b/libc/src/__support/math/fdimf128.h
@@ -0,0 +1,32 @@
+//===-- Implementation header for fdimf128 ----------------------*- 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_FDIMF128_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FDIMF128_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 float128 fdimf128(float128 x, float128 y) {
+ return fputil::fdim(x, y);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT128
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FDIMF128_H
diff --git a/libc/src/__support/math/fdimf16.h b/libc/src/__support/math/fdimf16.h
new file mode 100644
index 0000000000000..7c2b953550f42
--- /dev/null
+++ b/libc/src/__support/math/fdimf16.h
@@ -0,0 +1,30 @@
+//===-- Implementation header for fdimf16 -----------------------*- 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_FDIMF16_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FDIMF16_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 float16 fdimf16(float16 x, float16 y) { return fputil::fdim(x, y); }
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT16
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FDIMF16_H
diff --git a/libc/src/__support/math/fdiml.h b/libc/src/__support/math/fdiml.h
new file mode 100644
index 0000000000000..feb5d35f1a26d
--- /dev/null
+++ b/libc/src/__support/math/fdiml.h
@@ -0,0 +1,26 @@
+//===-- Implementation header for fdiml -------------------------*- 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_FDIML_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_FDIML_H
+
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+namespace math {
+
+LIBC_INLINE long double fdiml(long double x, long double y) {
+ return fputil::fdim(x, y);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FDIML_H
diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt
index 57a29665318a3..a8dd0675d16a2 100644
--- a/libc/src/math/generic/CMakeLists.txt
+++ b/libc/src/math/generic/CMakeLists.txt
@@ -3099,7 +3099,7 @@ add_entrypoint_object(
HDRS
../fdim.h
DEPENDS
- libc.src.__support.FPUtil.basic_operations
+ libc.src.__support.math.fdim
)
add_entrypoint_object(
@@ -3109,7 +3109,7 @@ add_entrypoint_object(
HDRS
../fdimf.h
DEPENDS
- libc.src.__support.FPUtil.basic_operations
+ libc.src.__support.math.fdimf
)
add_entrypoint_object(
@@ -3119,7 +3119,7 @@ add_entrypoint_object(
HDRS
../fdiml.h
DEPENDS
- libc.src.__support.FPUtil.basic_operations
+ libc.src.__support.math.fdiml
)
add_entrypoint_object(
@@ -3129,8 +3129,7 @@ add_entrypoint_object(
HDRS
../fdimf16.h
DEPENDS
- libc.src.__support.macros.properties.types
- libc.src.__support.FPUtil.basic_operations
+ libc.src.__support.math.fdimf16
)
add_entrypoint_object(
@@ -3140,8 +3139,7 @@ add_entrypoint_object(
HDRS
../fdimf128.h
DEPENDS
- libc.src.__support.macros.properties.types
- libc.src.__support.FPUtil.basic_operations
+ libc.src.__support.math.fdimf128
)
add_entrypoint_object(
@@ -3151,11 +3149,7 @@ add_entrypoint_object(
HDRS
../fdimbf16.h
DEPENDS
- libc.src.__support.common
- libc.src.__support.macros.config
- libc.src.__support.macros.properties.types
- libc.src.__support.FPUtil.basic_operations
- libc.src.__support.FPUtil.bfloat16
+ libc.src.__support.math.fdimbf16
)
add_entrypoint_object(
diff --git a/libc/src/math/generic/fdim.cpp b/libc/src/math/generic/fdim.cpp
index 9ea121f327286..65aca3374e9c4 100644
--- a/libc/src/math/generic/fdim.cpp
+++ b/libc/src/math/generic/fdim.cpp
@@ -7,14 +7,12 @@
//===----------------------------------------------------------------------===//
#include "src/math/fdim.h"
-#include "src/__support/FPUtil/BasicOperations.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/fdim.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(double, fdim, (double x, double y)) {
- return fputil::fdim(x, y);
+ return math::fdim(x, y);
}
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/fdimbf16.cpp b/libc/src/math/generic/fdimbf16.cpp
index 0f54055b763e1..e5a6504e98ed7 100644
--- a/libc/src/math/generic/fdimbf16.cpp
+++ b/libc/src/math/generic/fdimbf16.cpp
@@ -7,15 +7,12 @@
//===----------------------------------------------------------------------===//
#include "src/math/fdimbf16.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/fdimbf16.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(bfloat16, fdimbf16, (bfloat16 x, bfloat16 y)) {
- return fputil::fdim(x, y);
+ return math::fdimbf16(x, y);
}
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/fdimf.cpp b/libc/src/math/generic/fdimf.cpp
index 2c6bf7a51dc57..fda284b35e163 100644
--- a/libc/src/math/generic/fdimf.cpp
+++ b/libc/src/math/generic/fdimf.cpp
@@ -7,14 +7,12 @@
//===----------------------------------------------------------------------===//
#include "src/math/fdimf.h"
-#include "src/__support/FPUtil/BasicOperations.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/fdimf.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(float, fdimf, (float x, float y)) {
- return fputil::fdim(x, y);
+ return math::fdimf(x, y);
}
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/fdimf128.cpp b/libc/src/math/generic/fdimf128.cpp
index f8b1499b35b0b..de705aa03a2a5 100644
--- a/libc/src/math/generic/fdimf128.cpp
+++ b/libc/src/math/generic/fdimf128.cpp
@@ -7,14 +7,12 @@
//===----------------------------------------------------------------------===//
#include "src/math/fdimf128.h"
-#include "src/__support/FPUtil/BasicOperations.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/fdimf128.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(float128, fdimf128, (float128 x, float128 y)) {
- return fputil::fdim(x, y);
+ return math::fdimf128(x, y);
}
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/fdimf16.cpp b/libc/src/math/generic/fdimf16.cpp
index 6eac460a93c71..ce675d66a55cd 100644
--- a/libc/src/math/generic/fdimf16.cpp
+++ b/libc/src/math/generic/fdimf16.cpp
@@ -7,14 +7,12 @@
//===----------------------------------------------------------------------===//
#include "src/math/fdimf16.h"
-#include "src/__support/FPUtil/BasicOperations.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/fdimf16.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(float16, fdimf16, (float16 x, float16 y)) {
- return fputil::fdim(x, y);
+ return math::fdimf16(x, y);
}
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/fdiml.cpp b/libc/src/math/generic/fdiml.cpp
index ebac58ea797ed..9ad2fa78bc593 100644
--- a/libc/src/math/generic/fdiml.cpp
+++ b/libc/src/math/generic/fdiml.cpp
@@ -7,14 +7,12 @@
//===----------------------------------------------------------------------===//
#include "src/math/fdiml.h"
-#include "src/__support/FPUtil/BasicOperations.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/fdiml.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(long double, fdiml, (long double x, long double y)) {
- return fputil::fdim(x, y);
+ return math::fdiml(x, y);
}
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/test/shared/CMakeLists.txt b/libc/test/shared/CMakeLists.txt
index 53ad309af4f30..19e70471b0b42 100644
--- a/libc/test/shared/CMakeLists.txt
+++ b/libc/test/shared/CMakeLists.txt
@@ -79,6 +79,12 @@ add_fp_unittest(
libc.src.__support.math.f16sqrt
libc.src.__support.math.f16sqrtf
libc.src.__support.math.f16sqrtl
+ libc.src.__support.math.fdim
+ libc.src.__support.math.fdimbf16
+ libc.src.__support.math.fdimf
+ libc.src.__support.math.fdimf128
+ libc.src.__support.math.fdimf16
+ libc.src.__support.math.fdiml
libc.src.__support.math.ffma
libc.src.__support.math.ffmal
libc.src.__support.math.frexpf
diff --git a/libc/test/shared/shared_math_test.cpp b/libc/test/share...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/182190
More information about the libc-commits
mailing list