| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
[libc][math] Add float-only implementation for atanf. (#167004) Algorithm: 1) atan(x) = sign(x) * atan(|x|) 2) If |x| > 1 + 1/32, atan(|x|) = pi/2 - atan(1/|x|) 3) For 1/16 < |x| < 1 + 1/32, we find k such that: | |x| - k/16 | <= 1/32. Let y = |x| - k/16, then using the angle summation formula, we have: atan(|x|) = atan(k/16) + atan( (|x| - k/16) / (1 + |x| * k/16) ) = atan(k/16) + atan( y / (1 + (y + k/16) * k/16 ) = atan(k/16) + atan( y / ((1 + k^2/256) + y * k/16) ) 4) Let u = y / (1 + k^2/256), then we can rewritten the above as: atan(|x|) = atan(k/16) + atan( u / (1 + u * k/16) ) ~ atan(k/16) + (u - k/16 * u^2 + (k^2/256 - 1/3) * u^3 + + (k/16 - (k/16)^3) * u^4) + O(u^5) With all the computations are done in single precision (float), the total of approximation errors and rounding errors is bounded by 4 ULPs. | 8 个月前 | |
[libc] implement inet_addr (#167708) This patch adds the posix function inet_addr. Since most of the parsing logic is delegated to inet_aton, I have only included some basic smoke tests for testing purposes. | 8 个月前 | |
[libc] Add __builtin_expect tag on assert conditions; NFC (#99498) | 1 年前 | |
[libc][NFC] Add stdint.h proxy header to fix dependency issue with <stdint.h> includes. (#150303) https://github.com/llvm/llvm-project/issues/149993 | 1 年前 | |
| 1 年前 | ||
[libc] Migrate ctype_utils to use char instead of int where applicable. (#166225) Functions like isalpha / tolower can operate on chars internally. This allows us to get rid of unnecessary casts and open a way to creating wchar_t overloads with the same names (e.g. for isalpha), that would simplify templated code for conversion functions (see 315dfe5865962d8a3d60e21d1fffce5214fe54ef). Add the int->char converstion to public entrypoints implementation instead. We also need to introduce bounds check on the input argument values - these functions' behavior is unspecified if the argument is neither EOF nor fits in "unsigned char" range, but the tests we've had verified that they always return false for small negative values. To preserve this behavior, cover it explicitly. | 8 个月前 | |
[libc] Move libc_errno.h to libc/src/__support and make LIBC_ERRNO_MODE_SYSTEM to be header-only. (#143187) This is the first step 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 | 1 年前 | |
| 10 个月前 | ||
[libc] Remove LIBC_ERRNO_MODE_SYSTEM mode. (#153077) Use LIBC_ERRNO_MODE_SYSTEM_INLINE instead as the default for the "public packaging" (i.e. release mode) of an overlay build. The Bazel build has already switched to use it by default in 5ccc734fa0355f971f8f515457a0bece33ab6642. This should be a safe change, as LIBC_ERRNO_MODE_SYSTEM_INLINE works a drop-in (but simpler) LIBC_ERRNO_MODE_SYSTEM replacement. Remove the associated code paths and config settings. Fixes issue #143454. | 11 个月前 | |
[libc] Allow openat and creat to return fd 0. (#166466) Previously, if the open or openat syscalls returned 0 as a (valid) file descriptor, the creat and openat wrappers would erroneously return -1. | 8 个月前 | |
| 8 个月前 | ||
[libc][NFC] Add stdint.h proxy header to fix dependency issue with <stdint.h> includes. (#150303) https://github.com/llvm/llvm-project/issues/149993 | 1 年前 | |
[libc][NFC] Add stdint.h proxy header to fix dependency issue with <stdint.h> includes. (#150303) https://github.com/llvm/llvm-project/issues/149993 | 1 年前 | |
[libc] Use proxy header in the locale implementation. (#130982) Address review comments in https://github.com/llvm/llvm-project/pull/130621#pullrequestreview-2671843932. Some unused headers are also removed. | 1 年前 | |
[libc][math] Refactor exp2m1f16 implementation to header-only in src/__support/math folder. (#162019) 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 个月前 | |
[libc] Stub out message catalog functions from <nl_types.h> (#164360) Create a POSIX <nl_types.h> header with catopen, catclose, and catgets function declarations. Provide the stub/placeholder implementations which always return error. This is consistent with the way locales are currently (un-)implemented in llvm-libc. Notably, providing <nl_types.h> fixes the last remaining issue with building libc++ against llvm-libc (on certain configuration of x86_64 Linux) after disabling threads and wide-characters in libc++. | 9 个月前 | |
[libc] Move libc_errno.h to libc/src/__support and make LIBC_ERRNO_MODE_SYSTEM to be header-only. (#143187) This is the first step 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 | 1 年前 | |
[libc] Refactor AUXV handling with new auxv.h header library (#162326) Closes https://github.com/llvm/llvm-project/issues/153666 This patch introduces a new centralized AUXV (auxiliary vector) handling mechanism for LLVM libc on Linux, replacing the previous scattered implementation across multiple files. ## Key Changes: ### New Files: - **libc/src/__support/OSUtil/linux/auxv.h**: New header library providing a clean interface for AUXV access with: - auxv::Entry struct for AUXV entries (type and value) - auxv::Vector class with iterator support for traversing AUXV - auxv::get() function for retrieving specific AUXV values - Thread-safe initialization with fallback mechanisms (prctl and /proc/self/auxv) ### Modified Files: 1. **libc/src/__support/OSUtil/linux/CMakeLists.txt**: - Added auxv header library declaration with proper dependencies: - libc.hdr.fcntl_macros - libc.src.__support.OSUtil.osutil - libc.src.__support.common - libc.src.__support.CPP.optional - libc.src.__support.threads.callonce 2. **libc/config/linux/app.h**: - Removed AuxEntry struct (moved to auxv.h as auxv::Entry) - Removed auxv_ptr from AppProperties struct - Simplified application properties structure 3. **libc/src/sys/auxv/linux/getauxval.cpp**: - Completely refactored to use new auxv.h interface - Removed ~200 lines of complex initialization code - Simplified to just call auxv::get() function - Removed dependencies to external symbols (mman, prctl, fcntl, read, close, open) 4. **libc/src/sys/auxv/linux/CMakeLists.txt**: - Updated dependencies to use new auxv header library - Removed dependencies to external symbols (prctl, mman, fcntl, unistd, etc.) 5. **libc/startup/linux/do_start.cpp**: - Updated to use new auxv::Vector interface - Changed from pointer-based to iterator-based AUXV traversal - Updated field names (aux_entry->id → aux_entry.type, aux_entry->value → aux_entry.val) - Added call to auxv::Vector::initialize_unsafe() for early AUXV setup 6. **libc/startup/linux/CMakeLists.txt**: - Added dependency on libc.src.__support.OSUtil.linux.auxv | 9 个月前 | |
[libc] Add struct_sched_param proxy header (#151722) This enables cleaning up the remaining sched.h includes littered around the code base. | 11 个月前 | |
[libc] Move libc_errno.h to libc/src/__support and make LIBC_ERRNO_MODE_SYSTEM to be header-only. (#143187) This is the first step 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 | 1 年前 | |
[libc] fix architecture guarding for 32bit sigsetjmp (#164923) Fixes: https://github.com/llvm/llvm-project/issues/164653 Signed-off-by: Shreeyash Pandey <shreeyash335@gmail.com> | 9 个月前 | |
[libc] Move libc_errno.h to libc/src/__support and make LIBC_ERRNO_MODE_SYSTEM to be header-only. (#143187) This is the first step 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 | 1 年前 | |
[libc][NFC] Add stdint.h proxy header to fix dependency issue with <stdint.h> includes. (#150303) https://github.com/llvm/llvm-project/issues/149993 | 1 年前 | |
| 2 年前 | ||
[libc][c23] add definitions for stdckdint.h (#82059) See docs at - https://gustedt.gitlabpages.inria.fr/c23-library/#stdckdint - https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3047.pdf (Ch7.10) Compiler header: - https://github.com/llvm/llvm-project/blob/450462cbaceddf57812ce15b5135b17f65a77654/clang/lib/Headers/stdckdint.h - New version of GCC (https://github.com/gcc-mirror/gcc/blob/cd503b0616462445381a8232fb753239d319af76/gcc/ginclude/stdckdint.h) also provides this. | 2 年前 | |
[libc] add missing headers in stdfix (#162078) Fixes https://github.com/llvm/llvm-project/issues/129361 @michaelrj-google @PiJoules --------- Signed-off-by: Shreeyash Pandey <shreeyash335@gmail.com> Co-authored-by: Michael Jones <michaelrj@google.com> | 9 个月前 | |
[libc] fwrite_unlocked: only return errno if an actual error occurred. (#167350) fwrite and friends don't modify errno if no error occurred. Therefore frite_unlocked's return value shouldn't be constructed from errno without checking if an error actually occurred. This fixes an error introduced by https://github.com/llvm/llvm-project/commit/9e2f73fe9052a4fbf382a06e30b2441c6d99fb7e | 8 个月前 | |
[libc] Move mbtowc, mbstowcs and inverse functions to stdlib.h (#168455) These functions should be declared in stdlib.h, not wchar.h, as confusing as it is. Move them to the proper header file and matching directories in src/ and test/ trees. This was discovered while testing libc++ build against llvm-libc, which re-declares functions like mbtowc in std-namespace in <cstdlib> header, and then uses those functions in its locale implementation. | 8 个月前 | |
[libc] add an SVE implementation of strlen (#167259) This PR creates an SVE-based implementation for strlen by translating from the AOR code in tree. Microbenchmark shows improvements against NEON when N>=64. Although both implementations fall behind glibc by a large margin, this may be a good start point to explore SVE implementations. Together with the PR: 1. Added two more tests of strlen with special nul symbols. 2. Added strlen's fuzzer and fix a typo in previous heap fuzzer. === strlen(16 bytes) === libc: 1.56115 ns/call, 9.54499 GiB/s neon: 1.59393 ns/call, 9.34867 GiB/s sve: 1.66097 ns/call, 8.97134 GiB/s === strlen(64 bytes) === libc: 2.06967 ns/call, 28.7991 GiB/s neon: 2.59914 ns/call, 22.9325 GiB/s sve: 2.58628 ns/call, 23.0465 GiB/s === strlen(256 bytes) === libc: 3.74165 ns/call, 63.7202 GiB/s neon: 8.98243 ns/call, 26.5428 GiB/s sve: 7.36426 ns/call, 32.3751 GiB/s === strlen(1024 bytes) === libc: 10.5327 ns/call, 90.5438 GiB/s neon: 34.363 ns/call, 27.7529 GiB/s sve: 26.9329 ns/call, 35.4092 GiB/s === strlen(4096 bytes) === libc: 37.7304 ns/call, 101.104 GiB/s neon: 145.911 ns/call, 26.144 GiB/s sve: 103.208 ns/call, 36.9612 GiB/s === strlen(1048576 bytes) === libc: 9623.4 ns/call, 101.478 GiB/s neon: 36138.2 ns/call, 27.023 GiB/s sve: 26605.6 ns/call, 36.7051 GiB/s | 8 个月前 | |
[libc] Migrate ctype_utils to use char instead of int where applicable. (#166225) Functions like isalpha / tolower can operate on chars internally. This allows us to get rid of unnecessary casts and open a way to creating wchar_t overloads with the same names (e.g. for isalpha), that would simplify templated code for conversion functions (see 315dfe5865962d8a3d60e21d1fffce5214fe54ef). Add the int->char converstion to public entrypoints implementation instead. We also need to introduce bounds check on the input argument values - these functions' behavior is unspecified if the argument is neither EOF nor fits in "unsigned char" range, but the tests we've had verified that they always return false for small negative values. To preserve this behavior, cover it explicitly. | 8 个月前 | |
[libc] Implement pkey_alloc/free/get/set/mprotect for x86_64 linux (#162362) This patch provides definitions for pkey_* functions for linux x86_64. pkey_alloc, pkey_free, and pkey_mprotect are simple syscall wrappers. pkey_set and pkey_get modify architecture-specific registers. The logic for these live in architecture specific directories: * libc/src/sys/mman/linux/x86_64/pkey_common.h has a real implementation * libc/src/sys/mman/linux/generic/pkey_common.h contains stubs that just return ENOSYS. | 8 个月前 | |
[libc] Move libc_errno.h to libc/src/__support and make LIBC_ERRNO_MODE_SYSTEM to be header-only. (#143187) This is the first step 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 | 1 年前 | |
[libc] Refactor AUXV handling with new auxv.h header library (#162326) Closes https://github.com/llvm/llvm-project/issues/153666 This patch introduces a new centralized AUXV (auxiliary vector) handling mechanism for LLVM libc on Linux, replacing the previous scattered implementation across multiple files. ## Key Changes: ### New Files: - **libc/src/__support/OSUtil/linux/auxv.h**: New header library providing a clean interface for AUXV access with: - auxv::Entry struct for AUXV entries (type and value) - auxv::Vector class with iterator support for traversing AUXV - auxv::get() function for retrieving specific AUXV values - Thread-safe initialization with fallback mechanisms (prctl and /proc/self/auxv) ### Modified Files: 1. **libc/src/__support/OSUtil/linux/CMakeLists.txt**: - Added auxv header library declaration with proper dependencies: - libc.hdr.fcntl_macros - libc.src.__support.OSUtil.osutil - libc.src.__support.common - libc.src.__support.CPP.optional - libc.src.__support.threads.callonce 2. **libc/config/linux/app.h**: - Removed AuxEntry struct (moved to auxv.h as auxv::Entry) - Removed auxv_ptr from AppProperties struct - Simplified application properties structure 3. **libc/src/sys/auxv/linux/getauxval.cpp**: - Completely refactored to use new auxv.h interface - Removed ~200 lines of complex initialization code - Simplified to just call auxv::get() function - Removed dependencies to external symbols (mman, prctl, fcntl, read, close, open) 4. **libc/src/sys/auxv/linux/CMakeLists.txt**: - Updated dependencies to use new auxv header library - Removed dependencies to external symbols (prctl, mman, fcntl, unistd, etc.) 5. **libc/startup/linux/do_start.cpp**: - Updated to use new auxv::Vector interface - Changed from pointer-based to iterator-based AUXV traversal - Updated field names (aux_entry->id → aux_entry.type, aux_entry->value → aux_entry.val) - Added call to auxv::Vector::initialize_unsafe() for early AUXV setup 6. **libc/startup/linux/CMakeLists.txt**: - Added dependency on libc.src.__support.OSUtil.linux.auxv | 9 个月前 | |
[libc][POSIX] Add clock_settime() function for Linux (#161729) Closes #161461 - This is my first time contributing to libc's POSIX, so for reference I used clock_gettime implementation for Linux. For convenience, here is the description of clock_settime function [behavior](https://www.man7.org/linux/man-pages/man3/clock_settime.3.html) | 8 个月前 | |
| 8 个月前 | ||
[libc] Move mbtowc, mbstowcs and inverse functions to stdlib.h (#168455) These functions should be declared in stdlib.h, not wchar.h, as confusing as it is. Move them to the proper header file and matching directories in src/ and test/ trees. This was discovered while testing libc++ build against llvm-libc, which re-declares functions like mbtowc in std-namespace in <cstdlib> header, and then uses those functions in its locale implementation. | 8 个月前 | |
[libc] Use function overloads to make string parsing code more generic. (#167417) ctype_utils/wctype_utils were chaged in 120689e46679c6db37cd9e839ec0721e80a22d4f and e7f7973899f76773ae6e9a6b1e8c7e9f9cc5cb56, respectively to operate on char/wchar_t. Now we can switch to the overloaded names (e.g. have noth isspace(char and isspace(wchar_t)) to simplify the templatized strtointeger implementation from 315dfe5865962d8a3d60e21d1fffce5214fe54ef and make it easier to potentially add templatized strtofloat implementation. | 8 个月前 | |
[libc][clang-tidy] Add llvm-header-guard to get consistant naming and prevent file copy/paste issues. (#66477) | 2 年前 | |
[libc] Stub out message catalog functions from <nl_types.h> (#164360) Create a POSIX <nl_types.h> header with catopen, catclose, and catgets function declarations. Provide the stub/placeholder implementations which always return error. This is consistent with the way locales are currently (un-)implemented in llvm-libc. Notably, providing <nl_types.h> fixes the last remaining issue with building libc++ against llvm-libc (on certain configuration of x86_64 Linux) after disabling threads and wide-characters in libc++. | 9 个月前 |
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 8 个月前 | ||
| 8 个月前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 8 个月前 | ||
| 1 年前 | ||
| 10 个月前 | ||
| 11 个月前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 8 个月前 | ||
| 9 个月前 | ||
| 1 年前 | ||
| 9 个月前 | ||
| 11 个月前 | ||
| 1 年前 | ||
| 9 个月前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 9 个月前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 1 年前 | ||
| 9 个月前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 2 年前 | ||
| 9 个月前 |