Migrating all private STL code to the standard STL case but keeping it under the CPP namespace to avoid confusion. Starting with the type_traits header.
Differential Revision: https://reviews.llvm.org/D130727
Printf's integer converter has been modified to use the new converter. In
future, it will be used to implement other parts of the libc.
Reviewed By: michaelrj
Differential Revision: https://reviews.llvm.org/D130227
Currently, there are two string parsers that can be used in a call to
strtofloatingpoint. There is the main parser used by Clinger's fast path
and Eisel-Lemire, and the backup parser used by Simple Decimal
Conversion. There was a bug in the backup parser where if the number had
more than 800 digits (the size of the SDC buffer) before the decimal
point, it would just ignore the digits after the 800th and not count
them into the exponent. This patch fixes that issue and adds regression
tests.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D130032
The API in StringView.h for remove_prefix was incorrect and was returning a
new StringView rather than just altering the view.
As part of this, also removed some of the safety features. The comment
correctly noted that the behaviour is undefined in some cases,
but the code and test cases checked for that.
One caller was relying on the old behaviour, so fixed it and added some
comments.
Tested:
check-libc
llvmlibc
libc-loader-tests
Reviewed By: gchatelet
Differential Revision: https://reviews.llvm.org/D129950
This adds functionality for rounding towards negative inf, positive inf,
and zero to the float hex conversion (%a).
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D129702
Add support for three more string_view functions
1) starts_with(char)
2) ends_with(char)
3) find_first_of(char, size_t)
Reimplemented trim in terms of the new starts_with and ends_with.
Tested:
New unit tests.
Reviewed By: gchatelet
Differential Revision: https://reviews.llvm.org/D129618
The specified rounding mode will be used and restored
to what it was before the test ran.
Additionally, it moves ForceRoundingMode and RoundingMode
out of MPFRUtils to be used in more places.
Differential Revision: https://reviews.llvm.org/D129685
This is simple switch from a unittest to an integration test. It is
being done as a preparatory step to adding TLS support to thread
creation. TLS setup and initialization is tightly coupled with the
loader and hence all thread related tests should be integration tests.
This patch adds the %a/A conversions to printf, as well as the compiler
flag to disable floating point handling entirely. This will allow our
printf implementation to display every type of argument allowed by
printf, although some formats are still incomplete.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D129240
This adds dependencies on the corresponding sqrt function to each
generic sqrt test. This is so that on platforms that don't support the
math functions, the tests are not run.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D129388
In Fuchsia, all tests in a directory, ie stdlib, are linked
into one executable, this causes problems for multiple
definitions of the vtables of the div tests because their
class has the same name. This patch just trivially changes
their name to be unique between all div tests.
Differential revision: https://reviews.llvm.org/D129248
Previous implementation splits value ranges around threads. Because of
very different performance of testing functions over different ranges,
CPU utilization were poor. Current implementation split test range
over small pieces and threads take the pieces when they finish with
previous. Therefore the CPU load is constant during testing.
Differential Revision: https://reviews.llvm.org/D128995
Bots have been failing in full build mode because ´#include <sstream>´ would pull pthread which is not possible when code is compiled with ´-freestanding´.
Differential Revision: https://reviews.llvm.org/D128809
This patch adds %n to printf, as well as a compiler flag to disable it.
This is due to it having serious security issues when misused.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D127517
The unit tests introduced in patch D128335 are causing build failures,
and the fix is non-trivial. This patch disables these tests temporarily
until a proper fix can be implemented.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D128746
This patch fixes the problem the bots were having with the algorithm
test not including pthreads correctly. They will likely need a manual
forced clean build for this to take effect.
Differential Revision: https://reviews.llvm.org/D128742
This patch is a subpart of D125768 intented to make the review easier.
This patch introduces the same algorithms as in `libc/src/string/memory_utils/elements.h` but using the new API.
Differential Revision: https://reviews.llvm.org/D128335
This is a implementation of find remainder fmod function from standard libm.
The underline algorithm is developed by myself, but probably it was first
invented before.
Some features of the implementation:
1. The code is written on more-or-less modern C++.
2. One general implementation for both float and double precision numbers.
3. Spitted platform/architecture dependent and independent code and tests.
4. Tests covers 100% of the code for both float and double numbers. Tests cases with NaN/Inf etc is copied from glibc.
5. The new implementation in general 2-4 times faster for “regular” x,y values. It can be 20 times faster for x/y huge value, but can also be 2 times slower for double denormalized range (according to perf tests provided).
6. Two different implementation of division loop are provided. In some platforms division can be very time consuming operation. Depend on platform it can be 3-10 times slower than multiplication.
Performance tests:
The test is based on core-math project (https://gitlab.inria.fr/core-math/core-math). By Tue Ly suggestion I took hypot function and use it as template for fmod. Preserving all test cases.
`./check.sh <--special|--worst> fmodf` passed.
`CORE_MATH_PERF_MODE=rdtsc ./perf.sh fmodf` results are
```
GNU libc version: 2.35
GNU libc release: stable
21.166 <-- FPU
51.031 <-- current glibc
37.659 <-- this fmod version.
```
This is mostly a mechanical change. In a future pass, all tests from
pthread which create threads will also be converted to integration tests.
Some of thread related features are tightly coupled with the loader. So,
they can only be tested with the in-house loader. Hence, going forward, all
tests which create threads will have to be integration tests.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D128381
This patch is a subpart of D125768 intented to make the review easier.
The `SizedOp` struct represents operations to be performed on a certain number of bytes.
It is responsible for breaking them down into platform types and forwarded to the `Backend`.
The `Backend` struct represents a lower level abstraction that works only on types (`uint8_t`, `__m128i`, ...).
It is similar to instruction selection.
Differential Revision: https://reviews.llvm.org/D126768