aboutsummaryrefslogtreecommitdiff
path: root/libc/src/math/amdgpu/fabs.cpp
diff options
context:
space:
mode:
authorJoseph Huber <huberjn@outlook.com>2024-02-27 11:39:13 -0600
committerGitHub <noreply@github.com>2024-02-27 11:39:13 -0600
commitd29261074cd18383f4d3c84e740c66de738cb61f (patch)
treeba84aba1b36b9fc3f0fac09ee212241c23174d89 /libc/src/math/amdgpu/fabs.cpp
parentaa95aa69b96f51a3c19a24a0387ebc1fb7e6e52c (diff)
downloadllvm-d29261074cd18383f4d3c84e740c66de738cb61f.zip
llvm-d29261074cd18383f4d3c84e740c66de738cb61f.tar.gz
llvm-d29261074cd18383f4d3c84e740c66de738cb61f.tar.bz2
[libc] Clean up GPU math implementations (#83133)
Summary: The math directory likes to do architecture specific implementations of these math functions. For the GPU case it was complicated by the fact that both NVPTX and AMDGPU had to go through the same code paths. Since reworking the GPU target this is no longer the case and we can simply use the same scheme. This patch moves all the old code into two separate directories. This likely results in a net increase in code, but it's easier to reason with.
Diffstat (limited to 'libc/src/math/amdgpu/fabs.cpp')
-rw-r--r--libc/src/math/amdgpu/fabs.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/libc/src/math/amdgpu/fabs.cpp b/libc/src/math/amdgpu/fabs.cpp
new file mode 100644
index 0000000..c0d063d
--- /dev/null
+++ b/libc/src/math/amdgpu/fabs.cpp
@@ -0,0 +1,16 @@
+//===-- Implementation of the fabs function for GPU -----------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/math/fabs.h"
+#include "src/__support/common.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(double, fabs, (double x)) { return __builtin_fabs(x); }
+
+} // namespace LIBC_NAMESPACE