Commit Graph

641 Commits

Author SHA1 Message Date
Haojian Wu 5bb0a9075c [libc] Fix two missing cases in 1c92911e9e
Fix the broken build.
2021-12-08 15:14:21 +01:00
Mircea Trofin 5dda2efde5 Re-Reland "[benchmarks] Move libcxx's fork of google/benchmark and llvm/utils'"
This reverts commit b2fbd45d23. D114922
fixed the reason of the 2nd revert.

This patch also re-applies 39e9f5d368.

Differential Revision: https://reviews.llvm.org/D112012
2021-12-07 17:10:41 -08:00
Michael Jones 5b3a51fda1 [libc][obvious] fix missed rename
In https://reviews.llvm.org/D114302 I renamed ForLoopCopy to
for_loop_copy, but these got missed.

Differential Revision: https://reviews.llvm.org/D115303
2021-12-07 16:09:37 -08:00
Michael Jones 2b197888e0 [libc] fix the .yaml files not being tracked
adds the .yaml files clang-tidy generates as byproducts, which means
that they will be updated properly and cleaned by `ninja -t clean`

Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D115290
2021-12-07 16:04:46 -08:00
Michael Jones 1c92911e9e [libc] apply new lint rules
This patch applies the lint rules described in the previous patch. There
was also a significant amount of effort put into manually fixing things,
since all of the templated functions, or structs defined in /spec, were
not updated and had to be handled manually.

Reviewed By: sivachandra, lntue

Differential Revision: https://reviews.llvm.org/D114302
2021-12-07 10:49:47 -08:00
Michael Jones 43e2f7cd24 [libc] update tidy rules to fix variable formatting
This commit changes the clang-tidy rules for LLVM-libc to follow the new
format. The next commit applies these rules to the codebase.

The rules are as follows:

CamelCase for classes
lower_case for variables
lower_case for functions
UPPER_CASE for constexpr variables

There are also some exceptions, but the most important one is that any
function or variable that starts with an underscore is exempt from the
formatting.

Reviewed By: sivachandra, lntue

Differential Revision: https://reviews.llvm.org/D114301
2021-12-07 10:49:45 -08:00
Guillaume Chatelet b902b314ff [libc] Fix invalid include for SqrtLongDouble.h 2021-12-03 16:13:59 +00:00
Guillaume Chatelet 71405d90f0 [libc] Select FPUtils implementations via code instead of build
We want to simplify the build system and rely on code to do the implementation selection.
This is in preparation of adding a Bazel configuration (D114712).

Differential Revision: https://reviews.llvm.org/D115034
2021-12-03 15:48:41 +00:00
Tue Ly dbed678f4b [libc] Fix bugs with negative and mixed normal/denormal inputs in hypot implementation.
Fix a bug with negative and mixed normal/denormal inputs in hypot implementation.

Differential Revision: https://reviews.llvm.org/D114726
2021-12-03 10:14:04 -05:00
Guillaume Chatelet cca8e1e415
[libc][NFC] Fix typo in CMakeLists documentation 2021-12-03 13:52:09 +01:00
Guillaume Chatelet 1479a211d2
Fix typos in FPUtil README 2021-12-03 10:22:00 +01:00
Tue Ly 32568fc95e [libc] Fix a bug in MPFRUtils making ULP values off by 2^(-mantissaWidth).
Fix a bug in MPFRUtils making ULP values off by 2^(-mantissaWidth) and incorrect eps for denormal numbers.

Differential Revision: https://reviews.llvm.org/D114878
2021-12-02 09:07:46 -05:00
Guillaume Chatelet bdcc5aadf5 [libc] Add _64 element to aarch64 2021-12-01 08:20:21 +00:00
Michael Jones 155f5a6dac [libc][clang-tidy] fix namespace check for externals
Up until now, all references to `errno` were marked with `NOLINT`, since
it was technically calling an external function. This fixes the lint
rules so that `errno`, as well as `malloc`, `calloc`, `realloc`, and
`free` are all allowed to be called as external functions. All of the
relevant `NOLINT` comments have been removed, and the documentation has
been updated.

