llvm-project/libc
Tue Ly e15b2da42f [libc][math] Simplify tanf implementation and improve its performance.
Simplify `tanf` implementation and improve its performance.

Completely reuse the implementation of `sinf`, `cosf`, `sincosf` and use
the definition `tan(x) = sin(x)/cos(x)`.

Performance benchmark using perf tool from the CORE-MATH project on Ryzen 1700:
```
$ CORE_MATH_PERF_MODE="rdtsc" ./perf.sh tanf
GNU libc version: 2.35
GNU libc release: stable
CORE-MATH reciprocal throughput   : 18.558
System LIBC reciprocal throughput : 49.919

BEFORE:
LIBC reciprocal throughput        : 36.480
LIBC reciprocal throughput        : 27.217    (with `-msse4.2` flag)
LIBC reciprocal throughput        : 20.205    (with `-mfma` flag)

AFTER:
LIBC reciprocal throughput        : 30.337
LIBC reciprocal throughput        : 21.072    (with `-msse4.2` flag)
LIBC reciprocal throughput        : 15.804    (with `-mfma` flag)

$ CORE_MATH_PERF_MODE="rdtsc" ./perf.sh tanf --latency
GNU libc version: 2.35
GNU libc release: stable
CORE-MATH latency   : 56.702
System LIBC latency : 107.206

BEFORE
LIBC latency        : 97.598
LIBC latency        : 91.119   (with `-msse4.2` flag)
LIBC latency        : 82.655    (with `-mfma` flag)

AFTER
LIBC latency        : 74.560
LIBC latency        : 66.575    (with `-msse4.2` flag)
LIBC latency        : 61.636    (with `-mfma` flag)
```

Reviewed By: zimmermann6

Differential Revision: https://reviews.llvm.org/D134575
2022-09-26 21:36:12 -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] Add a target to install libc in the full build mode. 2022-08-17 22:49:02 +00:00
config Implement nanosleep per https://pubs.opengroup.org/onlinepubs/009695399/basedefs/time.h.html 2022-09-24 00:13:58 +00:00
docs [libc][math] Simplify tanf implementation and improve its performance. 2022-09-26 21:36:12 -04:00
fuzzing [libc][cmake] split fputil into individual targets 2022-08-31 10:44:52 -07:00
include Implement nanosleep per https://pubs.opengroup.org/onlinepubs/009695399/basedefs/time.h.html 2022-09-24 00:13:58 +00:00
lib [libc][NFC] Change the libc fullbuild target name to "libc". 2022-08-19 07:07:30 +00:00
loader [libc] Enable a few entrypoints on aarch64 which are now available on x86_64. 2022-08-23 12:31:42 -07:00
spec Implement nanosleep per https://pubs.opengroup.org/onlinepubs/009695399/basedefs/time.h.html 2022-09-24 00:13:58 +00:00
src [libc][math] Simplify tanf implementation and improve its performance. 2022-09-26 21:36:12 -04:00
test [libc][math] Simplify tanf implementation and improve its performance. 2022-09-26 21:36:12 -04:00
utils [libc][math] Implement exp10f function correctly rounded to all rounding modes. 2022-09-19 10:01:40 -04: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][cmake] separate installing headers 2022-09-16 15:50:28 -07: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.