[all-commits] [llvm/llvm-project] 861dc7: [libc] Add x86_64 implementations of double precis...

Siva Chandra via All-commits all-commits at lists.llvm.org
Thu May 13 12:02:27 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 861dc75906829a177dc2e5249747771aa3866a06
      https://github.com/llvm/llvm-project/commit/861dc75906829a177dc2e5249747771aa3866a06
  Author: Siva Chandra Reddy <sivachandra at google.com>
  Date:   2021-05-13 (Thu, 13 May 2021)

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

  Log Message:
  -----------
  [libc] Add x86_64 implementations of double precision cos, sin and tan.

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.

Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D102384




More information about the All-commits mailing list