This is an archive of the discontinued LLVM Phabricator instance.

[libc] Add x86_64 implementations of double precision cos, sin and tan.
ClosedPublic

Authored by sivachandra on May 12 2021, 10:03 PM.

Details

Summary

The implementations use the x86_64 FPU instructions. These instructions
are extremely slow compared to a polynomial based software
implementation. Also, their accuracy falls drastically once the input
goes beyond 2PI. To improve both the speed and accuracy, we will be
taking the following approach going forward:

  1. As a follow up to this CL, we will implement a range reduction algorithm

which will expand the accuracy to the entire double precision range.

  1. After that, we will replace the HW instructions with a polynomial

implementation to improve the run time.

After step 2, the implementations will be accurate, performant and target
architecture independent.

Diff Detail

Event Timeline

sivachandra created this revision.May 12 2021, 10:03 PM
sivachandra requested review of this revision.May 12 2021, 10:03 PM
lntue accepted this revision.May 13 2021, 10:27 AM
This revision is now accepted and ready to land.May 13 2021, 10:27 AM
This revision was landed with ongoing or failed builds.May 13 2021, 12:02 PM
This revision was automatically updated to reflect the committed changes.