| Age | Commit message (Collapse) | Author |
|
src/__support/math folder. (#150697)
Part of #147386
in preparation for:
https://discourse.llvm.org/t/rfc-make-clang-builtin-math-functions-constexpr-with-llvm-libc-to-support-c-23-constexpr-math-functions/86450
|
|
Adding smoke tests for shared math header.
part of #147386
|
|
src/__support/math folder. (#148411)
Part of #147386
in preparation for:
https://discourse.llvm.org/t/rfc-make-clang-builtin-math-functions-constexpr-with-llvm-libc-to-support-c-23-constexpr-math-functions/86450
|
|
Add tests for signaling NaNs, and fix function behavior for handling
signaling NaN input.
Fixes https://github.com/llvm/llvm-project/issues/124812
|
|
LIBC_MATH_SKIP_ACCURATE_PASS is set. (#130811)
|
|
(#130700)
|
|
|
|
This is a part of #97655.
|
|
declaration" (#98593)
Reverts llvm/llvm-project#98075
bots are broken
|
|
This is a part of #97655.
|
|
Part of #95250.
|
|
|
|
- [libc][NFC] Rename FPBits nan functions
- rename build_signaling_nan in signaling_nan
- rename build_quiet_nan to quiet_nan
|
|
|
|
- reland #79113
- Fix aarch64 RISC-V build
|
|
Reverts llvm/llvm-project#79113
It broke aarch64 build bot machines.
|
|
This patch reduces the surface of `FPBits`.
|
|
Another patch is needed to cover `DyadicFloat` and `NormalFloat`
constructors.
|
|
This one might be a bit controversial since the terminology has been
introduced from the start but I think `FRACTION_LEN` is a better name
here. AFAICT it really is "the number of bits after the decimal dot when
the number is in normal form."
`MANTISSA_WIDTH` is less precise as it's unclear whether we take the
leading bit into account.
This patch also renames most of the properties to use the `_LEN` suffix
and fixes useless casts or variables.
|
|
Same as #75362, the traits does not bring a lot of value over
`FloatProperties::MANTISSA_WIDTH` (or `FPBits::MANTISSA_WIDTH`).
|
|
This is step 4 of
https://discourse.llvm.org/t/rfc-customizable-namespace-to-allow-testing-the-libc-when-the-system-libc-is-also-llvms-libc/73079
|
|
Differential Revision: https://reviews.llvm.org/D146738
|
|
Set FE_OVERFLOW and FE_UNDERFLOW for expf, exp2f, exp10f, expm1f, sinhf
and coshf.
Reviewed By: sivachandra, renyichen
Differential Revision: https://reviews.llvm.org/D144340
|
|
|
|
|
|
|
|
|
|
|
|
This implements the same behavior as D141997 but makes sure that the same detection mechanism is used between CMake and source code.
Reviewed By: sivachandra, lntue
Differential Revision: https://reviews.llvm.org/D142108
|
|
try_compile instead of try_run."
The build bots are failing.
This reverts commit c84d74f5bfe810744de1268eb0516a6622e4aa73.
|
|
try_run.
This implements the same behavior as D141997 but makes sure that the same detection mechanism is used between CMake and source code.
Differential Revision: https://reviews.llvm.org/D142108
|
|
instead of try_run."
Build bots are failing.
https://lab.llvm.org/buildbot/#/builders/90/builds/44634
This reverts commit 9acc2f37bdfce08ca0c2faec03392db10d1bb7a9.
|
|
This implements the same behavior as D141997 but makes sure that the same detection mechanism is used between CMake and source code.
Differential Revision: https://reviews.llvm.org/D142108
|
|
Implement acosf function correctly rounded for all rounding modes.
We perform range reduction as follows:
- When `|x| < 2^(-10)`, we use cubic Taylor polynomial:
```
acos(x) = pi/2 - asin(x) ~ pi/2 - x - x^3 / 6.
```
- When `2^(-10) <= |x| <= 0.5`, we use the same approximation that is used for `asinf(x)` when `|x| <= 0.5`:
```
acos(x) = pi/2 - asin(x) ~ pi/2 - x - x^3 * P(x^2).
```
- When `0.5 < x <= 1`, we use the double angle formula: `cos(2y) = 1 - 2 * sin^2 (y)` to reduce to:
```
acos(x) = 2 * asin( sqrt( (1 - x)/2 ) )
```
- When `-1 <= x < -0.5`, we reduce to the positive case above using the formula:
```
acos(x) = pi - acos(-x)
```
Performance benchmark using perf tool from the CORE-MATH project on Ryzen 1700:
```
$ CORE_MATH_PERF_MODE="rdtsc" ./perf.sh acosf
GNU libc version: 2.35
GNU libc release: stable
CORE-MATH reciprocal throughput : 28.613
System LIBC reciprocal throughput : 29.204
LIBC reciprocal throughput : 24.271
$ CORE_MATH_PERF_MODE="rdtsc" ./perf.sh asinf --latency
GNU libc version: 2.35
GNU libc release: stable
CORE-MATH latency : 55.554
System LIBC latency : 76.879
LIBC latency : 62.118
```
Reviewed By: orex, zimmermann6
Differential Revision: https://reviews.llvm.org/D133550
|
|
Implement asinf function correctly rounded for all rounding modes.
For `|x| <= 0.5`, we approximate `asin(x)` by
```
asin(x) = x * P(x^2)
```
where `P(X^2) = Q(X)` is a degree-20 minimax even polynomial approximating
`asin(x)/x` on `[0, 0.5]` generated by Sollya with:
```
> Q = fpminimax(asin(x)/x, [|0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20|],
[|1, D...|], [0, 0.5]);
```
When `|x| > 0.5`, we perform range reduction as follow:
Assume further that `0.5 < x <= 1`, and let:
```
y = asin(x)
```
We will use the double angle formula:
```
cos(2X) = 1 - 2 sin^2(X)
```
and the complement angle identity:
```
x = sin(y) = cos(pi/2 - y)
= 1 - 2 sin^2 (pi/4 - y/2)
```
So:
```
sin(pi/4 - y/2) = sqrt( (1 - x)/2 )
```
And hence:
```
pi/4 - y/2 = asin( sqrt( (1 - x)/2 ) )
```
Equivalently:
```
asin(x) = y = pi/2 - 2 * asin( sqrt( (1 - x)/2 ) )
```
Let `u = (1 - x)/2`, then
```
asin(x) = pi/2 - 2 * asin(u)
```
Moreover, since `0.5 < x <= 1`,
```
0 <= u < 1/4, and 0 <= sqrt(u) < 0.5.
```
And hence we can reuse the same polynomial approximation of `asin(x)` when
`|x| <= 0.5`:
```
asin(x) = pi/2 - 2 * u * P(u^2).
```
Performance benchmark using `perf` tool from the CORE-MATH project on Ryzen 1700:
```
$ CORE_MATH_PERF_MODE="rdtsc" ./perf.sh asinf
CORE-MATH reciprocal throughput : 23.418
System LIBC reciprocal throughput : 27.310
LIBC reciprocal throughput : 22.741
$ CORE_MATH_PERF_MODE="rdtsc" ./perf.sh asinf --latency
GNU libc version: 2.35
GNU libc release: stable
CORE-MATH latency : 58.884
System LIBC latency : 62.055
LIBC latency : 62.037
```
Reviewed By: orex, zimmermann6
Differential Revision: https://reviews.llvm.org/D133400
|