Commit Graph

476 Commits

Author SHA1 Message Date
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
lntue
ad33fe1281 [libc][stdfix] Add integer square root with fixed point output functions. (#83959)
Fix https://github.com/llvm/llvm-project/issues/83924.
2024-03-06 18:35:44 -05:00
Nick Desaulniers
041638c429 [libc][stdbit] implement stdc_bit_width (C23) (#83892) 2024-03-05 09:49:41 -08:00
Joseph Huber
c996023f9a [libc] Provide an implementation of the 'stdint.h' header (#83353)
Summary:
I've noticed one problem is that the user includes `stdint.h` the
compiler will do `#include_next <stdint.h>` potentially into a
conflicting implementation on systems with multiple headers installed.
The `clang` header is standards compliant and works with `clang` and
`gcc` which are both of our targets, so I simply copied it here. This
has the effect of including `stdint.h` on clang / LLVM libc behaving the
same as `-ffreestanding`.
2024-03-04 12:23:11 -06:00
Guillaume Chatelet
75fb825bcc [libc][NFC] Rename LIBC_COMPILER_HAS_FLOAT128 to LIBC_TYPES_HAS_FLOAT128 (#83395)
Umbrella bug #83182
2024-02-29 21:59:58 +01:00
Nick Desaulniers
06bcd9da16 [libc][stdbit] implement stdc_has_single_bit (C23) (#83168) 2024-02-27 13:45:37 -08:00
lntue
aa95aa69b9 [libc][math][c23] Add C23 math functions ilogbf128, logbf128, and llogb(f|l|f128). (#82144) 2024-02-27 12:23:19 -05:00
lntue
ded4ea9752 [libc][stdfix] Add sqrt for fixed point types. (#83042) 2024-02-26 19:36:30 -05:00
Nick Desaulniers
d8406d48a8 [libc][stdbit] implement stdc_count_ones (C23) (#82444) 2024-02-26 09:25:24 -08:00
Nick Desaulniers
f70d5c0bc8 [libc][stdbit] implement stdc_count_zeros (C23) (#82437) 2024-02-26 09:23:15 -08:00
Joseph Huber
69c0b2febe [libc][NFC] Remove all trailing spaces from libc (#82831)
Summary:
There are a lot of random training spaces on various lines. This patch
just got rid of all of them with `sed 's/\ \+$//g'.
2024-02-23 16:34:00 -06:00
Nick Desaulniers
646c7e5283 [libc] add more stdbit.h entrypoints to additional targets (#82440)
stdbit.h isn't complete yet, but looking to turn these on on more
targets for
earlier feedback.
2024-02-20 16:29:17 -08:00