Tue Ly
76bb278ebb
[libc][math] Implement double precision exp10 function correctly rounded for all rounding modes.
...
Implement double precision exp10 function correctly rounded for all
rounding modes. Using the same algorithm as double precision exp
(https://reviews.llvm.org/D158551 ) and exp2 (https://reviews.llvm.org/D158812 )
functions.
Reviewed By: zimmermann6
Differential Revision: https://reviews.llvm.org/D159143
2023-08-30 08:43:50 -04:00
Tue Ly
8ca614aa22
[libc][math] Implement double precision exp2 function correctly rounded for all rounding modes.
...
Implement double precision exp2 function correctly rounded for all
rounding modes. Using the same algorithm as double precision exp function in
https://reviews.llvm.org/D158551 .
Reviewed By: zimmermann6
Differential Revision: https://reviews.llvm.org/D158812
2023-08-25 10:15:08 -04:00
Siva Chandra
37f6e3c0e9
[libc] Add sys/time.h to the list of aarch64 headers.
...
Differential Revision: https://reviews.llvm.org/D158809
2023-08-24 21:03:15 -07:00
Siva Chandra
82f41192e2
[libc] Add abort and __llvm_libc_syscall to aarch64 fullbuild config.
...
Differential Revision: https://reviews.llvm.org/D158794
2023-08-24 16:26:15 -07:00
Tue Ly
434bf16084
[libc][math] Implement double precision exp function correctly rounded for all rounding modes.
...
Implement double precision exp function correctly rounded for all
rounding modes. Using 4 stages:
- Range reduction: reduce to `exp(x) = 2^hi * 2^mid1 * 2^mid2 * exp(lo)`.
- Use 64 + 64 LUT for 2^mid1 and 2^mid2, and use cubic Taylor polynomial to
approximate `(exp(lo) - 1) / lo` in double precision. Relative error in this
step is bounded by 1.5 * 2^-63.
- If the rounding test fails, use degree-6 Taylor polynomial to approximate
`exp(lo)` in double-double precision. Relative error in this step is bounded by
2^-99.
- If the rounding test still fails, use degree-7 Taylor polynomial to compute
`exp(lo)` in ~128-bit precision.
Reviewed By: zimmermann6
Differential Revision: https://reviews.llvm.org/D158551
2023-08-24 10:17:17 -04:00
Michael Jones
16d5c24226
[libc] Add v variants of printf functions
...
The v variants of the printf functions take their variadic arguments as
a va_list instead of as individual arguments. They are otherwise
identical to the corresponding printf variants. This patch adds them
(vprintf, vfprintf, vsprintf, and vsnprintf) as well as tests.
Reviewed By: phosek
Differential Revision: https://reviews.llvm.org/D157138
2023-08-04 14:50:24 -07:00
Tue Ly
f320fefc4a
[libc][math] Implement erff function correctly rounded to all rounding modes.
...
Implement correctly rounded `erff` functions.
For `x >= 4`, `erff(x) = 1` for `FE_TONEAREST` or `FE_UPWARD`, `0x1.ffffep-1` for `FE_DOWNWARD` or `FE_TOWARDZERO`.
For `0 <= x < 4`, we divide into 32 sub-intervals of length `1/8`, and use a degree-15 odd polynomial to approximate `erff(x)` in each sub-interval:
```
erff(x) ~ x * (c0 + c1 * x^2 + c2 * x^4 + ... + c7 * x^14).
```
For `x < 0`, we can use the same formula as above, since the odd part is factored out.
Performance tested with `perf.sh` tool from the CORE-MATH project on AMD Ryzen 9 5900X:
Reciprocal throughput (clock cycles / op)
```
$ ./perf.sh erff --path2
GNU libc version: 2.35
GNU libc release: stable
-- CORE-MATH reciprocal throughput -- with -march=native (with FMA instructions)
[####################] 100 %
Ntrial = 20 ; Min = 11.790 + 0.182 clc/call; Median-Min = 0.154 clc/call; Max = 12.255 clc/call;
-- CORE-MATH reciprocal throughput -- with -march=x86-64-v2 (without FMA instructions)
[####################] 100 %
Ntrial = 20 ; Min = 14.205 + 0.151 clc/call; Median-Min = 0.159 clc/call; Max = 15.893 clc/call;
-- System LIBC reciprocal throughput --
[####################] 100 %
Ntrial = 20 ; Min = 45.519 + 0.445 clc/call; Median-Min = 0.552 clc/call; Max = 46.345 clc/call;
-- LIBC reciprocal throughput -- with -mavx2 -mfma (with FMA instructions)
[####################] 100 %
Ntrial = 20 ; Min = 9.595 + 0.214 clc/call; Median-Min = 0.220 clc/call; Max = 9.887 clc/call;
-- LIBC reciprocal throughput -- with -msse4.2 (without FMA instructions)
[####################] 100 %
Ntrial = 20 ; Min = 10.223 + 0.190 clc/call; Median-Min = 0.222 clc/call; Max = 10.474 clc/call;
```
and latency (clock cycles / op):
```
$ ./perf.sh erff --path2
GNU libc version: 2.35
GNU libc release: stable
-- CORE-MATH latency -- with -march=native (with FMA instructions)
[####################] 100 %
Ntrial = 20 ; Min = 38.566 + 0.391 clc/call; Median-Min = 0.503 clc/call; Max = 39.170 clc/call;
-- CORE-MATH latency -- with -march=x86-64-v2 (without FMA instructions)
[####################] 100 %
Ntrial = 20 ; Min = 43.223 + 0.667 clc/call; Median-Min = 0.680 clc/call; Max = 43.913 clc/call;
-- System LIBC latency --
[####################] 100 %
Ntrial = 20 ; Min = 111.613 + 1.267 clc/call; Median-Min = 1.696 clc/call; Max = 113.444 clc/call;
-- LIBC latency -- with -mavx2 -mfma (with FMA instructions)
[####################] 100 %
Ntrial = 20 ; Min = 40.138 + 0.410 clc/call; Median-Min = 0.536 clc/call; Max = 40.729 clc/call;
-- LIBC latency -- with -msse4.2 (without FMA instructions)
[####################] 100 %
Ntrial = 20 ; Min = 44.858 + 0.872 clc/call; Median-Min = 0.814 clc/call; Max = 46.019 clc/call;
```
Reviewed By: michaelrj
Differential Revision: https://reviews.llvm.org/D153683
2023-06-28 13:58:37 -04:00
Michael Jones
d3074f16a6
[libc] Add qsort_r
...
This patch adds the reentrent qsort entrypoint, qsort_r. This is done by
extending the qsort functionality and moving it to a shared utility
header. For this reason the qsort_r tests focus mostly on the places
where it differs from qsort, since they share the same sorting code.
Reviewed By: sivachandra, lntue
Differential Revision: https://reviews.llvm.org/D152467
2023-06-12 11:12:17 -07:00
Tue Ly
b91e78da37
[libc][math] Implement double precision log1p correctly rounded to all rounding modes.
...
Implement double precision log1p function correctly rounded to all
rounding modes.
**Performance**
- For `0.5 <= x <= 2`, the fast pass hitting rate is about 99.93%.
- Benchmarks with `./perf.sh` tool from the CORE-MATH project, unit is (CPU clocks / call).
- Reciprocal throughput from CORE-MATH's perf tool on Ryzen 5900X:
```
$ ./perf.sh log1p
GNU libc version: 2.35
GNU libc release: stable
-- CORE-MATH reciprocal throughput -- with FMA
[####################] 100 %
Ntrial = 20 ; Min = 39.792 + 1.011 clc/call; Median-Min = 0.940 clc/call; Max = 41.373 clc/call;
-- CORE-MATH reciprocal throughput -- without FMA (-march=x86-64-v2)
[####################] 100 %
Ntrial = 20 ; Min = 87.285 + 1.135 clc/call; Median-Min = 1.299 clc/call; Max = 89.715 clc/call;
-- System LIBC reciprocal throughput --
[####################] 100 %
Ntrial = 20 ; Min = 20.666 + 0.123 clc/call; Median-Min = 0.125 clc/call; Max = 20.828 clc/call;
-- LIBC reciprocal throughput -- with FMA
[####################] 100 %
Ntrial = 20 ; Min = 20.928 + 0.771 clc/call; Median-Min = 0.725 clc/call; Max = 22.767 clc/call;
-- LIBC reciprocal throughput -- without FMA
[####################] 100 %
Ntrial = 20 ; Min = 31.461 + 0.528 clc/call; Median-Min = 0.602 clc/call; Max = 36.809 clc/call;
```
- Latency from CORE-MATH's perf tool on Ryzen 5900X:
```
$ ./perf.sh log1p --latency
GNU libc version: 2.35
GNU libc release: stable
-- CORE-MATH latency -- with FMA
[####################] 100 %
Ntrial = 20 ; Min = 77.875 + 0.062 clc/call; Median-Min = 0.051 clc/call; Max = 78.003 clc/call;
-- CORE-MATH latency -- without FMA (-march=x86-64-v2)
[####################] 100 %
Ntrial = 20 ; Min = 101.958 + 1.202 clc/call; Median-Min = 1.325 clc/call; Max = 104.452 clc/call;
-- System LIBC latency --
[####################] 100 %
Ntrial = 20 ; Min = 60.581 + 1.443 clc/call; Median-Min = 1.611 clc/call; Max = 62.285 clc/call;
-- LIBC latency -- with FMA
[####################] 100 %
Ntrial = 20 ; Min = 48.817 + 1.108 clc/call; Median-Min = 1.300 clc/call; Max = 50.282 clc/call;
-- LIBC latency -- without FMA
[####################] 100 %
Ntrial = 20 ; Min = 61.121 + 0.599 clc/call; Median-Min = 0.761 clc/call; Max = 62.020 clc/call;
```
- Accurate pass latency:
```
$ ./perf.sh log1p --latency --simple_stat
GNU libc version: 2.35
GNU libc release: stable
-- CORE-MATH latency -- with FMA
760.444
-- CORE-MATH latency -- without FMA (-march=x86-64-v2)
827.880
-- LIBC latency -- with FMA
711.837
-- LIBC latency -- without FMA
764.317
```
Reviewed By: zimmermann6
Differential Revision: https://reviews.llvm.org/D151049
2023-05-23 11:04:04 -04:00
Tue Ly
111d274841
[libc][math] Implement double precision log2 function correctly rounded to all rounding modes.
...
Implement double precision log2 function correctly rounded to all
rounding modes.
See https://reviews.llvm.org/D150014 for a more detail description of the algorithm.
**Performance**
- For `0.5 <= x <= 2`, the fast pass hitting rate is about 99.91%.
- Reciprocal throughput from CORE-MATH's perf tool on Ryzen 5900X:
```
$ ./perf.sh log2
GNU libc version: 2.35
GNU libc release: stable
-- CORE-MATH reciprocal throughput -- with FMA
[####################] 100 %
Ntrial = 20 ; Min = 15.458 + 0.204 clc/call; Median-Min = 0.224 clc/call; Max = 15.867 clc/call;
-- CORE-MATH reciprocal throughput -- without FMA (-march=x86-64-v2)
[####################] 100 %
Ntrial = 20 ; Min = 23.711 + 0.524 clc/call; Median-Min = 0.443 clc/call; Max = 25.307 clc/call;
-- System LIBC reciprocal throughput --
[####################] 100 %
Ntrial = 20 ; Min = 14.807 + 0.199 clc/call; Median-Min = 0.211 clc/call; Max = 15.137 clc/call;
-- LIBC reciprocal throughput -- with FMA
[####################] 100 %
Ntrial = 20 ; Min = 17.666 + 0.274 clc/call; Median-Min = 0.298 clc/call; Max = 18.531 clc/call;
-- LIBC reciprocal throughput -- without FMA
[####################] 100 %
Ntrial = 20 ; Min = 26.534 + 0.418 clc/call; Median-Min = 0.462 clc/call; Max = 27.327 clc/call;
```
- Latency from CORE-MATH's perf tool on Ryzen 5900X:
```
$ ./perf.sh log2 --latency
GNU libc version: 2.35
GNU libc release: stable
-- CORE-MATH latency -- with FMA
[####################] 100 %
Ntrial = 20 ; Min = 46.048 + 1.643 clc/call; Median-Min = 1.694 clc/call; Max = 48.018 clc/call;
-- CORE-MATH latency -- without FMA (-march=x86-64-v2)
[####################] 100 %
Ntrial = 20 ; Min = 62.333 + 0.138 clc/call; Median-Min = 0.119 clc/call; Max = 62.583 clc/call;
-- System LIBC latency --
[####################] 100 %
Ntrial = 20 ; Min = 45.206 + 1.503 clc/call; Median-Min = 1.467 clc/call; Max = 47.229 clc/call;
-- LIBC latency -- with FMA
[####################] 100 %
Ntrial = 20 ; Min = 43.042 + 0.454 clc/call; Median-Min = 0.484 clc/call; Max = 43.912 clc/call;
-- LIBC latency -- without FMA
[####################] 100 %
Ntrial = 20 ; Min = 57.016 + 1.636 clc/call; Median-Min = 1.655 clc/call; Max = 58.816 clc/call;
```
- Accurate pass latency:
```
$ ./perf.sh log2 --latency --simple_stat
GNU libc version: 2.35
GNU libc release: stable
-- CORE-MATH latency -- with FMA
177.632
-- CORE-MATH latency -- without FMA (-march=x86-64-v2)
231.332
-- LIBC latency -- with FMA
459.751
-- LIBC latency -- without FMA
463.850
```
Reviewed By: zimmermann6
Differential Revision: https://reviews.llvm.org/D150374
2023-05-23 10:49:30 -04:00
Tue Ly
a68bbf42fa
[libc][math] Implement double precision log function correctly rounded to all rounding modes.
...
Implement double precision log function correctly rounded to all
rounding modes.
See https://reviews.llvm.org/D150014 for a more detail description of the algorithm.
**Performance**
- For `0.5 <= x <= 2`, the fast pass hitting rate is about 99.93%.
- Reciprocal throughput from CORE-MATH's perf tool on Ryzen 5900X:
```
$ ./perf.sh log
GNU libc version: 2.35
GNU libc release: stable
-- CORE-MATH reciprocal throughput -- with FMA
[####################] 100 %
Ntrial = 20 ; Min = 17.465 + 0.596 clc/call; Median-Min = 0.602 clc/call; Max = 18.389 clc/call;
-- CORE-MATH reciprocal throughput -- without FMA (-march=x86-64-v2)
[####################] 100 %
Ntrial = 20 ; Min = 54.961 + 2.606 clc/call; Median-Min = 2.180 clc/call; Max = 59.583 clc/call;
-- System LIBC reciprocal throughput --
[####################] 100 %
Ntrial = 20 ; Min = 12.608 + 0.276 clc/call; Median-Min = 0.359 clc/call; Max = 13.147 clc/call;
-- LIBC reciprocal throughput -- with FMA
[####################] 100 %
Ntrial = 20 ; Min = 20.952 + 0.468 clc/call; Median-Min = 0.602 clc/call; Max = 21.881 clc/call;
-- LIBC reciprocal throughput -- without FMA
[####################] 100 %
Ntrial = 20 ; Min = 18.569 + 0.552 clc/call; Median-Min = 0.601 clc/call; Max = 19.259 clc/call;
```
- Latency from CORE-MATH's perf tool on Ryzen 5900X:
```
$ ./perf.sh log --latency
GNU libc version: 2.35
GNU libc release: stable
-- CORE-MATH latency -- with FMA
[####################] 100 %
Ntrial = 20 ; Min = 48.431 + 0.699 clc/call; Median-Min = 0.073 clc/call; Max = 51.269 clc/call;
-- CORE-MATH latency -- without FMA (-march=x86-64-v2)
[####################] 100 %
Ntrial = 20 ; Min = 64.865 + 3.235 clc/call; Median-Min = 3.475 clc/call; Max = 71.788 clc/call;
-- System LIBC latency --
[####################] 100 %
Ntrial = 20 ; Min = 42.151 + 2.090 clc/call; Median-Min = 2.270 clc/call; Max = 44.773 clc/call;
-- LIBC latency -- with FMA
[####################] 100 %
Ntrial = 20 ; Min = 35.266 + 0.479 clc/call; Median-Min = 0.373 clc/call; Max = 36.798 clc/call;
-- LIBC latency -- without FMA
[####################] 100 %
Ntrial = 20 ; Min = 48.518 + 0.484 clc/call; Median-Min = 0.500 clc/call; Max = 49.896 clc/call;
```
- Accurate pass latency:
```
$ ./perf.sh log --latency --simple_stat
GNU libc version: 2.35
GNU libc release: stable
-- CORE-MATH latency -- with FMA
598.306
-- CORE-MATH latency -- without FMA (-march=x86-64-v2)
632.925
-- LIBC latency -- with FMA
455.632
-- LIBC latency -- without FMA
488.564
```
Reviewed By: zimmermann6
Differential Revision: https://reviews.llvm.org/D150131
2023-05-23 10:35:15 -04:00
Noah Goldstein
0432b85d8e
[LIBC] Implement remainder of posix 'sched.h' minus SCHED_SPORADIC
...
Includes macros:
linux/SCHED_OTHER // posix req
linux/SCHED_FIFO // posix req
linux/SCHED_RR // posix req
linux/SCHED_BATCH
linux/SCHED_ISO
linux/SCHED_IDLE
linux/SCHED_DEADLINE
Includes types:
struct sched_param { int sched_priority; }
Includes functions:
sched_setparam
sched_getparam
sched_setscheduler
sched_getscheduler
sched_get_priority_max
sched_get_priority_min
sched_rr_get_interval
Reviewed By: michaelrj
Differential Revision: https://reviews.llvm.org/D148069
2023-04-20 14:53:41 -05:00
Tue Ly
f79264b5f6
[libc][math] Remove placeholder implementations of asin and pow.
...
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D148781
2023-04-20 01:28:16 -04:00
Michael Jones
1c261e360f
[libc] Add implementation of getchar
...
added getchar and getchar_unlocked which are just wrappers getc and getc_unlocked respectively.
Reviewed By: sivachandra, lntue, michaelrj
Differential Revision: https://reviews.llvm.org/D147919
2023-04-14 15:40:05 -07:00
Noah Goldstein
203aff2df3
[LIBC] Implement sched_yield()
...
Implements: https://linux.die.net/man/2/sched_yield
Possibly we don't need the return value check / errno as according to
both the manpage (and current linux source) `sched_yield` cannot fail.
Reviewed By: sivachandra, michaelrj
Differential Revision: https://reviews.llvm.org/D147985
2023-04-12 19:04:37 -05:00
Caslyn Tonelli
718729e997
[libc] Add memmem implementation
...
Introduce the `memmem` libc string function.
`memmem_implementation` performs shared logic for `strstr`,
`strcasestr`, and `memmem`; essentially reconfiguring what was the
`strstr_implementation` to support length parameters.
Differential Revision: https://reviews.llvm.org/D147822
2023-04-11 20:49:25 +00:00
Caslyn Tonelli
95ca2e2cf9
[libc] Fix swab placement
...
Per https://reviews.llvm.org/D147970#4256889 , swab.cpp is moved out of
the /linux subdirectory and cmake specifications are amended to reflect
that swab is not OS-specific.
Differential Revision: https://reviews.llvm.org/D147988
2023-04-11 18:06:13 +00:00
Alex Brachet
9c7a370505
Reland "[libc] Add {,r}index"
...
Differential Revision: https://reviews.llvm.org/D147464
2023-04-11 04:30:50 +00:00
Alex Brachet
42294bf16f
Revert "[libc] Add {,r}index"
...
This reverts commit a0a141fcbe1dfd35032fa5c052e6906180a37fb1.
2023-04-11 01:26:42 +00:00
Alex Brachet
a0a141fcbe
[libc] Add {,r}index
...
Differential Revision: https://reviews.llvm.org/D147464
2023-04-11 01:17:11 +00:00
Caslyn Tonelli
1a3e760eda
[libc] Add swab implementation
...
Swab implementation is added to libc/src/unistd.
Differential Revision: https://reviews.llvm.org/D147970
2023-04-10 23:37:51 +00:00
Alex Brachet
b4ab398cb1
[libc] Implement strsep
...
Differential Revision: https://reviews.llvm.org/D147503
2023-04-06 17:48:28 +00:00
Caslyn Tonelli
bc2b161408
[libc] Add strchrnul implementation
...
Introduce strchrnul implementation and unit tests.
Submitting on behalf of Caslyn@
Differential Revision: https://reviews.llvm.org/D147346
2023-04-03 11:08:28 -07:00
Siva Chandra Reddy
71825a889a
[libc][NFC] Add string.h header to various platform headers.txt.
2023-03-13 15:34:58 +00:00
Siva Chandra Reddy
4052bc8674
[libc] Make errno an entrypoint.
...
The entrypoint has been added to the various entrypoint lists. The libc
code style doc has been updated with information on how errno should be
set from the libc runtime code.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D145179
2023-03-03 06:59:19 +00:00
Jeff Bailey
8aec3b126b
[libc] Introduce sys/socket.h
...
This adds sys/socket.h and some definitions on Linux.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D144415
2023-02-23 07:11:20 +00:00
Raman Tenneti
d0d6d78bbd
[libc] Implement ntohl and ntohs
...
Per spec:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/ntohl.html
https://pubs.opengroup.org/onlinepubs/9699919799/functions/ntohs.html
Co-authored-by: Jeff Bailey <jbailey@google.com>
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D144506
2023-02-22 10:40:38 -08:00
Raman Tenneti
fbe210dc7a
[libc] Implement htonl and htons
...
Per spec:
* https://pubs.opengroup.org/onlinepubs/9699919799/functions/htonl.html
* https://pubs.opengroup.org/onlinepubs/9699919799/functions/htons.html
Also adds UInt16Type and UInt32Type to spec.td
Co-authored-by: Jeff Bailey <jbailey@google.com>
Reviewed By: sivachandra, jeffbailey, rtenneti
Differential Revision: https://reviews.llvm.org/D143795
2023-02-16 10:12:18 -08:00
Renyi Chen
6cb14adbfa
[libc][math] Implement scalbn, scalbnf, scalbnl.
...
Implement scalbn via `fptuil::ldexp` for `FLT_RADIX==2` case.
"unimplemented" otherwise.
Reviewed By: lntue, sivachandra
Differential Revision: https://reviews.llvm.org/D143116
2023-02-09 05:55:34 +00:00
Tue Ly
9b30f6b6d7
[libc][math] Implement acoshf function correctly rounded to all rounding modes.
...
Implement acoshf function correctly rounded to all rounding modes.
Reviewed By: zimmermann6
Differential Revision: https://reviews.llvm.org/D142781
2023-02-01 11:35:15 -05:00
Tue Ly
46b15fd19e
[libc][math] Implement asinhf function correctly rounded for all rounding modes.
...
Implement asinhf function correctly rounded for all rounding modes.
Reviewed By: zimmermann6
Differential Revision: https://reviews.llvm.org/D142681
2023-01-27 11:12:27 -05:00
Alex Brachet
741021de32
[libc] Implement strcasestr
...
Differential Revision: https://reviews.llvm.org/D142518
2023-01-25 17:58:13 +00:00
Alex Brachet
e9d571d3b6
[libc] Implement str{,n}casecmp
...
Differential Revision: https://reviews.llvm.org/D141236
2023-01-11 05:38:33 +00:00
Tue Ly
5814b7b279
[libc][math] Implement log10 function correctly rounded for all rounding modes
...
Implement double precision log10 function correctly rounded for all
rounding modes. This implementation currently needs FMA instructions for
correctness.
Use 2 passes:
Fast pass:
- 1 step range reduction with a lookup table of `2^7 = 128` elements to reduce the ranges to `[-2^-7, 2^-7]`.
- Use a degree-7 minimax polynomial generated by Sollya, evaluated using a mixed of double-double and double precisions.
- Apply Ziv's test for accuracy.
Accurate pass:
- Apply 5 more range reduction steps to reduce the ranges further to [-2^-27, 2^-27].
- Use a degree-4 minimax polynomial generated by Sollya, evaluated using 192-bit precisions.
- By the result of Lefevre (add quote), this is more than enough for correct rounding to all rounding modes.
In progress: Adding detail documentations about the algorithm.
Depend on: https://reviews.llvm.org/D136799
Reviewed By: zimmermann6
Differential Revision: https://reviews.llvm.org/D139846
2023-01-08 17:41:54 -05:00
Guillaume Chatelet
436c8f4420
[reland][libc] Add bcopy
...
Differential Revision: https://reviews.llvm.org/D138994
2022-12-01 10:07:04 +00:00
Guillaume Chatelet
c5fe7eb216
Revert D138994 "[libc] Add bcopy"
...
Broke build bot
This reverts commit 186a15f7a9311a75f3c5e90243ea5d6d20878de1.
2022-12-01 09:55:36 +00:00
Guillaume Chatelet
186a15f7a9
[libc] Add bcopy
...
Differential Revision: https://reviews.llvm.org/D138994
2022-12-01 09:52:10 +00:00
Joseph Huber
dabb7514f5
[libc] Fix assert.h and ctype.h not being built
...
The `assert.h` and `ctype.h` headers are never built despite their
entrypoints being present in the generated library. This patch adds a
dependency on these headers so that they will be built properly.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D138142
2022-11-16 12:00:41 -06:00
Raman Tenneti
78f172e45a
[libc] Implement gettimeofday
...
Implement gettimeofday per
.../onlinepubs/9699919799/functions/gettimeofday.html.
This call clock_gettime to implement gettimeofday function.
Tested:
Limited unit test: This makes a call and checks that no error was
returned. Used nanosleep for 100 microseconds and verfified it
returns a value that elapses more than 100 microseconds and less
than 300 microseconds.
Co-authored-by: Jeff Bailey <jeffbailey@google.com>
Differential Revision: https://reviews.llvm.org/D137881
2022-11-11 18:02:33 -08:00
Tue Ly
45233cc1ca
[libc][math] Add place-holder implementation for pow function.
...
Add place-holder implementation for pow function to unblock libc demo
examples.
Reviewed By: michaelrj
Differential Revision: https://reviews.llvm.org/D137109
2022-10-31 17:23:33 -04:00
Tue Ly
97b4cc83e1
[libc][math] Add place-holder implementation for asin to unblock demo examples.
...
Add a place-holder implementation for asin to unblock libc demo
examples.
Reviewed By: michaelrj
Differential Revision: https://reviews.llvm.org/D137105
2022-10-31 17:22:12 -04:00
Alex Brachet
5fd03c8176
[libc] Implement getopt
...
Differential Revision: https://reviews.llvm.org/D133487
2022-10-31 16:55:53 +00:00
Alex Brachet
d6ac84bce8
Revert "[libc] Implement getopt"
...
This reverts commit a678f86351c30a7d57197ffefab4e6e44e61a857.
2022-10-27 06:47:24 +00:00
Alex Brachet
a678f86351
[libc] Implement getopt
...
Differential Revision: https://reviews.llvm.org/D133487
2022-10-27 06:23:33 +00:00
Siva Chandra
07b7023181
[libc] Enable more entrypoints on aarch64.
2022-10-26 14:03:15 -07:00
Siva Chandra
f8490601c2
[libc] Enable a few entrypoints on aarch64 already available on x86_64.
2022-10-25 15:41:41 -07:00
Raman Tenneti
12204429f2
[libc] Add implementation of difftime function.
...
The difftime function computes the difference between two calendar
times: time1 - time0 as per as per 7.27.2.2 section in
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2478.pdf .
double difftime(time_t time1, time_t time0);
Tested:
Unit tests
Co-authored-by: Jeff Bailey <jeffbailey@google.com>
Reviewed By: jeffbailey
Differential Revision: https://reviews.llvm.org/D136631
2022-10-24 15:14:26 -07:00
Siva Chandra Reddy
3f965818b6
[libc] Add POSIX execv and execve functions.
...
The POSIX global variable environ has also been added.
Reviewed By: michaelrj
Differential Revision: https://reviews.llvm.org/D135351
2022-10-06 19:50:23 +00:00
Siva Chandra
5e56e294ae
[libc][Obvious] Enable some of the recently added functions on aarch64.
2022-09-29 15:06:44 -07:00
Raman Tenneti
8f1e362ee9
Implement nanosleep per https://pubs.opengroup.org/onlinepubs/009695399/basedefs/time.h.html
...
Tested:
Limited unit test: This makes a call and checks that no error was
returned, but we currently don't have the ability to ensure that
time has elapsed as expected.
Co-authored-by: Jeff Bailey <jeffbailey@google.com>
Reviewed By: sivachandra, jeffbailey
Differential Revision: https://reviews.llvm.org/D134095
2022-09-24 00:13:58 +00:00