[libc][math] Refactor copysign family to header-only#182137
Merged
Merged
Conversation
Member
|
@llvm/pr-subscribers-libc Author: Mohamed Emad (hulxv) ChangesRefactors the copysign math family to be header-only. Closes #182136 Target Functions:
Patch is 26.83 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/182137.diff 24 Files Affected:
diff --git a/libc/shared/math.h b/libc/shared/math.h
index 8a5aca82c6ec3..0b9d15a144649 100644
--- a/libc/shared/math.h
+++ b/libc/shared/math.h
@@ -45,6 +45,12 @@
#include "math/canonicalizel.h"
#include "math/cbrt.h"
#include "math/cbrtf.h"
+#include "math/copysign.h"
+#include "math/copysignbf16.h"
+#include "math/copysignf.h"
+#include "math/copysignf128.h"
+#include "math/copysignf16.h"
+#include "math/copysignl.h"
#include "math/cos.h"
#include "math/cosf.h"
#include "math/cosf16.h"
diff --git a/libc/shared/math/copysign.h b/libc/shared/math/copysign.h
new file mode 100644
index 0000000000000..b64ba513f9dce
--- /dev/null
+++ b/libc/shared/math/copysign.h
@@ -0,0 +1,22 @@
+//===-- Shared copysign 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_COPYSIGN_H
+#define LLVM_LIBC_SHARED_MATH_COPYSIGN_H
+
+#include "src/__support/math/copysign.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::copysign;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_COPYSIGN_H
diff --git a/libc/shared/math/copysignbf16.h b/libc/shared/math/copysignbf16.h
new file mode 100644
index 0000000000000..3bb24da81f19e
--- /dev/null
+++ b/libc/shared/math/copysignbf16.h
@@ -0,0 +1,22 @@
+//===-- Shared copysignbf16 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_COPYSIGNBF16_H
+#define LLVM_LIBC_SHARED_MATH_COPYSIGNBF16_H
+
+#include "src/__support/math/copysignbf16.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::copysignbf16;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_COPYSIGNBF16_H
diff --git a/libc/shared/math/copysignf.h b/libc/shared/math/copysignf.h
new file mode 100644
index 0000000000000..5551f51ed705f
--- /dev/null
+++ b/libc/shared/math/copysignf.h
@@ -0,0 +1,22 @@
+//===-- Shared copysignf 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_COPYSIGNF_H
+#define LLVM_LIBC_SHARED_MATH_COPYSIGNF_H
+
+#include "src/__support/math/copysignf.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::copysignf;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_COPYSIGNF_H
diff --git a/libc/shared/math/copysignf128.h b/libc/shared/math/copysignf128.h
new file mode 100644
index 0000000000000..59e2f68319120
--- /dev/null
+++ b/libc/shared/math/copysignf128.h
@@ -0,0 +1,28 @@
+//===-- Shared copysignf128 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_COPYSIGNF128_H
+#define LLVM_LIBC_SHARED_MATH_COPYSIGNF128_H
+
+#include "include/llvm-libc-types/float128.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT128
+
+#include "src/__support/math/copysignf128.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::copysignf128;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT128
+
+#endif // LLVM_LIBC_SHARED_MATH_COPYSIGNF128_H
diff --git a/libc/shared/math/copysignf16.h b/libc/shared/math/copysignf16.h
new file mode 100644
index 0000000000000..bd66d8da6488a
--- /dev/null
+++ b/libc/shared/math/copysignf16.h
@@ -0,0 +1,28 @@
+//===-- Shared copysignf16 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_COPYSIGNF16_H
+#define LLVM_LIBC_SHARED_MATH_COPYSIGNF16_H
+
+#include "include/llvm-libc-macros/float16-macros.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT16
+
+#include "src/__support/math/copysignf16.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::copysignf16;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT16
+
+#endif // LLVM_LIBC_SHARED_MATH_COPYSIGNF16_H
diff --git a/libc/shared/math/copysignl.h b/libc/shared/math/copysignl.h
new file mode 100644
index 0000000000000..5bb0907eaf173
--- /dev/null
+++ b/libc/shared/math/copysignl.h
@@ -0,0 +1,22 @@
+//===-- Shared copysignl 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_COPYSIGNL_H
+#define LLVM_LIBC_SHARED_MATH_COPYSIGNL_H
+
+#include "src/__support/math/copysignl.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::copysignl;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_COPYSIGNL_H
diff --git a/libc/src/__support/math/CMakeLists.txt b/libc/src/__support/math/CMakeLists.txt
index e21fe8ef0ab93..1970a48271302 100644
--- a/libc/src/__support/math/CMakeLists.txt
+++ b/libc/src/__support/math/CMakeLists.txt
@@ -484,6 +484,57 @@ add_header_library(
libc.src.__support.macros.config
libc.src.__support.number_pair
)
+add_header_library(
+ copysign
+ HDRS
+ copysign.h
+ DEPENDS
+ libc.src.__support.FPUtil.manipulation_functions
+ libc.src.__support.macros.config
+)
+add_header_library(
+ copysignbf16
+ HDRS
+ copysignbf16.h
+ DEPENDS
+ libc.src.__support.FPUtil.bfloat16
+ libc.src.__support.FPUtil.manipulation_functions
+ libc.src.__support.macros.config
+)
+add_header_library(
+ copysignf
+ HDRS
+ copysignf.h
+ DEPENDS
+ libc.src.__support.FPUtil.manipulation_functions
+ libc.src.__support.macros.config
+)
+add_header_library(
+ copysignf128
+ HDRS
+ copysignf128.h
+ DEPENDS
+ libc.include.llvm-libc-types.float128
+ libc.src.__support.FPUtil.manipulation_functions
+ libc.src.__support.macros.config
+)
+add_header_library(
+ copysignf16
+ HDRS
+ copysignf16.h
+ DEPENDS
+ libc.include.llvm-libc-macros.float16_macros
+ libc.src.__support.FPUtil.manipulation_functions
+ libc.src.__support.macros.config
+)
+add_header_library(
+ copysignl
+ HDRS
+ copysignl.h
+ DEPENDS
+ libc.src.__support.FPUtil.manipulation_functions
+ libc.src.__support.macros.config
+)
add_header_library(
cos
diff --git a/libc/src/__support/math/copysign.h b/libc/src/__support/math/copysign.h
new file mode 100644
index 0000000000000..7ba974b3664cd
--- /dev/null
+++ b/libc/src/__support/math/copysign.h
@@ -0,0 +1,30 @@
+//===-- Implementation header for copysign ----------------------*- 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_COPYSIGN_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_COPYSIGN_H
+
+#include "src/__support/FPUtil/ManipulationFunctions.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+namespace math {
+
+LIBC_INLINE double copysign(double x, double y) {
+#ifdef __LIBC_MISC_MATH_BASIC_OPS_OPT
+ return __builtin_copysign(x, y);
+#else
+ return fputil::copysign(x, y);
+#endif
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_COPYSIGN_H
diff --git a/libc/src/__support/math/copysignbf16.h b/libc/src/__support/math/copysignbf16.h
new file mode 100644
index 0000000000000..60b72848101f1
--- /dev/null
+++ b/libc/src/__support/math/copysignbf16.h
@@ -0,0 +1,27 @@
+//===-- Implementation header for copysignbf16 ------------------*- 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_COPYSIGNBF16_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_COPYSIGNBF16_H
+
+#include "src/__support/FPUtil/ManipulationFunctions.h"
+#include "src/__support/FPUtil/bfloat16.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+namespace math {
+
+LIBC_INLINE constexpr bfloat16 copysignbf16(bfloat16 x, bfloat16 y) {
+ return fputil::copysign(x, y);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_COPYSIGNBF16_H
diff --git a/libc/src/__support/math/copysignf.h b/libc/src/__support/math/copysignf.h
new file mode 100644
index 0000000000000..a8b8adb5631b1
--- /dev/null
+++ b/libc/src/__support/math/copysignf.h
@@ -0,0 +1,30 @@
+//===-- Implementation header for copysignf ---------------------*- 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_COPYSIGNF_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_COPYSIGNF_H
+
+#include "src/__support/FPUtil/ManipulationFunctions.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+namespace math {
+
+LIBC_INLINE float copysignf(float x, float y) {
+#ifdef __LIBC_MISC_MATH_BASIC_OPS_OPT
+ return __builtin_copysignf(x, y);
+#else
+ return fputil::copysign(x, y);
+#endif
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_COPYSIGNF_H
diff --git a/libc/src/__support/math/copysignf128.h b/libc/src/__support/math/copysignf128.h
new file mode 100644
index 0000000000000..a95f4620572ce
--- /dev/null
+++ b/libc/src/__support/math/copysignf128.h
@@ -0,0 +1,32 @@
+//===-- Implementation header for copysignf128 ------------------*- 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_COPYSIGNF128_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_COPYSIGNF128_H
+
+#include "include/llvm-libc-types/float128.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT128
+
+#include "src/__support/FPUtil/ManipulationFunctions.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+namespace math {
+
+LIBC_INLINE constexpr float128 copysignf128(float128 x, float128 y) {
+ return fputil::copysign(x, y);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT128
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_COPYSIGNF128_H
diff --git a/libc/src/__support/math/copysignf16.h b/libc/src/__support/math/copysignf16.h
new file mode 100644
index 0000000000000..4e79c29256cba
--- /dev/null
+++ b/libc/src/__support/math/copysignf16.h
@@ -0,0 +1,36 @@
+//===-- Implementation header for copysignf16 -------------------*- 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_COPYSIGNF16_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_COPYSIGNF16_H
+
+#include "include/llvm-libc-macros/float16-macros.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT16
+
+#include "src/__support/FPUtil/ManipulationFunctions.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+namespace math {
+
+LIBC_INLINE float16 copysignf16(float16 x, float16 y) {
+#ifdef __LIBC_MISC_MATH_BASIC_OPS_OPT
+ return __builtin_copysignf16(x, y);
+#else
+ return fputil::copysign(x, y);
+#endif
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT16
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_COPYSIGNF16_H
diff --git a/libc/src/__support/math/copysignl.h b/libc/src/__support/math/copysignl.h
new file mode 100644
index 0000000000000..3a420365d8178
--- /dev/null
+++ b/libc/src/__support/math/copysignl.h
@@ -0,0 +1,26 @@
+//===-- Implementation header for copysignl ---------------------*- 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_COPYSIGNL_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_COPYSIGNL_H
+
+#include "src/__support/FPUtil/ManipulationFunctions.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+namespace math {
+
+LIBC_INLINE constexpr long double copysignl(long double x, long double y) {
+ return fputil::copysign(x, y);
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_COPYSIGNL_H
diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt
index 57a29665318a3..6d892dbf11c61 100644
--- a/libc/src/math/generic/CMakeLists.txt
+++ b/libc/src/math/generic/CMakeLists.txt
@@ -1517,9 +1517,7 @@ add_entrypoint_object(
HDRS
../copysign.h
DEPENDS
- libc.src.__support.FPUtil.manipulation_functions
- FLAGS
- MISC_MATH_BASIC_OPS_OPT
+ libc.src.__support.math.copysign
)
add_entrypoint_object(
@@ -1529,9 +1527,7 @@ add_entrypoint_object(
HDRS
../copysignf.h
DEPENDS
- libc.src.__support.FPUtil.manipulation_functions
- FLAGS
- MISC_MATH_BASIC_OPS_OPT
+ libc.src.__support.math.copysignf
)
add_entrypoint_object(
@@ -1541,7 +1537,7 @@ add_entrypoint_object(
HDRS
../copysignl.h
DEPENDS
- libc.src.__support.FPUtil.manipulation_functions
+ libc.src.__support.math.copysignl
)
add_entrypoint_object(
@@ -1551,10 +1547,7 @@ add_entrypoint_object(
HDRS
../copysignf16.h
DEPENDS
- libc.src.__support.macros.properties.types
- libc.src.__support.FPUtil.manipulation_functions
- FLAGS
- MISC_MATH_BASIC_OPS_OPT
+ libc.src.__support.math.copysignf16
)
add_entrypoint_object(
@@ -1564,8 +1557,7 @@ add_entrypoint_object(
HDRS
../copysignf128.h
DEPENDS
- libc.src.__support.macros.properties.types
- libc.src.__support.FPUtil.manipulation_functions
+ libc.src.__support.math.copysignf128
)
add_entrypoint_object(
@@ -1575,13 +1567,7 @@ add_entrypoint_object(
HDRS
../copysignbf16.h
DEPENDS
- libc.src.__support.common
- libc.src.__support.macros.config
- libc.src.__support.macros.properties.types
- libc.src.__support.FPUtil.bfloat16
- libc.src.__support.FPUtil.manipulation_functions
- FLAGS
- MISC_MATH_BASIC_OPS_OPT
+ libc.src.__support.math.copysignbf16
)
add_entrypoint_object(
diff --git a/libc/src/math/generic/copysign.cpp b/libc/src/math/generic/copysign.cpp
index 186bb2c5983f4..6d92b0600eeb2 100644
--- a/libc/src/math/generic/copysign.cpp
+++ b/libc/src/math/generic/copysign.cpp
@@ -7,18 +7,12 @@
//===----------------------------------------------------------------------===//
#include "src/math/copysign.h"
-#include "src/__support/FPUtil/ManipulationFunctions.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/copysign.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(double, copysign, (double x, double y)) {
-#ifdef __LIBC_MISC_MATH_BASIC_OPS_OPT
- return __builtin_copysign(x, y);
-#else
- return fputil::copysign(x, y);
-#endif
+ return math::copysign(x, y);
}
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/copysignbf16.cpp b/libc/src/math/generic/copysignbf16.cpp
index 48ade2b26981c..548fa42835e5f 100644
--- a/libc/src/math/generic/copysignbf16.cpp
+++ b/libc/src/math/generic/copysignbf16.cpp
@@ -7,15 +7,12 @@
//===----------------------------------------------------------------------===//
#include "src/math/copysignbf16.h"
-#include "src/__support/FPUtil/ManipulationFunctions.h"
-#include "src/__support/FPUtil/bfloat16.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/copysignbf16.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(bfloat16, copysignbf16, (bfloat16 x, bfloat16 y)) {
- return fputil::copysign(x, y);
+ return math::copysignbf16(x, y);
}
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/copysignf.cpp b/libc/src/math/generic/copysignf.cpp
index c79e50b61ebda..94eeba9eaf705 100644
--- a/libc/src/math/generic/copysignf.cpp
+++ b/libc/src/math/generic/copysignf.cpp
@@ -7,18 +7,12 @@
//===----------------------------------------------------------------------===//
#include "src/math/copysignf.h"
-#include "src/__support/FPUtil/ManipulationFunctions.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/copysignf.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(float, copysignf, (float x, float y)) {
-#ifdef __LIBC_MISC_MATH_BASIC_OPS_OPT
- return __builtin_copysignf(x, y);
-#else
- return fputil::copysign(x, y);
-#endif
+ return math::copysignf(x, y);
}
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/copysignf128.cpp b/libc/src/math/generic/copysignf128.cpp
index 9a51c8d5eb8df..9af98f0d10723 100644
--- a/libc/src/math/generic/copysignf128.cpp
+++ b/libc/src/math/generic/copysignf128.cpp
@@ -7,14 +7,12 @@
//===----------------------------------------------------------------------===//
#include "src/math/copysignf128.h"
-#include "src/__support/FPUtil/ManipulationFunctions.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/copysignf128.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(float128, copysignf128, (float128 x, float128 y)) {
- return fputil::copysign(x, y);
+ return math::copysignf128(x, y);
}
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/copysignf16.cpp b/libc/src/math/generic/copysignf16.cpp
index 546622f049ebe..23db8faf3211a 100644
--- a/libc/src/math/generic/copysignf16.cpp
+++ b/libc/src/math/generic/copysignf16.cpp
@@ -7,18 +7,12 @@
//===----------------------------------------------------------------------===//
#include "src/math/copysignf16.h"
-#include "src/__support/FPUtil/ManipulationFunctions.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/copysignf16.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(float16, copysignf16, (float16 x, float16 y)) {
-#ifdef __LIBC_MISC_MATH_BASIC_OPS_OPT
- return __builtin_copysignf16(x, y);
-#else
- return f...
[truncated]
|
Refactored functions: - copysign - copysignbf16 - copysignf - copysignf128 - copysignf16 - copysignl
b8d2e69 to
52bb9d2
Compare
9e834c4 to
fe5c7e2
Compare
2380068 to
1bd90bc
Compare
bassiounix
requested changes
Mar 16, 2026
| namespace LIBC_NAMESPACE_DECL { | ||
| namespace math { | ||
|
|
||
| LIBC_INLINE constexpr float128 copysignf128(float128 x, float128 y) { |
Member
There was a problem hiding this comment.
Suggested change
| LIBC_INLINE constexpr float128 copysignf128(float128 x, float128 y) { | |
| LIBC_INLINE float128 copysignf128(float128 x, float128 y) { |
bassiounix
requested changes
Mar 19, 2026
bassiounix
requested changes
Apr 13, 2026
fc56b80 to
28c0d05
Compare
bassiounix
approved these changes
Apr 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refactors the copysign math family to be header-only.
Closes #182136
Target Functions: