Schrodinger ZHU Yifan
27595c4bef
Revert "[libc][POSIX][pthreads] implemented missing pthread_rwlockattr functions" ( #91966 )
...
Reverts llvm/llvm-project#90249
Fullbuild is broken:
https://lab.llvm.org/buildbot/#/builders/163/builds/56501
2024-05-13 09:43:14 -04:00
Hendrik Hübner
d2676a7333
[libc][POSIX][pthreads] implemented missing pthread_rwlockattr functions ( #90249 )
...
Closes #89443
I added the two missing functions and respective test cases. Let me know
if anything needs changing.
2024-05-13 09:35:17 -04:00
Vinayak Dev
aca511734f
[libc] Implement fcntl() function ( #89507 )
...
Fixes #84968 .
Implements the `fcntl()` function defined in the `fcntl.h` header.
2024-05-01 11:18:44 -07:00
Fabian Keßler
cd7a7a56fc
Add basic char*_t support for libc (partial WG14 N2653) ( #90360 )
...
This PR implements a part of WG14 N2653:
- Define C23 char8_t
- Define C11 char16_t
- Define C11 char32_t
Missing goals are:
- The type of UTF-8 character literals is changed from unsigned char to
char8_t. (Since UTF-8 character literals already have type unsigned
char, this is not a semantic change).
- New mbrtoc8() and c8rtomb() functions declared in <uchar.h> enable
conversions between multibyte characters and UTF-8.
- A new ATOMIC_CHAR8_T_LOCK_FREE macro.
- A new atomic_char8_t typedef name.
2024-04-30 15:08:38 -07:00
Michael Flanders
5e9937d1b3
[libc][math] Adds entrypoint and tests for nearbyintf128,scalbnf128 ( #88443 )
...
Closes #84689 .
Adding @lntue for review.
I was curious about the implementation of
`round_using_current_rounding_mode` used for the `nearbyint` functions.
It has one of the rounding modes as unreachable
([here](https://github.com/llvm/llvm-project/blob/main/libc/src/__support/FPUtil/NearestIntegerOperations.h#L243 )),
and I was wondering if this was okay for the `nearbyint` functions.
---------
Co-authored-by: Michael Flanders <mkf727@cs.washington.edu >
2024-04-29 19:25:45 -04:00
David CARLIER
418212089e
[libc] adding linux SYS_fchmodat2 syscall. ( #89819 )
2024-04-23 22:58:00 +01:00
Nick Desaulniers
dd7963239e
[libc][POSIX][pthreads] implement pthread_rwlockattr_t functions ( #89322 )
...
Implement:
- pthread_rwlockattr_destroy
- pthread_rwlockattr_getpshared
- pthread_rwlockattr_init
- pthread_rwlockattr_setpshared
2024-04-22 12:03:27 -07:00
Nick Desaulniers
06947b9f8d
[libc][POSIX][pthreads] implement pthread_condattr_t functions ( #88987 )
...
Implement:
- pthread_condattr_destroy
- pthread_condattr_getclock
- pthread_condattr_getpshared
- pthread_condattr_init
- pthread_condattr_setclock
- pthread_condattr_setpshared
Fixes : #88581
2024-04-17 09:31:29 -07:00
Robin Caloudis
b854a23233
[libc][c23][fenv] Implement fetestexceptflag ( #87828 )
...
Provide C23 `fetestexceptflag` function according to 7.6.4.6 in the
latest [revision of the C
standard](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3096.pdf )
from 2023-04-02.
Closes https://github.com/llvm/llvm-project/issues/87565 .
2024-04-17 08:38:47 -07:00
OverMighty
41ff91e143
Reapply "[libc][math][c23] Add remaining linux/* entrypoints for {,u}fromfp{,x}* ( #86692 )" ( #88567 )
...
This reverts commit 8a071678a9 .
The test failure on 32-bit Arm should have been fixed by #86892 .
cc @nickdesaulniers @lntue
2024-04-12 16:01:36 -04:00
Michael Jones
5fb821560a
[libc] add remaining epoll functions, pipe ( #84587 )
...
The epoll_wait functions need the rest of the epoll functions (create,
ctl) to be available to actually test them, as well as pipe to create a
usable file descriptor. This patch adds epoll_create, epoll_create1,
epoll_ctl, and pipe. These have tests, and the tests for epoll_wait,
epoll_pwait, and epoll_pwait2 (currently disabled) are updated to use
these newly available functions.
2024-04-11 16:26:49 -07:00
lntue
3c2feab7d1
Revert "[libc] implement ioctl" ( #88226 )
...
Reverts llvm/llvm-project#85890
This fails in full build mode:
https://lab.llvm.org/buildbot/#/builders/163/builds/54478/steps/4/logs/stdio
2024-04-09 23:48:09 -04:00
Nhat Nguyen
289a2c380e
[libc] implement ioctl ( #85890 )
...
This PR is to work on the issue #85275
2024-04-09 23:38:23 -04:00
aniplcc
8ee6ab7f69
[libc][c23][fenv] implement fesetexcept ( #87603 )
...
Closes #87564
2024-04-05 13:52:57 -07:00
Shourya Goel
9f0758405b
reland: [libc] Added transitive bindings for OffsetType ( #87680 )
...
Followup to issues addressed here: #87397
2024-04-05 12:11:44 -07:00
Vinayak Dev
3b961d113e
[libc] Implement roundeven C23 math functions ( #87678 )
...
Implements the functions `roundeven()`, `roundevenf()`, `roundevenl()`
from the roundeven family of functions introduced in C23. Also
implements `roundevenf128()`.
2024-04-05 08:36:12 -04:00
OverMighty
a8c59750d9
[libc][math][c23] Add exp2m1f C23 math function ( #86996 )
...
Fixes #86502 .
cc @lntue
2024-04-04 08:22:45 -04:00
Gulfem Savrun Yeniceri
e8aaa3eaed
Revert "[libc] Added transitive bindings for OffsetType ( #87397 )"
...
This reverts commit 3ee93f4862
because it broke Fuchsia Clang toolchain builders:
https://logs.chromium.org/logs/fuchsia/buildbucket/cr-buildbucket/8751633430491432833/+/u/clang/build/stdout
2024-04-04 04:12:36 +00:00
Shourya Goel
3ee93f4862
[libc] Added transitive bindings for OffsetType ( #87397 )
...
Adding OffTType to fcntl.h and stdio.h 's Macro lists in libc/spec/posix.td as
mentioned here: #87266
2024-04-03 14:16:57 -07:00
aniplcc
82be6e186b
[libc][posix] implement _exit ( #87185 )
...
Fixes #87126 .
2024-04-02 10:37:42 -07:00
lntue
2be722587f
[libc][math] Implement atan2f correctly rounded to all rounding modes. ( #86716 )
...
We compute atan2f(y, x) in 2 stages:
- Fast step: perform computations in double precision , with relative
errors < 2^-50
- Accurate step: if the result from the Fast step fails Ziv's rounding
test, then we perform computations in double-double precision, with
relative errors < 2^-100.
On Ryzen 5900X, worst-case latency is ~ 200 clocks, compared to average
latency ~ 60 clocks, and average reciprocal throughput ~ 20 clocks.
2024-04-01 13:31:07 -04:00
Shourya Goel
55b74030a4
[libc][POSIX] implement fseeko, ftello ( #86928 )
...
Fixes : #85287
2024-04-01 10:09:28 -07:00
Nick Desaulniers
8a071678a9
Revert "[libc][math][c23] Add remaining linux/* entrypoints for {,u}fromfp{,x}* ( #86692 )"
...
This reverts commit cd17082b24 because the newly
added tests fail on 32b ARM.
Link: #86692
Link: https://lab.llvm.org/buildbot/#/builders/229/builds/24458
2024-03-27 13:28:26 -07:00
OverMighty
cd17082b24
[libc][math][c23] Add remaining linux/* entrypoints for {,u}fromfp{,x}* ( #86692 )
2024-03-27 12:28:27 -07:00
Shourya Goel
19ca79e867
[libc][math][c23] Implement canonicalize functions ( #85940 )
...
Fixes : #85286
2024-03-26 08:28:22 -04:00
Job Henandez Lara
3e3f0c3175
[libc][math][c23] add c23 floating point fmaximum and fminimum functions. ( #86016 )
...
Fixes https://github.com/llvm/llvm-project/issues/85496 .
---------
Co-authored-by: Job Hernandez <h93@protonmail.com >
2024-03-25 15:19:10 -04:00
Schrodinger ZHU Yifan
05dc5d927b
[libc] add statvfs/fstatvfs ( #86169 )
...
fixes #86449
2024-03-25 13:37:50 -04:00
OverMighty
b282259711
[libc][math][c23] Add {,u}fromfp{,x}{,f,l,f128} functions ( #86003 )
...
Fixes #85279 .
cc @lntue
2024-03-25 10:26:22 -04:00
Vinayak Dev
83e96977cd
[libc] Implement strfromd() and strfroml() ( #86113 )
...
Follow up to #85438 .
Implements the functions `strfromd()` and `strfroml()` introduced in
C23, and unifies the testing framework for `strfrom*()` functions.
2024-03-22 11:39:53 -07:00
aniplcc
c04807c84e
[libc][c11] Add stdio.h's rename() function ( #85068 )
...
Adds stdio.h's rename() function as defined in n3096. Fixes #84980 .
2024-03-21 08:21:06 -07:00
Vinayak Dev
5ea152033e
[libc]: Implement strfromf() and shared utilities ( #85438 )
...
Fixes #84244 .
Implements the function `strfromf()` introduced in C23, and adds shared
utilities for implementation of other `strfrom*()` functions, including
`strfromd()` and `strfroml()`.
2024-03-20 10:47:35 -07:00
OverMighty
85b6af198f
[libc][math][c23] Add linux/* entrypoints for nextup* and nextdown* ( #85803 )
...
See
https://github.com/llvm/llvm-project/pull/85484#discussion_r1526971653 .
There already were entrypoints for linux/x86_64. I haven't tested on the other
targets and will rely on the buildbots.
2024-03-19 12:47:01 -07:00
Nick Desaulniers
27d7bb8616
[libc] fix up fileno tests ( #85660 )
...
Fixes #85628
2024-03-18 13:35:44 -04:00
Shourya Goel
ca04b56a8b
[libc] Implement fileno ( #85628 )
...
fixes : #85150
2024-03-18 09:26:30 -07:00
Schrodinger ZHU Yifan
f6f42af06f
[libc] Add shm_open/shm_unlink ( #84974 )
2024-03-18 11:40:07 -04:00
OverMighty
a2bad75879
[libc][math][c23] Add nextupl and nextdownl functions ( #85484 )
...
Fixes #85283 .
cc @lntue
2024-03-16 17:21:07 -04:00
OverMighty
8ff96eb100
[libc][math][c23] Add nextup{,f,f128} and nextdown{,f,f128} functions ( #85431 )
...
See https://github.com/llvm/llvm-project/issues/85283 .
I had a test for `nextdownl` that was failing and I thought I should add
`nextupl` and `nextdownl` later and first make a PR for the other
functions.
cc @lntue
2024-03-15 16:46:48 -04:00
Petr Hosek
d6722bcbd6
[libc] Move EOF macro to stdio-macros.h ( #85159 )
...
libc++ char_traits.h assumes EOF is always available
See #85158 for more details.
2024-03-15 10:56:39 -07:00
Michael Flanders
b43965adac
[libc][math][c23] adds nanf128 ( #85201 )
...
Continuing #84689 , this one required more changes than the others, so I
am making it a separate PR.
Extends some stuff in `str_to_float.h`, `str_to_integer.h` to work on
types wider than `unsigned long long` and `uint64_t`.
cc @lntue for review.
2024-03-15 13:31:50 -04:00
Nick Desaulniers
9a3000cf67
[libc] roll out rest of stdbit.h entrypoints to gpu,linux,baremetal ( #84938 )
2024-03-13 08:36:49 -07:00
Michael Flanders
15a55486a5
[libc][math] Adds entrypoint and test for nextafterf128 ( #84882 )
2024-03-12 23:25:05 -04:00
lntue
4d21e75210
[libc][math][c23] Add fmodl and fmodf128 math functions. ( #84600 )
...
- Allow `FMod` template to have different computational types and make
it work for 80-bit long double.
- Switch to use `uint64_t` as the intermediate computational types for
`float`, significantly reduce the latency of `fmodf` when the exponent
difference is large.
2024-03-11 16:27:42 -04:00
Schrodinger ZHU Yifan
fe1645e25c
[libc][mman] Implement msync ( #84700 )
...
Implement `msync` as specified in:
1. https://www.man7.org/linux/man-pages/man2/msync.2.html
2. https://pubs.opengroup.org/onlinepubs/9699919799/
2024-03-10 19:01:54 -04:00
Michael Flanders
75b0d384fb
[libc][stdbit][c23] adds implementation of stdc_bit_ceil functions ( #84657 )
...
Closes #84652 .
Based on #84233 .
2024-03-10 12:53:28 -04:00
lntue
99f5e9634b
[libc][math][c23] Add modff128 C23 math function. ( #84532 )
2024-03-09 11:47:22 -05:00
lntue
60d7bf3dbe
[libc][math][c23] Add (l|ll)rintf128 and (l|ll)roundf128 math functions. ( #84504 )
2024-03-08 12:15:02 -05:00
lntue
14171b87a3
[libc][stdfix] Add exp function for short _Accum and _Accum types. ( #84391 )
2024-03-07 17:58:28 -05:00
lntue
d0b7022798
[libc] Refactor stdfix extension from llvm_libc_ext.td to llvm_libc_stdfix_ext.td. ( #84365 )
...
This fixes runtime build for armv6 baremetal targets:
https://github.com/llvm/llvm-project/pull/83959#issuecomment-1984221249
2024-03-07 15:23:37 -05:00
Schrodinger ZHU Yifan
57a337378f
[libc][c23] add memset_explicit ( #83577 )
2024-03-07 14:57:35 -05:00
Nick Desaulniers
101a13df71
[libc][stdbit] implement stdc_bit_floor (C23) ( #84233 )
2024-03-07 08:38:04 -08:00