aboutsummaryrefslogtreecommitdiff
path: root/libc
AgeCommit message (Collapse)AuthorFilesLines
13 hoursRevert "[libc] wchar string conversion functions mb to wc" (#150549)sribee815-967/+9
Reverts llvm/llvm-project#149423 Failing nullptr crash when using sanitizer
13 hours[libc] wchar string conversion functions mb to wc (#149423)sribee815-9/+967
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 Samsonov30-75/+53
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)lntue7-12/+17
16 hours[libc] Implement wcs to mbs family of functions (#149421)Uzair Nawaz17-0/+1041
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 Huynh18-82/+142
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 Nawaz8-3/+130
Implemented wcsdup by templating internal strdup function
18 hours[libc] Implemented mblen functions (#150141)sribee810-0/+433
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>. ↵lntue2-0/+3
(#150345)
36 hours[libc][NFC] Add stdint.h proxy header to fix dependency issue with ↵lntue239-299/+345
<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>
2 days[libc] Fix incorrect macro usage in shared/sign.h (#150140)Leandro Lacerda1-1/+1
This patch corrects the `using`-declaration in `libc/shared/sign.h`. The previous change (#150083) incorrectly used the `LIBC_NAMESPACE_DECL` macro. This is corrected to use `LIBC_NAMESPACE`.
3 days[libc] Fixed mbtowc functions (#150118)sribee83-5/+15
mbrtowc was not handling null destination correctly --------- Co-authored-by: Sriya Pratipati <sriyap@google.com>
3 days[libc] cbrt fuzz test (#150063)sribee82-0/+59
Implemented fuzz test for cbrt 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] Expose the Sign type for shared use (#150083)Leandro Lacerda1-0/+23
This patch exposes the internal `Sign` type for shared use by other LLVM subprojects, following the pattern established by `FPBits`. The `FPBits` utility is exposed via `libc/shared/fp_bits.h`. However, its public interface relies on the `Sign` type for, e.g., creating signed infinities and returning the sign of a value. Currently, users of the shared `FPBits` have no way to access the `Sign` type. Following the existing pattern for sharing `libc` utilities, this patch adds a new public header `libc/shared/sign.h`. This header simply includes the internal `src/__support/sign.h` and brings the `Sign` type into the `shared` namespace.
3 days[libc][math] Add Generic Comparison Operations for floating point types ↵Krishna Pandey4-0/+487
(#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>
3 days[libc] Add missing full build dependency for mbstate. (#150030)lntue1-0/+2
4 days[libc][math] fix header generation (#149918)Muhammad Bassiouni1-2/+2
4 days[libc][math] Refactor acoshf16 implementation to header-only in ↵Muhammad Bassiouni8-109/+176
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] fix explogxf test (#149891)Muhammad Bassiouni1-2/+3
4 days[libc][math] Refactor acoshf implementation to header-only in ↵Muhammad Bassiouni18-205/+331
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 Bassiouni8-179/+236
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 Bassiouni9-148/+217
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 Bassiouni12-6/+112
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.
4 days[libc][stdio] Separate temporary files for unit test and hermetic test in ↵lntue21-38/+67
stdio test suite. (#149740)
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 Bassiouni11-257/+293
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. Gadelha2-3/+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.
5 days[libc] Disable bfloat16 test for full build mode (#149678)Mikhail R. Gadelha1-0/+6
This patch temporarily disables bfloat16_test for full build mode, until the MPCommon target is updated so that mpfr_inc.h is not included in the MPCommon.h header. This should fix the rv32 buildbot failures.
6 days[libc] Simplify fma handling for riscv (#149673)Mikhail R. Gadelha4-5/+5
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 Bassiouni8-308/+364
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] Fix GPU benchmarkingJoseph Huber6-55/+106
7 days[libc] Remove trivial .h.def files (#149466)Roland McGrath25-315/+85
Remove all the .h.def files that already express nothing whatsoever not already expressed in YAML. Clean up a few YAML files without materially changing any generated header output. Many more .h.def files remain that need a bit of conversion in YAML to express macro requirements and such.
7 days[libc][math] Refactor exp10f16 implementation to header-only in ↵Muhammad Bassiouni10-192/+321
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 days[libc][math] Add POSIX math constants to math.h header. (#149150)lntue3-0/+139
https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/math.h.html
7 daysRemove last few bits for Native Client support (#148983)Brad Smith1-1/+1
7 days[libc] Fix tests' linking flags accidentally modified by #147931. (#149453)lntue1-5/+12
https://github.com/llvm/llvm-project/pull/147931
8 days[libc] Convert dlfcn.h to pure YAML (#149362)Roland McGrath4-49/+25
Remove the unnecessary .h.def file and move all the macro definitions directly into dlfcn.yaml.
8 days[libc] add wctype.h header (#149202)Prabhu Rajasekaran25-0/+166
Add basic configurations to generate wctype.h header file. To begin with this header file just exposes one function iswalpha.