llvm-project/libc
Tue Ly 15b9380dfd [libc] Change sinf range reduction to mod pi/16 to be shared with cosf.
Change `sinf` range reduction to mod pi/16 to be shared with `cosf`.

Previously, `sinf` used range reduction `mod pi`, but this cannot be used to implement `cosf` since the minimax algorithm for `cosf` does not converge due to critical points at `pi/2`.  In order to be able to share the same range reduction functions for both `sinf` and `cosf`, we change the range reduction to `mod pi/16` for the following reasons:
- The table size is sufficiently small: 32 entries for `sin(k * pi/16)` with `k = 0..31`.  It could be reduced to 16 entries if we treat the final sign separately, with an extra multiplication at the end.
- The polynomials' degrees are reduced to 7/8 from 15, with extra computations to combine `sin` and `cos` with trig sum equality.
- The number of exceptional cases reduced to 2 (with FMA) and 3 (without FMA).
- The latency is reduced while maintaining similar throughput as before.

Reviewed By: zimmermann6

Differential Revision: https://reviews.llvm.org/D130629
2022-07-27 12:23:36 -04:00
..
AOR_v20.02 Harmonize Python shebang 2020-07-16 21:53:45 +02:00
benchmarks Remove unneeded cl::ZeroOrMore for cl::opt/cl::list options 2022-06-05 00:31:44 -07:00
cmake/modules [libc] Implement sinf function that is correctly rounded to all rounding modes. 2022-07-22 10:07:31 -04:00
config [libc] Add dirent.h functions opendir, readdir, closedir and dirfd. 2022-07-25 20:23:25 +00:00
docs [libc] Change sinf range reduction to mod pi/16 to be shared with cosf. 2022-07-27 12:23:36 -04:00
fuzzing [libc][NFC] split standalone_cpp into single headers 2022-03-08 11:56:08 -08:00
include [libc] Add dirent.h functions opendir, readdir, closedir and dirfd. 2022-07-25 20:23:25 +00:00
lib Use add_llvm_install_targets for install-llvmlibc 2022-07-04 17:18:36 +00:00
loader [libc] Enable a few stdlib and time functions on aarch64. 2022-07-14 14:37:50 -07:00
spec [libc] Add dirent.h functions opendir, readdir, closedir and dirfd. 2022-07-25 20:23:25 +00:00
src [libc] Change sinf range reduction to mod pi/16 to be shared with cosf. 2022-07-27 12:23:36 -04:00
test [libc][Obvious] Use the correct StringView constructor in dirent_test. 2022-07-25 20:47:17 +00:00
utils [libc] Specify rounding mode for strto[f|d] tests 2022-07-13 20:20:30 +00:00
.clang-tidy [libc] Add a naming rule for global constants. 2022-01-19 22:11:16 +00:00
.gitignore [libc][Obvious] Add build folder to .gitignore. 2022-03-04 13:16:55 -05:00
CMakeLists.txt [libc] Implement FLAGS option for generating all combinations for targets. 2022-06-01 00:54:07 -04:00
LICENSE.TXT Rename top-level LICENSE.txt files to LICENSE.TXT 2021-03-10 21:26:24 -08:00
README.txt

README.txt

LLVM libc
=========

This directory and its subdirectories contain source code for llvm-libc,
a retargetable implementation of the C standard library.

LLVM is open source software. You may freely distribute it under the terms of
the license agreement found in LICENSE.txt.