Reviewed By: sivachandra, lntue, aaron.ballman

Differential Revision: https://reviews.llvm.org/D113946
2021-11-30 11:44:24 -08:00
Guillaume Chatelet af059dfef5 [libc] Add a reasonably optimized version for bcmp
This is based on current memcmp implementation.

Differential Revision: https://reviews.llvm.org/D114432
2021-11-30 10:52:34 +00:00
Guillaume Chatelet de21f34691 [libc] Add memmove benchmarks
This patch enables the benchmarking of `memmove`.
Ideally, this should be submitted before D114637.

Differential Revision: https://reviews.llvm.org/D114694
2021-11-30 10:46:16 +00:00
Siva Chandra Reddy 7b59fcb7de [libc] Make string entrypoints mutualy exclusive.
For example, strcpy does not pull memcpy now.

Reviewed By: gchatelet

Differential Revision: https://reviews.llvm.org/D114300
2021-11-26 16:29:22 +00:00
Guillaume Chatelet 408c0cc4eb [libc] Fix wrong type for load/store of Repeated elements 2021-11-24 14:13:13 +00:00
Guillaume Chatelet 1b927b68b6 [libc] add memmove basic building blocks
Differential Revision: https://reviews.llvm.org/D113321
2021-11-22 14:31:56 +00:00
Guillaume Chatelet 2f1c037bbd [libc] Remove unused variable 2021-11-22 10:12:46 +00:00
Siva Chandra Reddy d9bbad277c [libc][Obvious][NFC] A bunch of cosmetic cleanup.
* Added missing header guards.
* Fixed license header format in a few files.
* Renamed files to more suitable names.
2021-11-19 17:02:55 +00:00
Michael Jones 47d0c83e1f [libc] fix strtof/d/ld NaN parsing
Fix the fact that previously strtof/d/ld would only accept a NaN as
having parentheses if the thing in the parentheses was a valid number,
now it will accept any combination of letters and numbers, but will only
put valid numbers in the mantissa.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D113790
2021-11-17 11:00:54 -08:00
Guillaume Chatelet 649d953716 [libc] Use more consistent if defined syntax 2021-11-17 15:16:28 +00:00
Guillaume Chatelet 5ee5acf7d9 [libc] Fix missing restricts 2021-11-17 15:16:25 +00:00
Guillaume Chatelet 392da6428d [libc] Fix documentation typo 2021-11-17 15:16:05 +00:00
Guillaume Chatelet 13744e3d73 [libc][benchmark] add memmove to size distribution, also update other distributions
Differential Revision: https://reviews.llvm.org/D113260
2021-11-17 09:22:05 +00:00
Mircea Trofin 67de95b8c9 Revert "[libc][NFC][Obvious] Fix the benchmarks after the switch to llvm/third-party"
This reverts commit 39e9f5d368.

