summaryrefslogtreecommitdiff
path: root/libc/src/math/generic/dsubl.cpp
diff options
context:
space:
mode:
authorJoseph Huber <huberjn@outlook.com>2024-08-12 13:12:44 -0500
committerGitHub <noreply@github.com>2024-08-12 13:12:44 -0500
commitdc2f39e96c48dac450a535c412d0928d458590de (patch)
treede0604902ad83ad9875cf555cdb608e9d21ed40f /libc/src/math/generic/dsubl.cpp
parentd5849af68e0cb2436d317ea0c5171e8da85fd846 (diff)
[libc] Enable all supported math functions on the GPU (#102563)
Summary: Simply copies the x64 versions to the GPU directory. Ignoring f128 for now, but adding long double entrypoints which are identical to `double` on the target.
Diffstat (limited to 'libc/src/math/generic/dsubl.cpp')
-rw-r--r--libc/src/math/generic/dsubl.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/libc/src/math/generic/dsubl.cpp b/libc/src/math/generic/dsubl.cpp
index 8b567d0869d2..f1e6cb917da5 100644
--- a/libc/src/math/generic/dsubl.cpp
+++ b/libc/src/math/generic/dsubl.cpp
@@ -10,11 +10,16 @@
#include "src/__support/FPUtil/generic/add_sub.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
+#include "src/__support/macros/properties/types.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(double, dsubl, (long double x, long double y)) {
- return fputil::generic::sub<double>(x, y);
+#ifdef LIBC_TYPES_LONG_DOUBLE_IS_FLOAT64
+ return static_cast<double>(x) - static_cast<double>(y);
+#else
+ return fputil::generic::add<double>(x, y);
+#endif
}
} // namespace LIBC_NAMESPACE_DECL