[libc-commits] [libc] [libc][GPU] Use generic implementation for remainder in GPU libc (PR #241657)
via libc-commits
libc-commits at lists.llvm.org
Wed Nov 11 20:20:57 PST 2026
https://github.com/jinge90 created https://github.com/llvm/llvm-project/pull/241657
None
>From 70e6decca06655e8286803c6c753401331f165c7 Mon Sep 17 00:00:00 2001
From: jinge90 <ge.jin at intel.com>
Date: Thu, 12 Nov 2026 12:16:38 +0800
Subject: [PATCH 1/2] [libc][GPU] Fallback to generic implementation for
remainder for GPU
Signed-off-by: jinge90 <ge.jin at intel.com>
---
libc/src/math/amdgpu/CMakeLists.txt | 16 ----------------
libc/src/math/nvptx/CMakeLists.txt | 16 ----------------
2 files changed, 32 deletions(-)
diff --git a/libc/src/math/amdgpu/CMakeLists.txt b/libc/src/math/amdgpu/CMakeLists.txt
index d05d519b74b4fe..f6edab862728cb 100644
--- a/libc/src/math/amdgpu/CMakeLists.txt
+++ b/libc/src/math/amdgpu/CMakeLists.txt
@@ -142,22 +142,6 @@ add_entrypoint_object(
../nearbyintf.h
)
-add_entrypoint_object(
- remainder
- SRCS
- remainder.cpp
- HDRS
- ../remainder.h
-)
-
-add_entrypoint_object(
- remainderf
- SRCS
- remainderf.cpp
- HDRS
- ../remainderf.h
-)
-
add_entrypoint_object(
rint
SRCS
diff --git a/libc/src/math/nvptx/CMakeLists.txt b/libc/src/math/nvptx/CMakeLists.txt
index 78797092622a3d..42159cab348f1c 100644
--- a/libc/src/math/nvptx/CMakeLists.txt
+++ b/libc/src/math/nvptx/CMakeLists.txt
@@ -126,22 +126,6 @@ add_entrypoint_object(
../nearbyintf.h
)
-add_entrypoint_object(
- remainder
- SRCS
- remainder.cpp
- HDRS
- ../remainder.h
-)
-
-add_entrypoint_object(
- remainderf
- SRCS
- remainderf.cpp
- HDRS
- ../remainderf.h
-)
-
add_entrypoint_object(
rint
SRCS
>From 2105216cd03e9407b8bb6f4130c1e4c194f8ea7a Mon Sep 17 00:00:00 2001
From: jinge90 <ge.jin at intel.com>
Date: Thu, 12 Nov 2026 12:19:41 +0800
Subject: [PATCH 2/2] remove unneeded code
Signed-off-by: jinge90 <ge.jin at intel.com>
---
libc/src/math/amdgpu/remainder.cpp | 19 -------------------
libc/src/math/amdgpu/remainderf.cpp | 19 -------------------
libc/src/math/nvptx/remainder.cpp | 19 -------------------
libc/src/math/nvptx/remainderf.cpp | 19 -------------------
4 files changed, 76 deletions(-)
delete mode 100644 libc/src/math/amdgpu/remainder.cpp
delete mode 100644 libc/src/math/amdgpu/remainderf.cpp
delete mode 100644 libc/src/math/nvptx/remainder.cpp
delete mode 100644 libc/src/math/nvptx/remainderf.cpp
diff --git a/libc/src/math/amdgpu/remainder.cpp b/libc/src/math/amdgpu/remainder.cpp
deleted file mode 100644
index 9027204312e009..00000000000000
--- a/libc/src/math/amdgpu/remainder.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-//===-- Implementation of the GPU remainder function ----------------------===//
-//
-// 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/remainder.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
-
-namespace LIBC_NAMESPACE_DECL {
-
-LLVM_LIBC_FUNCTION(double, remainder, (double x, double y)) {
- return __builtin_remainder(x, y);
-}
-
-} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/amdgpu/remainderf.cpp b/libc/src/math/amdgpu/remainderf.cpp
deleted file mode 100644
index 50df3b2ce25c19..00000000000000
--- a/libc/src/math/amdgpu/remainderf.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-//===-- Implementation of the GPU remainderf function ---------------------===//
-//
-// 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/remainderf.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
-
-namespace LIBC_NAMESPACE_DECL {
-
-LLVM_LIBC_FUNCTION(float, remainderf, (float x, float y)) {
- return __builtin_remainderf(x, y);
-}
-
-} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/nvptx/remainder.cpp b/libc/src/math/nvptx/remainder.cpp
deleted file mode 100644
index 9027204312e009..00000000000000
--- a/libc/src/math/nvptx/remainder.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-//===-- Implementation of the GPU remainder function ----------------------===//
-//
-// 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/remainder.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
-
-namespace LIBC_NAMESPACE_DECL {
-
-LLVM_LIBC_FUNCTION(double, remainder, (double x, double y)) {
- return __builtin_remainder(x, y);
-}
-
-} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/nvptx/remainderf.cpp b/libc/src/math/nvptx/remainderf.cpp
deleted file mode 100644
index 50df3b2ce25c19..00000000000000
--- a/libc/src/math/nvptx/remainderf.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-//===-- Implementation of the GPU remainderf function ---------------------===//
-//
-// 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/remainderf.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
-
-namespace LIBC_NAMESPACE_DECL {
-
-LLVM_LIBC_FUNCTION(float, remainderf, (float x, float y)) {
- return __builtin_remainderf(x, y);
-}
-
-} // namespace LIBC_NAMESPACE_DECL
More information about the libc-commits
mailing list