summaryrefslogtreecommitdiff
path: root/libc/src/math/generic/log1p.cpp
AgeCommit message (Collapse)Author
2025-10-05[libc][math] Refactor exp2 implementation to header-only in ↵Muhammad Bassiouni
src/__support/math folder. (#161297) 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
2025-04-08[libc][math] Fix signaling NaN handling for math functions. (#133347)wldfngrs
Add tests for signaling NaNs, and fix function behavior for handling signaling NaN input. Fixes https://github.com/llvm/llvm-project/issues/124812
2025-03-11[libc] Provide more fine-grained control of FMA instruction for ARM targets. ↵lntue
(#130700)
2025-03-05[libc][math] Add skip accurate pass option for exp*, log*, and powf ↵lntue
functions. (#129831)
2024-11-09[libc][math] Fix log1p SEGV with large inputs when FTZ/DAZ flags are set. ↵lntue
(#115541)
2024-10-26[libc][math] Add tests and fix some issues with FTZ/DAZ modes. (#113744)lntue
2024-07-12[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace declaration (#98597)Petr Hosek
This is a part of #97655.
2024-07-12Revert "[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace ↵Mehdi Amini
declaration" (#98593) Reverts llvm/llvm-project#98075 bots are broken
2024-07-11[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace declaration (#98075)Petr Hosek
This is a part of #97655.
2024-04-06[libc][math] Update error bound for log1p to compensate for directional ↵lntue
rounding. (#87893)
2024-03-20[libc][NFC] Move `Sign` type to separate header (#85930)Guillaume Chatelet
2024-02-16[reland][libc][NFC] Use user defined literals to build 128 and 256 bit ↵Guillaume Chatelet
constants (#81998) - #81835 - Fix for platforms where uint64_t is not available
2024-02-15Revert "[reland][libc][NFC] Use user defined literals to build 128 and 256 ↵Guillaume Chatelet
bit constants" (#81882) Reverts llvm/llvm-project#81835 This is breaking arm32 which does not support 64 bit types.
2024-02-15[reland][libc][NFC] Use user defined literals to build 128 and 256 bit ↵Guillaume Chatelet
constants (#81835) This is a reland of #81746
2024-02-14Revert "[libc][NFC] Use user defined literals to build 128 and 256 bit ↵Guillaume Chatelet
constants." (#81771) Reverts llvm/llvm-project#81746
2024-02-14[libc][NFC] Use user defined literals to build 128 and 256 bit constants. ↵Guillaume Chatelet
(#81746)
2024-01-30[libc][NFC] Rename `FPBits` nan functions (#79998)Guillaume Chatelet
- [libc][NFC] Rename FPBits nan functions - rename build_signaling_nan in signaling_nan - rename build_quiet_nan to quiet_nan
2024-01-23[reland][libc] Remove unnecessary `FPBits` functions and properties (#79128)Guillaume Chatelet
- reland #79113 - Fix aarch64 RISC-V build
2024-01-23Revert "[libc] Remove unnecessary `FPBits` functions and properties" (#79118)Guillaume Chatelet
Reverts llvm/llvm-project#79113 It broke aarch64 build bot machines.
2024-01-23[libc] Remove unnecessary `FPBits` functions and properties (#79113)Guillaume Chatelet
This patch reduces the surface of `FPBits`.
2024-01-18[libc][NFC] Use the Sign type for DyadicFloat (#78577)Guillaume Chatelet
2024-01-18[libc][NFC] Introduce a Sign type for FPBits (#78500)Guillaume Chatelet
Another patch is needed to cover `DyadicFloat` and `NormalFloat` constructors.
2023-12-15[libc][NFC] Rename `MANTISSA_WIDTH` in `FRACTION_LEN` (#75489)Guillaume Chatelet
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.
2023-12-13[reland][libc][NFC] Implement `FPBits` in terms of `FloatProperties` to ↵Guillaume Chatelet
reduce clutter (#75196) (#75318) Also make type naming consistent by using `UIntType` instead of `intU_t`. This patch is a reland of #75196 but does not include the "use `FPBits` instead of `FPBits_t`, `FPB`" part. This needs more work.
2023-12-13Revert "[libc][NFC] Implement `FPBits` in terms of `FloatProperties` to ↵Guillaume Chatelet
reduce clutter" (#75304) Reverts llvm/llvm-project#75196 GCC complains about change of meaning for `FPBits` ``` /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/__support/FPUtil/generic/FMod.h:188:9: error: declaration of ‘using FPBits = struct __llvm_libc_18_0_0_git::fputil::FPBits<T>’ changes meaning of ‘FPBits’ [-fpermissive] 188 | using FPBits = FPBits<T>; | ^~~~~~ ``` I'll reland with a different name.
2023-12-13[libc][NFC] Implement `FPBits` in terms of `FloatProperties` to reduce ↵Guillaume Chatelet
clutter (#75196) Also make type naming consistent: - `UIntType` instead of `intU_t` - `FPBits` instead of `FPBits_t`, `FPB`
2023-12-11[libc][NFC] Fix mixed up biased/unbiased exponent (#75037)Guillaume Chatelet
According to [wikipedia](https://en.wikipedia.org/wiki/Exponent_bias) the "biased exponent" is the encoded form that is always positive whereas the unbiased form is the actual "real" exponent that can be positive or negative. `FPBits` seems to be using `unbiased_exponent` to describe the encoded form (unsigned). This patch simply use `biased` instead of `unbiased`.
2023-12-08[libc][NFC] Clean up conversion warnings in math function implementations. ↵lntue
(#74697)
2023-09-26[libc] Mass replace enclosing namespace (#67032)Guillaume Chatelet
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
2023-05-24[libc][bazel] Add log, log2, log10, log1p to bazel layout.Tue Ly
Add log, log2, log10, log1p and their unit tests to bazel layout. Reviewed By: gchatelet Differential Revision: https://reviews.llvm.org/D151252
2023-05-23[libc][math] Implement double precision log1p correctly rounded to all ↵Tue Ly
rounding modes. Implement double precision log1p function correctly rounded to all rounding modes. **Performance** - For `0.5 <= x <= 2`, the fast pass hitting rate is about 99.93%. - Benchmarks with `./perf.sh` tool from the CORE-MATH project, unit is (CPU clocks / call). - Reciprocal throughput from CORE-MATH's perf tool on Ryzen 5900X: ``` $ ./perf.sh log1p GNU libc version: 2.35 GNU libc release: stable -- CORE-MATH reciprocal throughput -- with FMA [####################] 100 % Ntrial = 20 ; Min = 39.792 + 1.011 clc/call; Median-Min = 0.940 clc/call; Max = 41.373 clc/call; -- CORE-MATH reciprocal throughput -- without FMA (-march=x86-64-v2) [####################] 100 % Ntrial = 20 ; Min = 87.285 + 1.135 clc/call; Median-Min = 1.299 clc/call; Max = 89.715 clc/call; -- System LIBC reciprocal throughput -- [####################] 100 % Ntrial = 20 ; Min = 20.666 + 0.123 clc/call; Median-Min = 0.125 clc/call; Max = 20.828 clc/call; -- LIBC reciprocal throughput -- with FMA [####################] 100 % Ntrial = 20 ; Min = 20.928 + 0.771 clc/call; Median-Min = 0.725 clc/call; Max = 22.767 clc/call; -- LIBC reciprocal throughput -- without FMA [####################] 100 % Ntrial = 20 ; Min = 31.461 + 0.528 clc/call; Median-Min = 0.602 clc/call; Max = 36.809 clc/call; ``` - Latency from CORE-MATH's perf tool on Ryzen 5900X: ``` $ ./perf.sh log1p --latency GNU libc version: 2.35 GNU libc release: stable -- CORE-MATH latency -- with FMA [####################] 100 % Ntrial = 20 ; Min = 77.875 + 0.062 clc/call; Median-Min = 0.051 clc/call; Max = 78.003 clc/call; -- CORE-MATH latency -- without FMA (-march=x86-64-v2) [####################] 100 % Ntrial = 20 ; Min = 101.958 + 1.202 clc/call; Median-Min = 1.325 clc/call; Max = 104.452 clc/call; -- System LIBC latency -- [####################] 100 % Ntrial = 20 ; Min = 60.581 + 1.443 clc/call; Median-Min = 1.611 clc/call; Max = 62.285 clc/call; -- LIBC latency -- with FMA [####################] 100 % Ntrial = 20 ; Min = 48.817 + 1.108 clc/call; Median-Min = 1.300 clc/call; Max = 50.282 clc/call; -- LIBC latency -- without FMA [####################] 100 % Ntrial = 20 ; Min = 61.121 + 0.599 clc/call; Median-Min = 0.761 clc/call; Max = 62.020 clc/call; ``` - Accurate pass latency: ``` $ ./perf.sh log1p --latency --simple_stat GNU libc version: 2.35 GNU libc release: stable -- CORE-MATH latency -- with FMA 760.444 -- CORE-MATH latency -- without FMA (-march=x86-64-v2) 827.880 -- LIBC latency -- with FMA 711.837 -- LIBC latency -- without FMA 764.317 ``` Reviewed By: zimmermann6 Differential Revision: https://reviews.llvm.org/D151049