Remix.run Logo
AlotOfReading 6 hours ago

The loop dependency on a poly isn't all that hard for compilers to unroll, and most correctly rounded implementations are polys. You're often paying only a couple cycles' worth of stalls.

We can see this in action. LLVM implements sin() with a correctly rounded double poly [0]. Let's ignore range reduction and throw the core into compiler explorer to be autovectorized [1]. uiCA estimates a theoretical latency for the inner loop of 15 cycles, and the code achieves 18.

I suspect most custom implementations would do worse than this.

[0] https://github.com/llvm/llvm-project/blob/165c472d65cd62eb33...

[1] https://godbolt.org/z/rGGq8aG38