[libc-commits] [PATCH] D102384: [libc] Add x86_64 implementations of double precision cos, sin and tan.

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Wed May 12 22:03:13 PDT 2021


sivachandra created this revision.
sivachandra added a reviewer: lntue.
Herald added subscribers: libc-commits, ecnelises, tschuett, pengfei, mgorny.
Herald added a project: libc-project.
sivachandra requested review of this revision.

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.

2. 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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D102384

Files:
  libc/config/linux/x86_64/entrypoints.txt
  libc/spec/stdc.td
  libc/src/math/CMakeLists.txt
  libc/src/math/cos.h
  libc/src/math/sin.h
  libc/src/math/tan.h
  libc/src/math/x86_64/CMakeLists.txt
  libc/src/math/x86_64/cos.cpp
  libc/src/math/x86_64/sin.cpp
  libc/src/math/x86_64/tan.cpp
  libc/test/src/math/CMakeLists.txt
  libc/test/src/math/cos_test.cpp
  libc/test/src/math/sin_test.cpp
  libc/test/src/math/tan_test.cpp
  libc/utils/MPFRWrapper/MPFRUtils.cpp
  libc/utils/MPFRWrapper/MPFRUtils.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102384.345044.patch
Type: text/x-patch
Size: 13676 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20210513/e242d26e/attachment.bin>


More information about the libc-commits mailing list