[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 09:34:56 PDT 2024


jhuber6 wrote:

> > > Godbolt link is wrong, pointing to sin. This is a directly legal instruction so less explanation is needed too
> > 
> > 
> > The old version in the LLVM libm was just `sin(double x) { return __ocml_sin_f64(x); }` the IR here is from that.
> 
> But this patch is for rint, sin is not related?

Oh, sorry. This is the internal utility function that the LLVM libm uses to implement things like `sin`. It previously was not using `__builtin_rint` because we didn't have this special-case like the x64 and aarch64 targets use so it was generating less efficient code.

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


More information about the libc-commits mailing list