Reverting, as we needed to re-revert the benchmarks move because it was
causing a build failure in the Fuchsia bots due to the way they consume
libcxx's CMakeLists. I want to make sure I understand where the fix
should be for that. After that, I'll incorporate the change here in the
re-reland.
2021-11-16 16:59:14 -08:00
Mircea Trofin b2fbd45d23 Revert "Reland "[benchmarks] Move libcxx's fork of google/benchmark and llvm/utils'"""
This reverts commit 1ee32055ea.

We hit additional bot failures; in particular, Fuchsia's seems to be
related to how CMakeLists are ingested, see https://ci.chromium.org/ui/p/fuchsia/builders/toolchain.ci/clang-linux-x64/b8830380874445931681/overview
2021-11-16 16:35:06 -08:00
Siva Chandra Reddy 39e9f5d368 [libc][NFC][Obvious] Fix the benchmarks after the switch to llvm/third-party 2021-11-16 22:24:49 +00:00
Tue Ly 201cc2d885 [libc] Correct rounding for hexadecimalStringToFloat with long inputs.
Update binaryExpTofloat so that it will round correctly for long inputs when converting hexadecimal strings to floating points.

Differential Revision: https://reviews.llvm.org/D113815
2021-11-16 14:29:39 -05:00
Mircea Trofin 1ee32055ea Reland "[benchmarks] Move libcxx's fork of google/benchmark and llvm/utils'""
This reverts commit e7568b68da and relands
c6f7b720ec.

The culprit was: missed that libc also had a dependency on one of the
copies of `google-benchmark`

Also opportunistically fixed indentation from prev. change.

Differential Revision: https://reviews.llvm.org/D112012
2021-11-16 10:33:31 -08:00
Shao-Ce SUN 0c660256eb [NFC] Trim trailing whitespace in *.rst 2021-11-15 09:17:08 +08:00
Tue Ly 499ca806dc [libc] Simplify decimalStringToFloat and hexadecimalStringToFloat and improve their performance.
Combine two loops in decimalStringToFloat and hexadecimalStringToFloat that extract the digits and re-arrange them a little bit.  This slightly improves the performance of strtof and strtod:
Running libc_str_to_float_comparison_test parse-number-fxx-test_data/data/* on my machine (Ryzen 1700)
- with glibc: ~1.92 seconds
- with current implementation: ~1.78 seconds
- with this change: ~1.67 seconds

Differential Revision: https://reviews.llvm.org/D113681
2021-11-11 18:33:24 -05:00
Michael Jones 4cdf9884b6 [libc] tweak strtof errno behavior
When strtof/d/ld return a subnormal number they may set errno to
ERANGE. This change makes this behavior more consistent by making any
decimal number converting to a subnormal set errno to ERANGE. This
brings it in line with hexadecimals, which currently only set errno to
ERANGE if the number is truncated when converting to a subnormal.

Reviewed By: sivachandra, lntue

Differential Revision: https://reviews.llvm.org/D113626
2021-11-11 10:17:38 -08:00
Michael Jones 18da0c0a28 [libc] clean up FPUtil long doubles
Add quietNaNMask consts to FloatProperties and make LongDoubleBitsX86
clear the extra bits that aren't set when initializing with an 80 bit
long double.

Reviewed By: sivachandra, lntue

Differential Revision: https://reviews.llvm.org/D113625
2021-11-11 10:17:36 -08:00
Michael Jones 8298424cae [libc] refactor atof string parsing
Split the code for parsing hexadecimal floating point numbers from the
code for parsing the decimal floating point numbers so that the parsing
can be faster for both of them.

This decreases the time for the benchmark in release mode by about 15%,
which noticeably beats GLibc.

Old version: 2.299s
New version: 1.893s
GLibc: 2.133s

Tests run by running the following command 10 times for each version:
time ~/llvm-project/build/bin/libc_str_to_float_comparison_test ~/parse-number-fxx-test-data/data/*

the parse-number-fxx-test-data-repository is here:
fe94de252c

It's important to build llvm-libc in Release mode for accurate
performance comparisons against glibc (set -DCMAKE_BUILD_TYPE=Release in
your cmake).
You also have to build the libc_str_to_float_comparison_test target.

Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D113036
2021-11-09 10:12:18 -08:00
Michael Jones 9b6f8b985c [libc] add stpcpy and stpncpy
Adds an implementation for stpcpy and stpncpy, which are posix extension
functions.

Reviewed By: sivachandra, lntue

Differential Revision: https://reviews.llvm.org/D111913
2021-11-04 11:39:26 -07:00
Guillaume Chatelet c02aa15438 [libc][NFC] Allow memset (and bzero) to be inlined
This allows shipping individual functions without also having to provide
memset or bzero at the expense of bigger functions.

Similar to D113097.

Differential Revision: https://reviews.llvm.org/D113108
2021-11-04 13:48:18 +00:00
Guillaume Chatelet 4f3511e28f [libc][NFC] Allow memcmp to be inlined
Similar to D113097 although not strictly necessary for now. It helps
keeping the same structure for all memory functions.

Differential Revision: https://reviews.llvm.org/D113103
2021-11-04 13:47:50 +00:00
Guillaume Chatelet c2ce8f02ed [libc][NFC] Allow memcpy to be inlined
This allows shipping individual functions without also having to provide
`memcpy` at the expense of bigger functions.
Next is to use this `inlined_memcpy` in:
 - loader/linux/x86_64/start.cpp
 - src/string/memmove.cpp
 - src/string/mempcpy.cpp
 - src/string/strcpy.cpp
 - src/string/strdup.cpp
 - src/string/strndup.cpp

Differential Revision: https://reviews.llvm.org/D113097
2021-11-04 13:47:19 +00:00
Michael Jones 31d797f41e [libc][NFC] rename str_conv_utils to str_to_integer
rename str_conv_utils to str_to_integer to be more
in line with str_to_float.

Reviewed By: sivachandra, lntue

Differential Revision: https://reviews.llvm.org/D113061
2021-11-03 15:56:28 -07:00
Guillaume Chatelet 0aea170b97 [libc] Add more robust compile time architecture detection
We may want to restrict the detected platforms to only `x86_64` and `aarch64`.
There are still custom detection in api.td but I don't think we can handle these:
 - config/linux/api.td:205
 - config/linux/api.td:199

Differential Revision: https://reviews.llvm.org/D112818
2021-11-02 11:00:33 +00:00
Michael Jones 3bbbec1ae7 [libc] add strndup
add an implementation of strndup

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D112846
2021-11-01 12:52:51 -07:00
Guillaume Chatelet fe953b15cf Revert "[libc] Add more robust compile time architecture detection"
This reverts commit a72e249986.
2021-10-29 20:25:55 +00:00
Guillaume Chatelet a72e249986 [libc] Add more robust compile time architecture detection
We may want to restrict the detected platforms to only `x86_64` and `aarch64`.
There are still custom detection in api.td but I don't think we can handle these:
 - config/linux/api.td:205
 - config/linux/api.td:199

Differential Revision: https://reviews.llvm.org/D112818
2021-10-29 20:15:12 +00:00
Guillaume Chatelet d7cc760f3b [libc][NFC] Fix typo and unused variable
Differential Revision: https://reviews.llvm.org/D112823
2021-10-29 19:42:51 +00:00
Michael Jones 62c187cb55 [libc] add fast path to string to float conversion
Add the fast path first described by Clinger [1] with additions by Gay [2].
This speeds up conversion by about 10% by handling numbers with fewer digits
more efficiently.

[1] Clinger WD. How to Read Floating Point Numbers Accurately.
SIGPLAN Not 1990 Jun;25(6):92–101. https://doi.org/10.1145/93548.93557.
[2] Gay DM, Correctly rounded binary-decimal and decimal-binary conversions;
1990. AT&T Bell Laboratories Numerical Analysis Manuscript 90-10.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D112580
2021-10-29 10:50:03 -07:00
Siva Chandra Reddy 6c3f53c7ba [libc][NFC] Move test related pieces from FPUtil to util/UnitTest.
Reviewed By: michaelrj

Differential Revision: https://reviews.llvm.org/D112673
2021-10-29 15:37:30 +00:00
Siva Chandra Reddy f362aea42d [libc][NFC] Move utils/CPP to src/__support/CPP.
The idea is to move all pieces related to the actual libc sources to the
"src" directory. This allows downstream users to ship and build just the
"src" directory.

Reviewed By: michaelrj

Differential Revision: https://reviews.llvm.org/D112653
2021-10-28 15:50:00 +00:00
Guillaume Chatelet 00c943a548 [libc] automemcpy 2021-10-28 11:10:15 +00:00
Michael Jones 9830518082 [libc][obvious] fix strdup being listed twice
strdup was being included even if malloc wasn't and that was causing
a build failure.

Differential Revision: https://reviews.llvm.org/D112641
2021-10-27 11:13:08 -07:00
Michael Jones 65bb6593e5 [libc] add strdup implementation
Add an implementation for strdup.

Reviewed By: lntue, sivachandra

Differential Revision: https://reviews.llvm.org/D111584
2021-10-27 10:21:04 -07:00
Michael Jones 7dcdbabb3b [libc] add malloc funcs as external entrypoints
malloc, calloc, realloc, and free are all functions that other libc
functions depend on, but are pulled from external sources, instead of
having an internal implementation. This patch adds a way to include
functions like that as entrypoints in the list of external entrypoints,
and includes the malloc functions using this new path.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D112104
2021-10-27 10:21:01 -07:00
Michael Jones 53804d4eb2 [libc] fix strtol returning the wrong length
Previously, strtol/ll/ul/ull would return a pointer to the end of its
parsing, regardless of if it detected a number. Now it will return a
length of 0 when it doesn't find a number.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D112176
2021-10-25 15:00:45 -07:00
Joe Loser 59cf6a7403
[libc][NFC] Remove extra space in libc/CMakeLists.txt 2021-10-25 16:29:14 -04:00
Joe Loser 46c82753f6
[libc][NFC] Remove extra slash in path in libc/CMakeLists.txt
Remove extra `/` in path to match the include filepath from the previous
line.

Differential Revision: https://reviews.llvm.org/D112476
2021-10-25 16:26:49 -04:00
Kazu Hirata d8e4170b0a Ensure newlines at the end of files (NFC) 2021-10-23 08:45:29 -07:00
Michael Jones 87c016078a [libc] add atof, strtof and strtod
Add the string to floating point conversion functions.
Long doubles aren't supported yet, but floats and doubles are. The
primary algorithm used is the Eisel-Lemire ParseNumberF64 algorithm,
with the Simple Decimal Conversion algorithm as backup.

Links for more information on the algorithms:

Number Parsing at a Gigabyte per Second, Software: Practice and
Experience 51 (8), 2021 (https://arxiv.org/abs/2101.11408)
https://nigeltao.github.io/blog/2020/eisel-lemire.html
https://nigeltao.github.io/blog/2020/parse-number-f64-simple.html

Differential Revision: https://reviews.llvm.org/D109261
2021-10-18 16:10:03 -07:00
Guillaume Chatelet 4a9bcb605b [libc] Memory function benchmarks: rename MemcmpConfiguration in MemcmpOrBcmpConfiguration
This will help make sense of the double use of the same type in https://reviews.llvm.org/D111622#inline-1065560.

Differential Revision: https://reviews.llvm.org/D111868
2021-10-15 13:42:29 +00:00
Michael Jones db8a88fef8 [libc] add memccpy and mempcpy
Add an implementation for memccpy and mempcpy. These functions are
posix extensions for the moment.

Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D111762
2021-10-14 16:38:00 -07:00
Michael Jones 9e9803bf82 [libc] Add strncat and fix strcat
This adds strncat to llvm libc. In addition, an error was found with
strcat and that was fixed.

Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D111583
2021-10-12 18:18:18 +00:00
Guillaume Chatelet ad82fe7b28 [libc] Add rep;movsb as an accelerator under x86 2021-10-08 14:31:55 +00:00
Guillaume Chatelet f256c39541 [libc] ifdef guard element architecture implementations 2021-10-08 14:25:26 +00:00
Guillaume Chatelet d01ae990e1 Revert "[libc] Add rep;movsb as an accelerator under x86"
This reverts commit 1c7160300d.
2021-10-08 13:44:37 +00:00
Guillaume Chatelet 1c7160300d [libc] Add rep;movsb as an accelerator under x86 2021-10-08 13:34:59 +00:00
Michael Jones 6f80339b18 [libc][NFC] Add supporting class for atof implementation
This change adds the High Precision Decimal described here:
https://nigeltao.github.io/blog/2020/parse-number-f64-simple.html
It will be used for the atof implementation later, but is complete and
tested now.

The code is inspired by the golang implmentation of the HPD class, which
can be found here: https://github.com/golang/go/blob/release-branch.go1.16/src/strconv/decimal.go

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D110454
2021-10-04 21:08:02 +00:00
Guillaume Chatelet adc18ad6ac [libc] move benchmark function registration to a different file 2021-09-30 13:11:33 +00:00
Michael Jones b62d72f3c5 [libc] Add support for 128 bit ints in limits.h
Also, this adds unit tests to check that limits.h complies with the C
standard.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D110643
2021-09-28 23:50:16 +00:00
Siva Chandra Reddy 8379fc4a53 [libc] Add implementations of the C standard condition variable functions.
Reviewed By: michaelrj

Differential Revision: https://reviews.llvm.org/D108948
2021-09-28 21:18:45 +00:00
Siva Chandra Reddy 5c3c716bb1 [libc] Add FE_DFL_ENV and handle it in fesetenv.
Reviewed By: michaelrj

Differential Revision: https://reviews.llvm.org/D110611
2021-09-28 18:09:52 +00:00
Michael Jones 43c543aab7 [libc][NFC] Make strchr and strrchr more consistent
Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D110581
2021-09-28 17:42:03 +00:00
Siva Chandra Reddy 5eb6b82729 [libc] Add an implementation of qsort.
A fuzzer for qsort has also been added.

Reviewed By: michaelrj

Differential Revision: https://reviews.llvm.org/D110382
2021-09-24 19:22:45 +00:00
Andre Vieira 8b87c3d573 [libc] Add optimized memset for AArch64
Differential Revision: https://reviews.llvm.org/D107848
2021-09-23 09:19:47 +01:00
Siva Chandra Reddy 32a5007865 [libc] Add an implementation of bsearch.
Reviewed By: michaelrj

Differential Revision: https://reviews.llvm.org/D110222
2021-09-22 16:37:03 +00:00
Siva Chandra Reddy f5b8f1247c [libc][obvious] Add inttypes.h and stdlib.h as deps to *div functions. 2021-09-20 05:54:32 +00:00
Siva Chandra Reddy 5252aa2981 [libc][obvious] Make *abs and *div functions buildable in default mode. 2021-09-20 05:44:49 +00:00
Siva Chandra Reddy 74670e79b0 [libc] Add implementations of div, ldiv, lldiv and imaxdiv.
Reviewed By: michaelrj

Differential Revision: https://reviews.llvm.org/D109952
2021-09-20 04:51:42 +00:00
Cheng Wang 3582828748 [libc][Obvious] Some clean work with memmove. 2021-09-14 17:30:37 +08:00
Guillaume Chatelet cc84ce9129 Revert "[libc] Some clean work with memmove."
This reverts commit b659b789c0.
2021-09-13 14:32:08 +00:00
Siva Chandra Reddy 0da5ac1a75 [libc] Add extension functions fedisableexcept, feenableexcept and fegetexcept.
Reviewed By: michaelrj

Differential Revision: https://reviews.llvm.org/D109613
2021-09-10 18:44:53 +00:00
Cheng Wang 2fc1913505 [libc] Check signs instead of values in memcmp unittests.
The C standard only guarantees the sign of return value. The exact return
value is implementation defined.

Reviewed By: gchatelet

Differential Revision: https://reviews.llvm.org/D109588
2021-09-10 18:35:10 +08:00
Cheng Wang b659b789c0 [libc] Some clean work with memmove.
- Replace `move_byte_forward()` with `memcpy`. In `memcpy` implementation,
it copies bytes forward from beginning to end. Otherwise, `memmove` unit
tests will break.
- Make `memmove` unit tests work.

Reviewed By: gchatelet

Differential Revision: https://reviews.llvm.org/D109316
2021-09-10 16:52:42 +08:00
Siva Chandra Reddy c5cfbe40de [libc] Skip fenv exception tests on aarch64 if HW doesn't support exceptions.
Reviewed By: michaelrj

Differential Revision: https://reviews.llvm.org/D109538
2021-09-09 20:47:59 +00:00
Guillaume Chatelet 219a1d217d [libc] Fix running benchmarks under msan/asan
asan/msan intercepts `aligned_malloc` and misbehave when the requested
alignment is greater than 512.
b041b613e6/compiler-rt/lib/asan/asan_allocator.cpp (L430-L431)
2021-09-08 14:43:55 +00:00
Siva Chandra Reddy 2bf8be79b1 [libc][NFC] Add fenv and string headers to x86_64 headers list. 2021-09-07 21:06:39 +00:00
Cheng Wang 9b015383f1 [libc][Obvious] Reorder CMakelists alphabetically. 2021-09-05 11:01:05 +08:00
Cheng Wang 7abd8f6c6e [libc][Obvious] Fix typos 2021-09-05 10:54:52 +08:00
Michael Jones 37ce7349f7 [libc] fix strtointeger hex prefix parsing
Fix edge case where "0x" would be considered a complete hexadecimal
number for purposes of str_end. Now the hexadecimal prefix needs a valid
digit after it, else just the 0 will be counted as the number.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D109084
2021-09-03 20:39:15 +00:00
Siva Chandra Reddy 2f4f452f16 [libc] Add a skeleton for C standard condition variable functions.
This patch adds a skeleton as a preparatory step for the next patch which
adds the actual implementations of the condition variable functions.

Reviewed By: michaelrj

Differential Revision: https://reviews.llvm.org/D108947
2021-09-01 19:41:52 +00:00
Siva Chandra Reddy 0239adac4a [libc] Mark return value of memcpy in strcpy as initialized for msan.
Reviewed By: michaelrj

Differential Revision: https://reviews.llvm.org/D109045
2021-09-01 19:01:25 +00:00
Michael Jones 7f2ce19d1c [libc][nfc][obvious] fix typos in FPUtil
Fix minor typos in FPUtil comments.

Reviewed By: michaelrj

Differential Revision: https://reviews.llvm.org/D108952
2021-08-30 22:39:02 +00:00
Siva Chandra Reddy 7a2a765745 [libc] Add mtx_destroy which does nothing.
There is not cleanup to be done for the mutex type so mtx_destroy does
nothing.
2021-08-30 20:43:46 +00:00
Siva Chandra Reddy 3383ec5fdd [libc] Ensure the result of the clone syscall is not on stack in thrd_create.
Also, added a call to munmap on error in thrd_create.
2021-08-30 04:35:40 +00:00
Siva Chandra Reddy f7e572b4f4 [libc][NFC] Add a check to catch mismatch in internal and public mutex types. 2021-08-30 04:08:35 +00:00
Roland McGrath 225eb8a22d [libc][NFC] Fix onre more -Wconversion warning in strtoul test code.
The last change missed one spot.

Differential Revision: https://reviews.llvm.org/D108845
2021-08-27 14:12:39 -07:00
Roland McGrath 4e1a164d7b [libc] Fix various -Wconversion warnings in strto*l test code.
The Fuchsia build compiles the libc and test code with lots
of warnings enabled, including all the integer conversion warnings.
There was some sloppy type usage here that triggered some of those.

Reviewed By: michaelrj

Differential Revision: https://reviews.llvm.org/D108800
2021-08-27 14:04:00 -07:00
Siva Chandra Reddy 8e284be04f [libc][Obvious] Add header guards for the generated linux syscall header file. 2021-08-27 16:17:53 +00:00
Siva Chandra Reddy 004c7b1da6 [libc][NFC] Move the mutex implementation into a utility class.
This allows others parts of the libc to use the mutex types without
actually pulling in public function implementations.

Along the way, few cleanups have been done, like using a uniform type to
refer the linux futex word.

Reviewed By: michaelrj

Differential Revision: https://reviews.llvm.org/D108749
2021-08-26 18:49:20 +00:00
Michael Jones 035325275c [libc] add inttypes header
Add inttypes.h to llvm libc. As its first functions strtoimax and
strtoumax are included.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D108736
2021-08-26 18:04:21 +00:00
Michael Jones fdee2d768d [libc] Fix too long number in strtoul_test
I think this is the last windows type conversion fix, the rest of the
build seems to be okay.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D108659
2021-08-24 20:17:09 +00:00