[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:15:09 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:

Does AMD ignore the rounding mode? We don't support strictfp so I guess that's related?

https://github.com/llvm/llvm-project/pull/98345


More information about the libc-commits mailing list