[libc-commits] [libc] [libc] Use `rint` builtin for rounding on the GPU (PR #98345)
Joseph Huber via libc-commits
libc-commits at lists.llvm.org
Wed Jul 10 11:09:10 PDT 2024
================
@@ -17,6 +17,18 @@
#include "x86_64/nearest_integer.h"
#elif defined(LIBC_TARGET_ARCH_IS_AARCH64)
#include "aarch64/nearest_integer.h"
+#elif defined(LIBC_TARGET_ARCH_IS_GPU)
+
+namespace LIBC_NAMESPACE {
+namespace fputil {
+
+LIBC_INLINE float nearest_integer(float x) { return __builtin_rintf(x); }
----------------
jhuber6 wrote:
Seems they're all equivalent except for `round` https://godbolt.org/z/78oonj91z .
https://github.com/llvm/llvm-project/pull/98345
More information about the libc-commits
mailing list