[libc-commits] [libc] [libc][math][c23] add c23 floating point fmaximum and fminimum functions. (PR #86016)
Joseph Huber via libc-commits
libc-commits at lists.llvm.org
Thu Mar 21 12:55:54 PDT 2024
jhuber6 wrote:
> > @arsenm I assume you mean for the GPU implementation? The generic implementation looks correct already since we have to support both clang and GCC.
>
> Probably for this patch, we can remove all the specializations for GPU, and only add them later if they show performance benefits? @jhuber6
The GPU should use `__builtin_fmin` and `__builtin_fmax`. This should be available for f64, f32, and f16. We don't support `f128` on the GPU at all so it can be ignored. I think in general a lot of platforms have hardware for this, so we should use `#if LIBC_HAS_BUILTIN(__builtin_fmin)` where present (Though it may require some work around zero like before.
For now however I think that it's good to have a C implementation to fall back on.
https://github.com/llvm/llvm-project/pull/86016
More information about the libc-commits
mailing list