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
New exp2 function algorithm:
1) Improved performance: 8.176 vs 15.270 by core-math perf tool.
2) Improved accuracy. Only two special values left.
3) Lookup table size reduced twice.
Differential Revision: https://reviews.llvm.org/D129005
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
The floating point functions all use the same inf and nan formatting. By
separating this functionality out of the %a conversion I make it
available for reuse by %f/e/g.
Reviewed By: lntue, sivachandra
Differential Revision: https://reviews.llvm.org/D129665
The standard says two equal pointers must compare equal
so there is no need to call the user comparator function
in this case.
Differential Revision: https://reviews.llvm.org/D130310
With correctly rounded implementations, these functions will be tested for all
rounding modes. Since fegetround and fesetround are not implemented for arm32,
these tests will fail in all non-default rounding modes. We will re-enable
these entrypoints and tests once fegetround and fesetround are implemented for
arm32.
Add float type and flag for nearest integer to automatically test with
and without SSE4.2 flag.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D129916
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
This patch adds all the string and stdlib entrypoints, as well as a few
math entrypoints to the arm32 build.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D129821
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 integration tests use the loader which sets up the main thread's
self object. So, all integration tests have to depend on the threads
implementation.
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
Move the constants for printf's return values into core_structs, and
update the converters to match.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D128767
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.
A detached thread cleans itself up at completion. So, the CLEAR_TID memory is
also gone by the time the kernel tries to signal potential waiters. By nulling
the CLEAR_TID address, we prevent the kernel from signalling at a non-existent
futex location.
Previosly, a pointer to the thread data structure was stored in the
start args. However, the thread data structure need not have the
lifetime of the thread. On the the other hand, thread attributes are
stored on the thread stack so they live as long as the thread lives.
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