aboutsummaryrefslogtreecommitdiff
path: root/libc
AgeCommit message (Collapse)AuthorFilesLines
2024-06-08[libc][math][c23] fmul correcly rounded to all rounding modes (#91537)Job Henandez Lara14-1/+303
This is an implementation of floating point multiplication: It will consist of - `double x double -> float`
2024-06-07[libc][math][c23] Temporarily disable fmodf16 on AArch64 (#94813)OverMighty1-1/+0
See Buildbot failure: https://lab.llvm.org/buildbot/#/builders/138/builds/67337.
2024-06-07[libc][math][c23] Add fmodf16 C23 math function (#94629)OverMighty16-46/+193
Part of #93566.
2024-06-07[libc] Add baremetal printf (#94078)Michael Jones6-33/+104
For baremetal targets that don't support FILE, this version of printf just writes directly to a function provided by a vendor. To do this both printf and vprintf were moved to /generic (vprintf since they need the same flags and cmake gets funky about setting variables in one file and reading them in another).
2024-06-07[libc] Correctly pass the C++ standard to NVPTX internal buildsJoseph Huber1-3/+7
Summary: The NVPTX build wasn't getting the `C++20` standard necessary for a few files.
2024-06-06[libc] fixed target issue with exit_handler (#94678)aaryanshukla1-0/+4
- addressed https://github.com/llvm/llvm-project/pull/94317#issuecomment-2153103129 - added conditional in cmake file for exit_handler object library Co-authored-by: Aaryan Shukla <aaryanshukla@google.com>
2024-06-06[libc][FixedVector] Add more helper methods (#94278)PiJoules3-1/+45
This adds: - A ctor accepting a start and end iterator - A ctor accepting a count and const T& - size() - subscript operators - begin() and end() iterators
2024-06-06[libc] at_quick_exit function implemented (#94317)aaryanshukla14-88/+315
- added at_quick_exit function - used helper file exit_handler which reuses code from atexit - atexit now calls helper functions from exit_handler - test cases and dependencies are added --------- Co-authored-by: Aaryan Shukla <aaryanshukla@google.com>
2024-06-06[libc][math][c23] Add {fmaximum,fminimum}{,_mag,_mag_num,_num} C23 math ↵OverMighty40-74/+781
functions (#94510) #93566
2024-06-06[libc][math][c23] Fix implicit conversion in smoke tests for {fmax,fmin}f16 ↵OverMighty3-8/+22
(#94624)
2024-06-06[libc] Enable varargs tests for AMDGPU targetsJoseph Huber2-2/+13
Summary: This reverts commit 574ab7e7b759a400ecf54c1141b1433bb2415e93.
2024-06-06[libc][math] Temporarily disable nexttowardf16 on aarch64 due to clang-11 ↵lntue1-1/+4
bug. (#94569) The conversion between _Float16 and long double will crash clang-11 on aarch64. This is fixed in clang-12: https://godbolt.org/z/8ceT9454c
2024-06-06[libc] Disable varargs tests on gpu, nvptx can't build them yetJon Chesterfield2-6/+2
2024-06-06[AMDGPU] Implement variadic functions by IR lowering (#93362)Jon Chesterfield2-2/+6
This is a mostly-target-independent variadic function optimisation and lowering pass. It is only enabled for AMDGPU in this initial commit. The purpose is to make C style variadic functions a zero cost abstraction. They are lowered to equivalent IR which is then amenable to other optimisations. This is inherently slightly target specific but much less so than one might expect - the C varargs interface heavily constrains the ABI design divergence. The pass is primarily tested from webassembly. This is because wasm has a straightforward variadic lowering strategy which coincides exactly with what this pass transforms code into and a struct passing convention with few cases to check. Adding further targets conventions is straightforward and elided from this patch primarily to simplify the review. Implemented in other branches are Linux X86, AMD64, AArch64 and NVPTX. Testing for targets that have existing lowering for va_arg from clang is most efficiently done by checking that clang | opt completely elides the variadic syntax from test cases. The lowering produces a struct for each call site which can be inspected to check the various alignment and indirections are correct. AMDGPU presently has no variadic support other than some ad hoc printf handling. Combined with the pass being inactive on all other targets landing this represents strict increase in capability with zero risk. Testing and refining will continue post commit. In addition to the compiler tests included here, a self contained x64 clang/musl toolchain was constructed using the "lowering" instead of the systemv ABI and used to build various C programs like lua and libxml2.
2024-06-05[libc][math][c23] Add {nextafter,nexttoward,nextup,nextdown}f16 C23 math ↵OverMighty22-32/+371
functions (#94535) #93566
2024-06-05[libc][math][c23] Implement fmaxf16 and fminf16 function (#94131)Hendrik Hübner13-2/+167
Implements fmaxf16 and fminf16, which are two missing functions listed here: #93566
2024-06-05[libc][NFC] More verbose warning message on missing utilitiesJoseph Huber1-4/+8
Summary: The GPU needs both the loader utility and the architecture to be present to run tests. This simply makes it easier to detect which is missing in case of problems.
2024-06-05[libc] Unpoison epoll structs (#94536)Michael Jones4-0/+12
The epoll wait functions return structs via pointer, but those structs need to be unpoisoned before return. This patch adds that unpoisoning.
2024-06-05[libc][type_traits] Add aligned_storage (#94074)PiJoules4-0/+38
2024-06-05Revert "[libc][math][c23] Add MPFR unit tests for ↵OverMighty12-264/+53
{ceil,floor,round,roundeven,trunc}f16 (#94383)" (#94505) This reverts commit fda1e4b01f723c31a36ad659564ae4a61365930e. The commit caused Buildbot failures: - https://lab.llvm.org/buildbot/#/builders/256/builds/14331 - https://lab.llvm.org/buildbot/#/builders/229/builds/27009
2024-06-05[libc][math][c23] Add MPFR unit tests for ↵OverMighty12-53/+264
{ceil,floor,round,roundeven,trunc}f16 (#94383)
2024-06-05[libc] Disable fpexcept testing on the GPUJoseph Huber1-0/+3
Summary: These new tests fails on the GPU due to the exception testing. Disable it for now because these aren't supported and can't be supported on NVPTX.
2024-06-05[libc][math][c23] Add fdimf16 C23 math function (#94354)OverMighty11-10/+94
#93566
2024-06-05[libc] Implement forward iterators for libc fixed_vector (#93916)jameshu158692-0/+14
- Implements forward iterators for `cpp::fixed_vector` to use in https://github.com/llvm/llvm-project/pull/92009
2024-06-05[libc][math][c23] Add copysignf16 C23 math function (#94351)OverMighty11-4/+94
#93566
2024-06-05[libc][math][c23] Add canonicalizef16 C23 math function (#94341)OverMighty12-3/+89
#93566
2024-06-04[libc][stdlib] Add calloc header (#94403)PiJoules1-0/+20
2024-06-04[NFC] Fix typo in libc/docs/gpu/using.rstJoachim Meyer1-1/+1
2024-06-04[libc][math][c23] Add {fromfp,fromfpx,ufromfp,ufromfpx}f16 C23 math ↵OverMighty25-223/+543
functions (#94254) https://github.com/llvm/llvm-project/issues/93566
2024-06-04[libc][new] Add placement new functions (#94290)PiJoules1-0/+4
2024-06-04[libc] add LIBC_INLINE for expected, use CTAD in abs_timeout (#94348)c8ef2-16/+20
2024-06-04[libc][math][c23] Add {nearbyint,rint,lrint,llrint,lround,llround}f16 C23 ↵OverMighty26-32/+552
math functions (#94218) https://github.com/llvm/llvm-project/issues/93566
2024-06-03[libc][test] Fix TEST->TEST_F typo in getenv_and_setenv_test.cpp (#94304)Jordan Rupprecht1-1/+1
This manifests as `AddressSanitizer: stack-use-after-return` w/o this change. The `~CheckFEnv()` method of checking fenv seems to only work for test fixtures.
2024-06-03[libc] Add GPU utility dependencies if presentJoseph Huber1-0/+6
Summary: These tools need to be built before we can do the library creation stage. If they are generated in the same build then this is not guaranteed so we should add explicit dependencies.
2024-06-03[libc][CPP] Add all_of and find_if_not to algorithm.h (#94058)PiJoules3-0/+72
This is needed for the allocator implementation for malloc.
2024-06-03[libc][math][c23] Add {ceil,floor,round,roundeven,trunc}f16 C23 math ↵OverMighty28-30/+443
functions (#94001)
2024-06-03[libc] Correctly find LLVM binaries when built in projects mode for GPUJoseph Huber1-18/+34
Summary: You can build the GPU libc support in projects mode. There were some issues with it not finding the correct binaries. This patch fixes that.
2024-05-31[libc] fix build failures due to SIGCHLD (#94093)Schrodinger ZHU Yifan2-0/+2
2024-05-31[libc] fix test build on platforms without `SYS_fork` (#94087)Schrodinger ZHU Yifan1-0/+4
2024-05-31[libc] rework mutex (#92168)Schrodinger ZHU Yifan26-118/+404
2024-05-31[libc] Add line numbers to libc utility error messages (#94010)Joseph Huber3-10/+14
Summary: Currently we just print the error as seen, this makes it difficult if something goes wrong to know where it failed. This patch just adds in line numbers to all the error handling routines so you can trace it back.
2024-05-31[libc] restored original no_stack_protector syntax (#94005)RoseZhang031-2/+2
forward fix for #93620 -GCC doesn't recognize [[clang:: ']] prefix, so restored the original __attribute__ syntax
2024-05-31[libc] added quick_exit function (#93620)RoseZhang0319-40/+121
- In /libc/src/__support/ OSUtil, changed quick_exit to just exit, and put in namespace LIBC_NAMESPACE::internal. - In /libc/src/stdlib added quick_exit - Added test files for quick_exit
2024-05-31[libc][NFC] Allow compilation of `memcpy` with `-m32` (#93790)Guillaume Chatelet2-3/+3
Needed to support i386 (#93709).
2024-05-30[libc] android atest compat (#93852)Nick Desaulniers (paternity leave)4-34/+93
These changes slighly modify the output of the unittests so that they better match GTest, so that utilities that parse the expected output from GTest (such as Android's unit test harness) can read the output from our unit tests. This allows our unit tests to be run on Android devices. Add very primitive command line parsing to: - support --gtest_color=no to disable printing terminal colors. - recognize --gtest_print_time and print the test time in milliseconds. - most of our unit tests run on the order of microseconds, so its useful to preserve the existing behavior. But upsteram GTest ONLY prints time tests in milliseconds, and Android's atest expects to be able to parse exactly that. Atest always passes --gtest_print_time. The word `took` is removed as that also differs from upstream GTest, tripping up parsers. - ignore other --gtest_* flags Do so so that atest can parse the output correctly. Print the test number count before each run, so that atest can parse this value correctly. Link: https://android-review.googlesource.com/c/platform/external/llvm-libc/+/3107252 Link: https://google.github.io/googletest/advanced.html#colored-terminal-output Link: https://google.github.io/googletest/advanced.html#suppressing-the-elapsed-time
2024-05-30[libc][math][c23] Add fabsf16 C23 math function (#93567)OverMighty21-32/+146
cc @lntue
2024-05-30Reland: [libc][POSIX][pthreads] implemented missing pthread_rwlockattr ↵Hendrik Hübner12-3/+163
functions (#93622) New pull request for https://github.com/llvm/llvm-project/issues/89443 The previous PR was reverted after breaking fullbuild due to a missing struct declaration, which I forgot to commit. Reverts revert and adds the missing pthread_rwlockattr_getkind_np / pthread_rwlockattr_setkind_np functions and tests respecitvely.
2024-05-30[libc][NFC] Tighten up guard conditions for sqrt and polyeval (#93791)Guillaume Chatelet3-88/+5
Found while investigating #93709
2024-05-28[libc] Add proxy header for float.h. (#93504)lntue10-49/+72
This is the continuation of https://github.com/llvm/llvm-project/pull/88674. Fixes #88433, #90496. --------- Co-authored-by: aniplcc <aniplccode@gmail.com>
2024-05-28[libc] clean up MutexLock (#93619)Schrodinger ZHU Yifan3-17/+5