aboutsummaryrefslogtreecommitdiff
path: root/libc/src
AgeCommit message (Collapse)AuthorFilesLines
13 hoursRevert "[libc] wchar string conversion functions mb to wc" (#150549)sribee89-325/+8
Reverts llvm/llvm-project#149423 Failing nullptr crash when using sanitizer
13 hours[libc] wchar string conversion functions mb to wc (#149423)sribee89-8/+325
Implemented an internal multi-byte to wide character string conversion function, public functions, and tests --------- Co-authored-by: Sriya Pratipati <sriyap@google.com>
15 hours[libc] Don't rely on LIBC_HAS_SANITIZER when enabling null checks. (#150341)Alexey Samsonov3-13/+1
LIBC_HAS_SANITIZER (which is defined if ASan, MSan, or UBSan is enabled) is currently used to implicitly disable null checks, normally enabled via LIBC_ADD_NULL_CHECKS config value. Remove this condition, and rely purely on the config value instead: * LIBC_HAS_SANITIZER will be true even for UBSan modes which doesn't rely on null checks at all (e.g. -fsanitize=alignment) * null checks today (implemented via __builtin_trap) should function normally today even when sanitizer is enabled - trap is still a trap * tests have been migrated to WITH_SIGNAL(-1) which doesn't prescript a particular signal / exit-code, and thus should pass even if sanitizers override the default ones.
15 hours[libc] Fix some warnings in tests. (#150500)lntue1-3/+6
16 hours[libc] Implement wcs to mbs family of functions (#149421)Uzair Nawaz9-0/+315
Implemented internal wcs to mbs internal function + tests Impelemented wcs to mbs public functions
18 hours[libc] Fix issue with sigjmp_buf.h not being found (#150439)William Huynh10-11/+11
When trying to use <setjmp.h>, it will try to include llvm-libc-types/sigjmp_buf.h due to the way that headergen works. This commit creates a dummy file, as the real implementation is found in llvm-libc-types/jmp_buf.h.
18 hours[libc] Implemented wcsdup libc function (#150453)Uzair Nawaz4-3/+64
Implemented wcsdup by templating internal strdup function
18 hours[libc] Implemented mblen functions (#150141)sribee85-0/+146
Implemented mblen and mbrlen as well as tests --------- Co-authored-by: Sriya Pratipati <sriyap@google.com>
32 hours[libc] Add missing libc.include.inttypes for targets including <inttypes.h>. ↵lntue1-0/+2
(#150345)
36 hours[libc][NFC] Add stdint.h proxy header to fix dependency issue with ↵lntue101-114/+148
<stdint.h> includes. (#150303) https://github.com/llvm/llvm-project/issues/149993
39 hours[libc] Add support for __builtin_is_constant_evaluated for GCC 9+. (#150322)lntue3-11/+5
https://lab.llvm.org/buildbot/#/builders/10/builds/10047/steps/5/logs/stdio
42 hours[libc] Search empty bits after failed allocation (#149910)Joseph Huber1-3/+13
Summary: The scheme we use to find a free bit is to just do a random walk. This works very well up until you start to completely saturate the bitfield. Because the result of the fetch_or yields the previous value, we can search this to go to any known empty bits as our next guess. This effectively increases our liklihood of finding a match after two tries by 32x since the distribution is random. This *massively* improves performance when a lot of memory is allocated without freeing, as it now doesn't takea one in a million shot to fill that last bit. A further change could improve this further by only *mostly* filling the slab, allowing 1% to be free at all times.
42 hours[libc] Cache the most recently used slot for a chunk size (#149751)Joseph Huber1-59/+63
Summary: This patch changes the `find_slab` logic to simply cache the most successful slot. This means the happy fast path is now a single atomic load on this index. I removed the SIMT shuffling logic that did slab lookups wave-parallel. Here I am considering the actual traversal to be comparatively unlikely, so it's not overly bad that it takes longer. ideally one thread finds a slot and shared it with the rest so we only pay that cost once. --------- Co-authored-by: Shilei Tian <i@tianshilei.me>
43 hours[libc] Fix problem with older compilers that do not have __has_builtin. ↵lntue2-0/+10
(#150264) Fixing bot failures: https://lab.llvm.org/buildbot/#/builders/10/builds/10025
46 hours[libc] Make FPUtils' rounding_mode.h functions constexpr. (#149167)lntue2-23/+45
46 hours[libc][math] Remove constexpr from bfloat16 comparison operations (#150227)Krishna Pandey1-6/+6
Signed-off-by: Krishna Pandey <kpandey81930@gmail.com>
46 hours[libc][math][c++23] Implement comparison operations operator overloads for ↵Krishna Pandey2-0/+26
BFloat16 (#150087) Signed-off-by: Krishna Pandey <kpandey81930@gmail.com>
3 days[libc] Fixed mbtowc functions (#150118)sribee82-5/+3
mbrtowc was not handling null destination correctly --------- Co-authored-by: Sriya Pratipati <sriyap@google.com>
3 days[libc] Cleaned up wcsspn and wcscspn (#147408)sribee84-26/+69
created internal wcsspn to avoid duplicated code --------- Co-authored-by: Sriya Pratipati <sriyap@google.com>
3 days[libc][math] Add Generic Comparison Operations for floating point types ↵Krishna Pandey2-0/+125
(#144983) The PR implements the following generic comparison operation functions for floating point types along with unittests: - `fputil::equals` - `fputil::less_than` - `fputil::less_than_or_equals` - `fputil::greater_than` - `fputil::greater_than_or_equals` --------- Signed-off-by: krishna2803 <kpandey81930@gmail.com> Signed-off-by: Krishna Pandey <kpandey81930@gmail.com> Co-authored-by: OverMighty <its.overmighty@gmail.com>
4 days[libc][math] Refactor acoshf16 implementation to header-only in ↵Muhammad Bassiouni4-109/+143
src/__support/math folder. (#148568) 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
4 days[libc][math] Refactor acoshf implementation to header-only in ↵Muhammad Bassiouni14-205/+305
src/__support/math folder. (#148418) 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
4 days[libc][math] Refactor erff implementation to header-only in ↵Muhammad Bassiouni4-178/+209
src/__support/math folder. (#148413) 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
4 days[libc][math] Refactor acosf16 implementation to header-only in ↵Muhammad Bassiouni5-148/+184
src/__support/math folder. (#148412) 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
4 days[libc][math] add smoke tests to shared/math.h (#149741)Muhammad Bassiouni8-5/+21
Adding smoke tests for shared math header. part of #147386
4 days[libc] Add dependency <stdint.h> to src/string/string_utils.h (#149849)William Huynh1-0/+2
string_utils.h uses uintptr_t, and there seems to be no tracking of this dependency. It seems upstream builds are unaffected but downstream this is causing a lot of flaky builds.
5 days[libc] Revise document on building exhaustive math functions. (#149635)Connector Switch1-2/+2
I suspect the reason is that we use `add_fp_unittest` in exhaustive testing, so the suffix `__unit__` is necessary.
5 days[libc][math] Refactor acosf implementation to header-only in ↵Muhammad Bassiouni9-257/+269
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
5 days[libc] Fix epoll_create behavior when only epoll_create1 is available (#149713)Mikhail R. Gadelha1-0/+5
In PR #99785, I disabled a test for `epoll_create` that was intended to fail on systems where only `epoll_create1` is available. This is because `epoll_create1` cannot fail in the same way that `epoll_create` does. Specifically, calling `epoll_create(0)` should result in an EINVAL error. So, when only `epoll_create1` is available, we should simply check if the argument is zero and return the error accordingly.
6 days[libc] Simplify fma handling for riscv (#149673)Mikhail R. Gadelha1-1/+1
This PR simplifies how we enable the different fma configs for riscv: 1. Removes __LIBC_RISCV_USE_FMA define 2. Checks if __riscv_flen is defined to set LIBC_TARGET_CPU_HAS_FMA As a bonus, we enable *FMA_OPT tests for rv32, so any rv32 hardware that doesn't implement the f/d extensions is also covered by the tests.
6 days[libc] Fix utimes build when full_build=OFF (#149668)Mikhail R. Gadelha1-2/+4
We might pull a header from the host where tv_nsec is not a long, so compilation would fail with an implicit conversion error.
6 days[libc] Fix setitimer build when full_build=OFF (#149665)Mikhail R. Gadelha1-2/+2
When we pull the headers from the system, we might get a suseconds_t that's a long long, so add a cast to prevent a implicit conversion error.
6 days[libc][math] Refactor acos implementation to header-only in ↵Muhammad Bassiouni6-308/+340
src/__support/math folder. (#148409) 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
7 days[libc] Fix conflicting symbols when shared/math.h is included. (#149591)lntue3-21/+23
7 days[libc][math] Refactor exp10f16 implementation to header-only in ↵Muhammad Bassiouni8-192/+291
src/__support/math folder. (#148408) 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
7 daysRemove last few bits for Native Client support (#148983)Brad Smith1-1/+1
8 days[libc] add wctype.h header (#149202)Prabhu Rajasekaran4-0/+50
Add basic configurations to generate wctype.h header file. To begin with this header file just exposes one function iswalpha.
8 days[libc] Fixed StringConverter Error Edge Case (#149356)Uzair Nawaz1-0/+6
Fixed StringConverter edge case related to destination limit If we call pop() but there is no space in the dest array, we should always return the "no space in destination" error even if the following character is invalid (since we shouldn't really have to look at the next character)
8 days[libc][math] Refactor exp10f implementation to header-only in ↵Muhammad Bassiouni11-302/+210
src/__support/math folder. (#148405) 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
8 days[libc] Improve Cortex `memset` and `memcpy` functions (#149044)Guillaume Chatelet5-99/+313
The code for `memcpy` is the same as in #148204 but it fixes the build bot error by using `static_assert(cpp::always_false<decltype(access)>)` instead of `static_assert(false)` (older compilers fails on `static_assert(false)` in `constexpr` `else` bodies). The code for `memset` is new and vastly improves performance over the current byte per byte implementation. Both `memset` and `memcpy` implementations use prefetching for sizes >= 64. This lowers a bit the performance for sizes between 64 and 256 but improves throughput for greater sizes.
9 days[libc][math] Refactor exp10 implementation to header-only in ↵Muhammad Bassiouni6-500/+528
src/__support/math folder. (#148400) 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
9 daysRevert "[libc][NFC] refactor Cortex `memcpy` code" (#149035)Guillaume Chatelet3-150/+98
Reverts llvm/llvm-project#148204 `libc-arm32-qemu-debian-dbg` is failing, reverting and investigating
9 days[libc][NFC] refactor Cortex `memcpy` code (#148204)Guillaume Chatelet3-98/+150
This patch is in preparation for the Cortex `memset` implementation. It improves the codegen by generating a prefetch for large sizes.
10 days[libc][math] Refactor exp implementation to header-only in ↵Muhammad Bassiouni12-668/+745
src/__support/math folder. (#148761) - **[libc][math] Refactor exp implementation to header-only in src/__support/math folder.** - **Reapply "[libc][math] Refactor exp implementation to header-only in src/__support/math folder." (#148668)**
11 days[libc] Wchar Stringconverter (#146388)Uzair Nawaz5-1/+140
Implemented a string converter class to encapsulate the logic of converting between utf8 <-> utf32
11 days[libc] Implement widechar to integer public functions (#148683)Uzair Nawaz9-0/+252
Implement public wchar -> integer public functions using templated internal wcs_to_integer function
11 daysRevert "[libc][math] Refactor exp implementation to header-only in ↵lntue9-741/+664
src/__support/math folder." (#148668) Reverts llvm/llvm-project#148091 Full build bots are failing.
11 days[libc][math] Refactor exp implementation to header-only in ↵Muhammad Bassiouni9-664/+741
src/__support/math folder. (#148091) 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
11 days[libc][math] Refactor ldexpf implementation to header-only in ↵Muhammad Bassiouni4-5/+39
src/__support/math folder (#147906) 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 Please merge #147901 first @lntue
11 days[libc][math] Refactor ldexpf16 implementation to header-only in ↵Muhammad Bassiouni4-6/+48
src/__support/math folder. (#147901) 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 Please merge #147895 first