Age | Commit message (Collapse) | Author | Files | Lines |
|
We compute atan2f(y, x) in 2 stages:
- Fast step: perform computations in double precision , with relative
errors < 2^-50
- Accurate step: if the result from the Fast step fails Ziv's rounding
test, then we perform computations in double-double precision, with
relative errors < 2^-100.
On Ryzen 5900X, worst-case latency is ~ 200 clocks, compared to average
latency ~ 60 clocks, and average reciprocal throughput ~ 20 clocks.
|
|
Fixes #86928
|
|
Fixes: #85287
|
|
This includes algorithm.h directly to provide the definition for
`cpp:max` in parser.h. This will define `max(...)` in the libc namespace
for build systems that pull in parser.h explicitly.
|
|
In continuation to: #87097
|
|
Resolves #81685. This adds support for wN and wfN length modifiers in
fprintf.
|
|
functions. (#86924)"
This reverts commit 7c1c07c92099d3e36e8f362706a5824ab04bdf38.
Fails in presubmit.
Link: https://lab.llvm.org/buildbot/#/builders/90/builds/67461
Link: https://lab.llvm.org/buildbot/#/builders/225/builds/33519
Link: https://lab.llvm.org/buildbot/#/builders/163/builds/53858
Link: https://lab.llvm.org/buildbot/#/builders/250/builds/20983
Link: #86924
|
|
(#86924)
Updates the special case of pseudo infinty as pointed in #85940
|
|
{,u}fromfp{,x}* (#86892)
See
https://github.com/llvm/llvm-project/pull/86692#issuecomment-2024044889
and
https://github.com/llvm/llvm-project/pull/86892#discussion_r1542276037.
cc @lntue @nickdesaulniers
|
|
Critically, we don't want to return an iterator to the end of the underlying
cpp::array "store." Add a test to catch this issue.
This will be used by __cxa_finalize to iterate backwards through a FixedVector.
Link: #85651
|
|
Otherwise we need to pull in stddef.h for the declaration of NULL.
|
|
This is required to avoid multiple definitions error.
|
|
Hello,
So, I worked on the fmaximum and fminimum functions recently and the
reviewers suggested the structure:
```
if (bitsx ...)
return ...;
if (bitsy ..)
return
...
return ...;
```
So I went ahead and did the same for fmin and fmax. I hope this isnt an
issue for you all. thanks.
---------
Co-authored-by: Job Hernandez <h93@protonmail.com>
|
|
Fixes #86546 and removes the macro `LIBC_HAS_BUILTIN`. This was
necessary to support older compilers that did not support
`__has_builtin`. All of the compilers we support already have this
builtin.
See: https://libc.llvm.org/compiler_support.html
All uses now use `__has_builtin` directly
cc @nickdesaulniers
|
|
Flush out the remaining UInt<128> support and add test coverage.
We could have used cpp::popcount in the implementation of
UInt::has_single_bit, but
has_single_bit has a perhaps useful early return.
|
|
The arm32 buildbot reports an error because UInt::operator bool() is explicit,
thus an explicit cast is necessary.
Link: #85940
|
|
Summary:
This needs to go after `extern "C"`.
|
|
Resolves #86547
Replace occurrences of the macro `LIBC_HAS_ATTRIBUTE` with `__has_attribute`.
|
|
Removes unused header includes from `strfrom*()` implementation files.
|
|
The usage of __builtin_unreachable after calls to quick_exit were distressing.
If a function is properly marked [[noreturn]] then __builtin_unreachable is not
necessary.
Looking into this further, we seem to have header only implementations for CPU
targets. The inline nature of these functions is curious; we're going to exit,
it doesn't matter if we need to pay the call of a function or not. If we just
make these functions have distinct TUs rather than be header only, we can clean
up the cmake rules for quick_exit which were different between CPU and GPU.
Remove darwin support for quick_exit. This isn't being tested, and we can bring
it back when necessary.
|
|
Fixes: #85286
|
|
(#86016)
Fixes https://github.com/llvm/llvm-project/issues/85496.
---------
Co-authored-by: Job Hernandez <h93@protonmail.com>
|
|
fixes #86449
|
|
|
|
Fixes #85279.
cc @lntue
|
|
Follow up to #85438.
Implements the functions `strfromd()` and `strfroml()` introduced in
C23, and unifies the testing framework for `strfrom*()` functions.
|
|
Im working on the floating point fmaximum and fminimum functions right
now in a different pr and I ran the individual tests by doing
```
ninja libc.test.src.math.smoke.<func>_test.__unit__
```
|
|
I'm trying to break up the pieces of supporting __cxa_finalize into smaller
commits. Provide this symbol first, and make use of it from exit.
Next will be to store __dso_handle, then finally to only run callbacks that
were registered from a specific dso.
Link: #85651
Link: https://itanium-cxx-abi.github.io/cxx-abi/abi.html#dso-dtor
|
|
This is a reland of #86147 but with a proper `base()` function.
https://en.cppreference.com/w/cpp/iterator/reverse_iterator/operator_cmp
|
|
Reverts llvm/llvm-project#86147
|
|
https://en.cppreference.com/w/cpp/iterator/reverse_iterator/operator_cmp
|
|
SYS_rename may be unavailable on architectures such as aarch64 and
riscv.
rename can be implemented in terms of SYS_rename, SYS_renameat, or
SYS_renameat2. I don't have a full picture of the history here, but it
seems
that SYS_renameat might also be unavailable on some platforms.
`man 2 rename` mentions that SYS_renameat2 was added in Linux 3.15. We
don't
need to support such ancient kernel versions prior.
Link: #84980
Link: #85068
|
|
This will replace `__builtin_is_constant_evaluated` in math_extras.h.
|
|
Adds stdio.h's rename() function as defined in n3096. Fixes #84980.
|
|
Fixes #84244.
Implements the function `strfromf()` introduced in C23, and adds shared
utilities for implementation of other `strfrom*()` functions, including
`strfromd()` and `strfroml()`.
|
|
|
|
Summary:
Currently we print `null` for the null pointer in a `%s` expression.
Although it's not defined by the standard, other implementations choose
to use `(null)` to indicate this. We also currently print `(nullptr)` so
I think it's more consistent to use parens in both cases.
|
|
Towards the goal of implementing __cxa_finalize (#85651) I'd like to be able to
reverse iterate over cpp::arrays such as the one used in FixedVector.
Implement the enough iterator support to be able to iterate a cpp::array in
reverse, and add tests.
Of note, reverse iterator's begin() refers to forward iterator's end() (and
vice versa). When dereferenced (operator*), the reverse iterator returns a copy
that's been pre-decremented (the underlying forward iterator is advanced).
|
|
gcc bot failures with `atanf(+-Inf)`:
https://lab.llvm.org/buildbot/#/builders/250/builds/20331/steps/8/logs/stdio
|
|
Fix aarch64 and gcc full build bots:
https://lab.llvm.org/buildbot/#/builders/223/builds/38235/steps/4/logs/stdio
|
|
Simplify the range reduction logic and computations. Performance test
using `perf.sh` from CORE-MATH project on Ryzen 5900X:
Before:
```
$ ./perf.sh atanf --rdtsc --path1
LIBC-location: /home/lnt/experiment/llvm-project/build/projects/libc/lib/libllvmlibc.a
GNU libc version: 2.35
GNU libc release: stable
-- CORE-MATH reciprocal throughput --
[####################] 100 %
Ntrial = 20 ; Min = 14.369 + 0.556 clc/call; Median-Min = 0.613 clc/call; Max = 15.061 clc/call;
-- System LIBC reciprocal throughput --
[####################] 100 %
Ntrial = 20 ; Min = 26.180 + 0.015 clc/call; Median-Min = 0.014 clc/call; Max = 26.260 clc/call;
-- LIBC reciprocal throughput --
[####################] 100 %
Ntrial = 20 ; Min = 21.237 + 0.022 clc/call; Median-Min = 0.020 clc/call; Max = 21.272 clc/call;
$ ./perf.sh atanf --rdtsc --path1 --latency
LIBC-location: /home/lnt/experiment/llvm-project/build/projects/libc/lib/libllvmlibc.a
GNU libc version: 2.35
GNU libc release: stable
-- CORE-MATH latency --
[####################] 100 %
Ntrial = 20 ; Min = 50.505 + 0.045 clc/call; Median-Min = 0.037 clc/call; Max = 50.579 clc/call;
-- System LIBC latency --
[####################] 100 %
Ntrial = 20 ; Min = 62.438 + 0.836 clc/call; Median-Min = 0.049 clc/call; Max = 64.498 clc/call;
-- LIBC latency --
[####################] 100 %
Ntrial = 20 ; Min = 67.781 + 0.546 clc/call; Median-Min = 0.028 clc/call; Max = 68.844 clc/call;
```
After:
```
$ ./perf.sh atanf --rdtsc --path2
LIBC-location: /home/lnt/experiment/llvm/llvm-project/build/projects/libc/lib/libllvmlibc.a
GNU libc version: 2.35
GNU libc release: stable
-- CORE-MATH reciprocal throughput --
[####################] 100 %
Ntrial = 20 ; Min = 14.400 + 0.353 clc/call; Median-Min = 0.404 clc/call; Max = 14.863 clc/call;
-- System LIBC reciprocal throughput --
[####################] 100 %
Ntrial = 20 ; Min = 25.247 + 0.783 clc/call; Median-Min = 0.714 clc/call; Max = 26.238 clc/call;
-- LIBC reciprocal throughput --
[####################] 100 %
Ntrial = 20 ; Min = 13.751 + 0.158 clc/call; Median-Min = 0.140 clc/call; Max = 14.006 clc/call;
$ ./perf.sh atanf --rdtsc --path2 --latency
LIBC-location: /home/lnt/experiment/llvm/llvm-project/build/projects/libc/lib/libllvmlibc.a
GNU libc version: 2.35
GNU libc release: stable
-- CORE-MATH latency --
[####################] 100 %
Ntrial = 20 ; Min = 51.837 + 0.073 clc/call; Median-Min = 0.058 clc/call; Max = 52.000 clc/call;
-- System LIBC latency --
[####################] 100 %
Ntrial = 20 ; Min = 62.487 + 1.878 clc/call; Median-Min = 1.965 clc/call; Max = 64.569 clc/call;
OK
-- LIBC latency --
[####################] 100 %
Ntrial = 20 ; Min = 55.414 + 1.312 clc/call; Median-Min = 0.345 clc/call; Max = 58.362 clc/call;
```
|
|
Reland of #84991
A downstream overlay mode user ran into issues with the isnan macro not
working in our sources with a specific libc configuration. This patch
replaces the last direct includes of math.h with our internal
math_macros.h, along with the necessary build system changes.
|
|
fixes: #85150
|
|
|
|
This addresses a build error introduced by
5a75242bc898886b9833e328ad5f656246424a81.
|
|
This is required to avoid compilation error in libc++.
See #85335 for more details.
|
|
Fixes #85283.
cc @lntue
|
|
See https://github.com/llvm/llvm-project/issues/85283.
I had a test for `nextdownl` that was failing and I thought I should add
`nextupl` and `nextdownl` later and first make a PR for the other
functions.
cc @lntue
|
|
Continuing #84689, this one required more changes than the others, so I
am making it a separate PR.
Extends some stuff in `str_to_float.h`, `str_to_integer.h` to work on
types wider than `unsigned long long` and `uint64_t`.
cc @lntue for review.
|
|
The cpp namespace should only be used to mirror APIs from C++'s std::
namespace
(at least until we share more code with libc++, see
https://discourse.llvm.org/t/rfc-project-hand-in-hand-llvm-libc-libc-code-sharing/77701)
|