We held off on this before as `LLVM_LIBDIR_SUFFIX` conflicted with it.
Now we return this.
`LLVM_LIBDIR_SUFFIX` is kept as a deprecated way to set
`CMAKE_INSTALL_LIBDIR`. The other `*_LIBDIR_SUFFIX` are just removed
entirely.
I imagine this is too potentially-breaking to make LLVM 15. That's fine.
I have a more minimal version of this in the disto (NixOS) patches for
LLVM 15 (like previous versions). This more expansive version I will
test harder after the release is cut.
Reviewed By: sebastian-ne, ldionne, #libc, #libc_abi
Differential Revision: https://reviews.llvm.org/D130586
* In the full build mode, `ninja install-libc` will install the headers as
well the static archive named libc.a.
* In the default mode, `ninja install-llvmlibc` will only install the
static archive libllvmlibc.a.
Reviewed By: jeffbailey
Differential Revision: https://reviews.llvm.org/D132015
In the printf_core CMake, the file pieces are defined as object
libraries that depend on the File data structure. If these are added
unconditionally they'll try to evaluate that dependancy even when there
is no File available. This patch adds a guard to prevent that error.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D131921
To use the FILE data structure, LLVM-libc must be in fullbuild mode
since it expects its own implementation. This means that (f)printf can't
be used without fullbuild, but s(n)printf only uses strings. This patch
adjusts the CMake to allow for this.
Reviewed By: sivachandra, lntue
Differential Revision: https://reviews.llvm.org/D131913
To accurately measure the size of sprintf in a finished binary, the
easiest method is to simply build a binary with and without sprintf.
This patch adds an integration test that can be built with and without
sprintf, as well as targets to build it.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D131735
Implement tanf function correctly rounded for all rounding modes.
We use the range reduction that is shared with `sinf`, `cosf`, and `sincosf`:
```
k = round(x * 32/pi) and y = x * (32/pi) - k.
```
Then we use the tangent of sum formula:
```
tan(x) = tan((k + y)* pi/32) = tan((k mod 32) * pi / 32 + y * pi/32)
= (tan((k mod 32) * pi/32) + tan(y * pi/32)) / (1 - tan((k mod 32) * pi/32) * tan(y * pi/32))
```
We need to make a further reduction when `k mod 32 >= 16` due to the pole at `pi/2` of `tan(x)` function:
```
if (k mod 32 >= 16): k = k - 31, y = y - 1.0
```
And to compute the final result, we store `tan(k * pi/32)` for `k = -15..15` in a table of 32 double values,
and evaluate `tan(y * pi/32)` with a degree-11 minimax odd polynomial generated by Sollya with:
```
> P = fpminimax(tan(y * pi/32)/y, [|0, 2, 4, 6, 8, 10|], [|D...|], [0, 1.5]);
```
Performance benchmark using `perf` tool from the CORE-MATH project on Ryzen 1700:
```
$ CORE_MATH_PERF_MODE="rdtsc" ./perf.sh tanf
CORE-MATH reciprocal throughput : 18.586
System LIBC reciprocal throughput : 50.068
LIBC reciprocal throughput : 33.823
LIBC reciprocal throughput : 25.161 (with `-msse4.2` flag)
LIBC reciprocal throughput : 19.157 (with `-mfma` flag)
$ CORE_MATH_PERF_MODE="rdtsc" ./perf.sh tanf --latency
GNU libc version: 2.31
GNU libc release: stable
CORE-MATH latency : 55.630
System LIBC latency : 106.264
LIBC latency : 96.060
LIBC latency : 90.727 (with `-msse4.2` flag)
LIBC latency : 82.361 (with `-mfma` flag)
```
Reviewed By: orex
Differential Revision: https://reviews.llvm.org/D131715
Specifically, POSIX functions pthread_key_create, pthread_key_delete,
pthread_setspecific and pthread_getspecific have been added. The C
standard equivalents tss_create, tss_delete, tss_set and tss_get have
also been added.
Reviewed By: lntue, michaelrj
Differential Revision: https://reviews.llvm.org/D131647
The convert_alpha_numeric function is intentionally non-templated so
that its code can be reused for different bases in code-size sensitive
cases. Previously it was inside the IntegerToString class which created
a different version for each base.
Reviewed By: sivachandra, lntue
Differential Revision: https://reviews.llvm.org/D131725
Change sinf/cosf range reduction to mod pi/32 to be shared with tanf,
since polynomial approximations for tanf on subintervals of length pi/16 do not
provide enough accuracy.
Reviewed By: orex
Differential Revision: https://reviews.llvm.org/D131652
The functions converting integers into decimal, hexadecimal, and octal,
are all very similar. This patch moves to a combined converter to save
code size.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D131302
The default IntegerToString class only supports base 10, this patch adds
a version which supports any base between 2 and 36 inclusive. This will
be used in an upcoming patch.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D131301
Previously, the integer_to_string tests used EXPECT_TRUE(.equals)
which doesn't have useful error messages. Now they properly check
equality with the EXPECT_EQ macro, which allows for comparing the
strings more naturally.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D131300
This data structure uses a backing cpp::array object and supports a
vector like push_back API. In comparison with a traditional vector
data structure, it is of a fixed capacity and cannot be resized.
Differential Revision: https://reviews.llvm.org/D131377
Add "using" and "status" sections to the sidebar to make getting these
easier.
Fixed mobile formatting not overflow left and right.
Tested:
Chrome on Desktop, using mobile restrictions in devtools.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D131369
This design is borrowed from the lldb folks (thank you!) to declutter
the page.
* The version number at the top is removed.
* Links are pushed over to a sidebar
* The sidebar has headings
There are other minor changes:
* The warning about this project not being ready is now an RST "warning"
* Links to the Bug Reports and the Source Code are Added
* Refer to this project as either "The LLVM C LIbrary" or "The libc"
Tested:
Built locally
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D131242
This class has only the minimum functionality in it to provide what the
TZ variable parsing needs. In particular, the standard makes guarantees
about how trivial the destructors are, throws an expception if it's used
incorrectly, etc. There are also missing features.
Tested:
Trivial testsuite added, and use in development.
Reviewed By: gchatelet
Differential Revision: https://reviews.llvm.org/D129920
Since this now allows, the init/fini array iteration has been added in
a similar fashion to x86_64 and the corresponding test enabled.
Reviewed By: jeffbailey
Differential Revision: https://reviews.llvm.org/D131133
Migrating all private STL code to the standard STL case but keeping it under the CPP namespace to avoid confusion.
Differential Revision: https://reviews.llvm.org/D130771
Migrating all private STL code to the standard STL case but keeping it under the CPP namespace to avoid confusion.
Differential Revision: https://reviews.llvm.org/D130762
Migrating all private STL code to the standard STL case but keeping it under the CPP namespace to avoid confusion.
Differential Revision: https://reviews.llvm.org/D130760
Migrating all private STL code to the standard STL case but keeping it under the CPP namespace to avoid confusion.
Differential Revision: https://reviews.llvm.org/D130773