[libc-commits] [libc] [libc][math][c23] implement C23 math function asinpif16 (PR #146226)

via libc-commits libc-commits at lists.llvm.org
Mon Jul 14 10:51:28 PDT 2025


================

----------------
overmighty wrote:

I ran new benchmarks:

| Test case                                           | Denormal range | Normal range |
|-----------------------------------------------------|----------------|--------------|
| **Intel Core i7-13700H** (F16C, `-march=native`)    |                |              |
| `double`, unnecessary except. values (current PR)   | 31.49 ns       | 17.51 ns     |
| `double`, no except. values                         | 31.25 ns       | 17.29 ns     |
| `float`, degree-13 polynomial, 4 except. values     | 29.34 ns       | 16.47 ns     |
| `float`, degree-11 polynomial, 10 except. values    | 28.27 ns       | 16.00 ns     |
| **Google Tensor G3** (FEAT_FP16, `-mcpu=cortex-x3`) |                |              |
| `double`, unnecessary except. values (current PR)   | 8.82 ns        | 4.51 ns      |
| `double`, no except. values                         | 8.54 ns        | 4.23 ns      |
| `float`, degree-13 polynomial, 4 except. values     | 9.18 ns        | 4.47 ns      |
| `float`, degree-11 polynomial, 10 except. values    | 8.72 ns        | 4.33 ns      |

It makes more sense to optimize for targets with full hardware support for float16, so I suggest you just remove the exceptional value handling (the current implementation actually doesn't have any exceptional values) and we keep using `double` for the polynomial and intermediate results.

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


More information about the libc-commits mailing list