[libc-commits] [libc] [libc] Fix math failures for float128 on AMDGPU and fmod for NVPTX (PR #213168)
Joseph Huber via libc-commits
libc-commits at lists.llvm.org
Fri Jul 31 08:26:06 PDT 2026
https://github.com/jhuber6 updated https://github.com/llvm/llvm-project/pull/213168
>From b005695af3ddde9953645a59b0042878a6956845 Mon Sep 17 00:00:00 2001
From: Joseph Huber <huberjn at outlook.com>
Date: Thu, 30 Jul 2026 18:13:15 -0500
Subject: [PATCH] [libc] Fix math failures for float128 on AMDGPU and fmod for
NVPTX
Summary:
Fixes some failing tests. Fmod's builtin has improper handling in the
NVPTX instruction so we should just use the generic version for now. The
Float128 implementation seems to have had some undefined behavior for
out of range behavior that only showed up now. Hopefully someone can
tell me if this is fixed correctly.
---
libc/src/math/nvptx/CMakeLists.txt | 16 ----------------
libc/src/math/nvptx/fmod.cpp | 19 -------------------
libc/src/math/nvptx/fmodf.cpp | 19 -------------------
3 files changed, 54 deletions(-)
delete mode 100644 libc/src/math/nvptx/fmod.cpp
delete mode 100644 libc/src/math/nvptx/fmodf.cpp
diff --git a/libc/src/math/nvptx/CMakeLists.txt b/libc/src/math/nvptx/CMakeLists.txt
index e27c316ff20ca..78797092622a3 100644
--- a/libc/src/math/nvptx/CMakeLists.txt
+++ b/libc/src/math/nvptx/CMakeLists.txt
@@ -110,22 +110,6 @@ add_entrypoint_object(
../fminf.h
)
-add_entrypoint_object(
- fmod
- SRCS
- fmod.cpp
- HDRS
- ../fmod.h
-)
-
-add_entrypoint_object(
- fmodf
- SRCS
- fmodf.cpp
- HDRS
- ../fmodf.h
-)
-
add_entrypoint_object(
nearbyint
SRCS
diff --git a/libc/src/math/nvptx/fmod.cpp b/libc/src/math/nvptx/fmod.cpp
deleted file mode 100644
index 49d19c4decb96..0000000000000
--- a/libc/src/math/nvptx/fmod.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-//===-- Implementation of the fmod 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/fmod.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
-
-namespace LIBC_NAMESPACE_DECL {
-
-LLVM_LIBC_FUNCTION(double, fmod, (double x, double y)) {
- return __builtin_fmod(x, y);
-}
-
-} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/nvptx/fmodf.cpp b/libc/src/math/nvptx/fmodf.cpp
deleted file mode 100644
index 8fbcb0cc2ad9e..0000000000000
--- a/libc/src/math/nvptx/fmodf.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-//===-- Implementation of the fmodf 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/fmodf.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
-
-namespace LIBC_NAMESPACE_DECL {
-
-LLVM_LIBC_FUNCTION(float, fmodf, (float x, float y)) {
- return __builtin_fmodf(x, y);
-}
-
-} // namespace LIBC_NAMESPACE_DECL
More information about the libc-commits
mailing list