Commit Graph

245 Commits

Author SHA1 Message Date
cgyurgyik 6cd50e7b75 [libc] Add implementations for isblank, iscntrl, isgraph, ispunct.
Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D85059
2020-08-04 15:16:58 -04:00
cgyurgyik 1b35c4fed2 [libc] [obvious] In strrchr, remove cast to unsigned char before
comparison.
2020-07-31 20:14:34 -04:00
cgyurgyik 5954755939 [libc] [obvious] Fix strchr and strrchr tests so that constness is
actually verified.
2020-07-31 20:00:59 -04:00
Chris Gyurgyik 7212ad067e
[libc] [obvious] Add rest of strrchr test. 2020-07-31 14:57:46 -04:00
cgyurgyik e8a2af28af [libc] Adds strrchr implementation.
Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D84875
2020-07-31 14:38:34 -04:00
cgyurgyik e2d4bf6cec [libc] Add islower and isupper implementation.
Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D84960
2020-07-31 14:05:27 -04:00
Siva Chandra Reddy a32af8252f [libc] Add a tool called WrapperGen.
This tool will be used to generate C wrappers for the C++ LLVM libc
implementations. This change does not hook this tool up to anything yet.
However, it can be useful for cases where one does not want to run the
objcopy step (to insert the C symbol in the object file) but can make use
of LTO to eliminate the cost of the additional wrapper call. This can be
relevant for certain downstream platforms. If this tool can benefit other
libc platforms in general, then it can be integrated into the build system
with options to use or not use the wrappers. An example of such a
platform is CUDA.

Reviewed By: abrachet

Differential Revision: https://reviews.llvm.org/D84848
2020-07-30 16:07:26 -07:00
cgyurgyik e263dcc3ef [libc] Implements isdigit and isalnum. Adds a utility header to inline
functions to avoid overhead of function calls.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D84893
2020-07-30 12:37:30 -04:00
cgyurgyik e14a7ff762 [libc] Adds fuzz test for strstr and alphabetizes string fuzz CMakeList.
Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D84611
2020-07-29 16:35:59 -04:00
Chris Gyurgyik 33abb7292e
[libc] [obvious] Fix typo in binary header. 2020-07-29 08:18:07 -04:00
Siva Chandra Reddy cd7a5c3cd9 [libc][obvious] Add license headers to APIIndexer.[cpp|h]. 2020-07-28 17:04:03 -07:00
Siva Chandra Reddy 462b3564f1 [libc][obvious] Add the new ctype.h target to the list of x86_64 headers.
This will fix the integration test which is failing currently.
2020-07-28 16:42:25 -07:00
Siva Chandra Reddy 59f17a7d4f [libc][NFC] Move tablegen indexer class into a util library of its own.
This class is currently used by two tools: HdrGen and PrototypeTestGen.
We will be adding more tools based on this class so it is convenient to
keep it in a util library of its own.
2020-07-28 16:35:19 -07:00
cgyurgyik 75f222b476 [libc] [Obvious] Delete ctype.h, since ctype.h.def is used. 2020-07-28 19:20:14 -04:00
cgyurgyik 686c82b974 [libc] Add scaffolding for ctype and implementation of isalpha
Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D84575
2020-07-28 19:17:31 -04:00
Siva Chandra Reddy 9cc70e047c [libc][NFC] Zero out padding bits in the uint form of x86 FPBits<long double>. 2020-07-28 11:59:04 -07:00
Siva Chandra Reddy acca2980a3 [libc][obvious] Move ErrnoSetterMatcher to test/ErrnoSetterMetcher.h. 2020-07-28 11:05:52 -07:00
cgyurgyik 51eeeb477f [libc] [Obvious] Place entrypoints, specs alphabetically. 2020-07-24 15:52:35 -04:00
cgyurgyik 5a9630b777 [libc] Adds implementation for memrchr.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D84469
2020-07-24 14:40:12 -04:00
Tue Ly 1404d9d68a [libc] Remove unused #include <vector> in fmin_test, fminf_test, and fminl_test. 2020-07-23 15:26:05 -04:00
Tue Ly 4096088e19 [libc] Add implementations of fmax, fmaxf, and fmaxl.
Summary: Add implementations of fmax, fmaxf, and fmaxl.

Reviewers: sivachandra

Subscribers: mgorny, tschuett, libc-commits, ecnelises

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D84385
2020-07-23 15:23:08 -04:00
cgyurgyik f773d37ee1 [libc] Implements strnlen.
Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D84247
2020-07-22 18:28:35 -04:00
Tue Ly 7ce32f87f9 Add implementations for fmin, fminf, and fminl. Testing infrastructure update is splitted to https://reviews.llvm.org/D83931. 2020-07-21 17:24:15 -04:00
Tue Ly e138ad41e0 Update Test (EXPECT_EQ and friends) to accept __uint128_t and floating point types (float, double, long double).
Summary: Update Test (EXPECT_EQ and friends) to accept __uint128_t and floating point types (float, double, long double).

Reviewers: sivachandra

Subscribers: mgorny, libc-commits

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D83931
2020-07-21 16:50:45 -04:00
Chris Gyurgyik a16129c138
[libc] [Obvious] Fix typo.
Fixes typo for strstr in entrypoints.
str -> src.
2020-07-21 11:52:12 -04:00
cgyurgyik d080635bfc [libc] Add strstr implementation.
Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D83956
2020-07-21 11:39:23 -04:00
Siva Chandra Reddy 7738c03418 [libc][NFC] Use RemoveCVType to implement IsIntegral and IsPointerType.
Added IsSameV as a convenience variable and used it where convenient.

Reviewers: abrachet, lntue

Differential Revision: https://reviews.llvm.org/D83980
2020-07-17 11:32:50 -07:00
Siva Chandra Reddy f5db2411c2 [libc][Obvious] Cleanup of include lines and target listings in FPUtil. 2020-07-17 00:09:36 -07:00
serge-sans-paille 515bc8c155 Harmonize Python shebang
Differential Revision: https://reviews.llvm.org/D83857
2020-07-16 21:53:45 +02:00
Andre Vieira c051312eb2 [libc][benchmark] Add display option to render.py3
Differential Revision: https://reviews.llvm.org/D83380
2020-07-13 12:09:14 +01:00
cgyurgyik 7859242a37 [libc] [Obvious] Remove unneeded header in strchr.
Reviewers: sivachandra

Reviewed By: sivachandra

Subscribers: mgorny, tschuett, ecnelises, libc-commits

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D83589
2020-07-10 19:33:55 -04:00
cgyurgyik a4f0c58c6e [libc] Add strchr implementation. Fixes bug in memchr.
Summary: [libc] Adds strchr implementation with unit tests. Fixes signed character bug in memchr.

Reviewers: sivachandra, PaulkaToast

Reviewed By: sivachandra

Subscribers: mgorny, tschuett, ecnelises, libc-commits

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D83353
2020-07-10 14:30:20 -04:00
Chris Gyurgyik 9d8b4defd3
[libc] Fix typographical error in math_utils.h. 2020-07-08 11:56:21 -04:00
cgyurgyik b6a20a4970 [libc] Add memchr implementation. 2020-07-07 17:08:50 -04:00
Paula Toth ab25ed26c6 [libc] Add documentation for clang-tidy checks.
Reviewers: sivachandra

Reviewed By: sivachandra

Subscribers: tschuett, ecnelises, libc-commits

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D82846
2020-07-06 18:15:35 -07:00
Paula Toth aa6ef6fea0 [libc] Add documentation for integration tests.
Reviewers: sivachandra

Reviewed By: sivachandra

Subscribers: MaskRay, tschuett, ecnelises, libc-commits

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D82907
2020-07-06 12:44:32 -07:00
cgyurgyik b07feef873 [libc] This commit fixes the strcmp fuzzing test. It uses a single input and
splits it into two by using the value of the first byte to determine the
length of the first string. Reviewed-by: PaulkaToast, Differential
Revision: https://reviews.llvm.org/D82427

Summary:
[libc] Since only one input is given, it is necessary to split the string into two containers so that they can be compared for the purposes of this fuzz test. This is done in the following manner:

1. Take the value of the first byte; this is size1. (Credits to @PaulkaToast for this idea).
2. size2 is the value of size - size1.
3. Copy the characters to new containers, data1 and data2 with corresponding sizes.
4. Add a null terminator to the first container, and verify the second container has a null terminator.
5. Verify output of strcmp.

A simpler alternative considered was simply splitting the input data into two, but this means the two strings are always within +- 1 character of each other. This above implementation avoids this.

ninja check-libc was run; no issues.

Reviewers: PaulkaToast, sivachandra

Reviewed By: PaulkaToast

Subscribers: mgorny, tschuett, ecnelises, libc-commits, PaulkaToast

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D82427
2020-06-28 12:50:04 -05:00
Siva Chandra Reddy d4adac4832 [libc] Add the remaining long double flavors of nearest integer functions.
Specifically: ceill, floorl and roundl have been added.

Reviewers: asteinhauser

Differential Revision: https://reviews.llvm.org/D82591
2020-06-25 22:45:05 -07:00
Siva Chandra 25ac19de4b [libc] Enable copysignl, frexpl, logbl and modfl on aarch64. 2020-06-24 00:16:23 -07:00
Siva Chandra Reddy 7abdb2b948 [libc][Obvious] Remove a debug #include of iostream. 2020-06-24 00:01:03 -07:00
Siva Chandra Reddy a00fb593b4 [libc] Add long double flavors of the floating point manipulation functions.
Specifically: copysignl, frexpl, logbl and modfl have been added.

Reviewers: asteinhauser

Differential Revision: https://reviews.llvm.org/D82357
2020-06-23 23:46:58 -07:00
Siva Chandra Reddy dc72be4e01 [libc][Obvious] Fix few typos in tests. 2020-06-23 13:11:41 -07:00
cgyurgyik 8bec88e638 Remove strcmp fuzz from CMakeList since it breaks build. 2020-06-23 12:52:36 -04:00
Simon Pilgrim f1c671925b Add stddef.h to fix missing size_t type build errors. 2020-06-23 13:12:18 +01:00
cgyurgyik 4ffe2b24f5 [libc] Add fuzz test for strcmp.
Summary:
Adds a fuzz test for string comparison.

This takes in two strings with associated lengths.
Verifies each string contains at least one character, and that the last character is the null terminator.
Then, finds the first instance where one of the following does not hold:
1. i < min(size1, size2)
2. s1[i] == s2[i]
3. s1[i] != '\0'

The result of strcmp is then compared to the value of the difference between s1[i] and s2[i]. For thoroughness, the operands are reversed and also checked.

Reviewers: sivachandra, PaulkaToast

Reviewed By: sivachandra, PaulkaToast

Subscribers: mgorny, tschuett, ecnelises, libc-commits

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D82247
2020-06-23 07:24:03 -04:00
cgyurgyik 5540765be6 Add strcmp fuzz test.
Reviewed-by: todo
Differential Revision: https://reviews.llvm.org/D82247
2020-06-23 07:20:39 -04:00
Siva Chandra Reddy 987fac79c9 [libc] Match x86 long double NaN classification with that of the compiler.
Reviewers: asteinhauser

Differential Revision: https://reviews.llvm.org/D82330
2020-06-22 23:02:05 -07:00
cgyurgyik 05e1612c43 [libc] This adds the strcmp (string compare) implementation.
Reviewed-by: sivachandra
Differential Revision: https://reviews.llvm.org/D82134
2020-06-19 16:09:44 -04:00
Anthony Steinhauser 1a377055a7 [libc] Migrate the libc benchmark instruction to ninja.
Reviewers: sivachandra

    Reviewed By: sivachandra

    Differential Revision: https://reviews.llvm.org/D82143
2020-06-18 21:54:30 -07:00
Siva Chandra Reddy 139018265b [libc] Add implementations long double fabsl and truncl functions.
Current implementations of single precision and double precision
floating point operations operate on bits of the integer type of
same size. The code made use of magic masks which were listed as
literal integer values. This is not possible in the case of long
double type as the mantissa of quad-precision long double type used
on non-x86 architectures is wider that the widest integer type for
which we can list literal values. So, in this patch, to avoid
using magic masks specified with literal values, we use packed
bit-field struct types and let the compiler generate the masks.
This new scheme allows us to implement long double flavors of the
various floating point operations. To keep the size of the patch
small, only the implementations of fabs and trunc have been
switched to the new scheme. In following patches, all exisiting
implementations will be switched to the new scheme.

Reviewers: asteinhauser

Differential Revision: https://reviews.llvm.org/D82036
2020-06-18 11:08:26 -07:00
Siva Chandra Reddy 438f7fc068 [libc][benchmarks] Link the memory benchmark exes to functions from LLVM libc.
Summary:
To get the target order correct, the benchmarks directory has been moved
one level higher. Previously, it was living in the utils directory. The
utils directory is a collection of utils which are to be used by the
tests and implementations. However, benchmarks *use* the
implementations. So, moving it out of utils helps us setup proper
target level dependencies.

Reviewers: gchatelet

Differential Revision: https://reviews.llvm.org/D81910
2020-06-17 11:42:26 -07:00
Siva Chandra Reddy 6fb7f3a3cf [lib][NFC] Split the floating point util functions into multiple files.
The grouping now reflects the grouping on cppreference.com.
2020-06-15 23:12:00 -07:00
Siva Chandra 7e54df6829 [libc] Enable string functions for aarch64. 2020-06-15 09:36:40 -07:00
Siva Chandra Reddy 051f0ffdbf [libc] Extract an architecture independent copy of memcpy implementation.
Along that way, platform specific options to memcpy, memset and bzero
builds have been enclosed in conditionals. Also, the optimization level
has been set to -O2 for the memory function builds to actually see the
static functions inlined.

Reviewers: gchatelet

Differential Revision: https://reviews.llvm.org/D81621
2020-06-15 09:24:32 -07:00
Siva Chandra Reddy 118c13c691 [libc] Add implementation of few floating point manipulation functions.
Implementations of copysign[f], frexp[f], logb[f], and modf[f] are added.

Reviewers: asteinhauser

Differential Revision: https://reviews.llvm.org/D81134
2020-06-11 12:23:11 -07:00
Paula Toth 0dcdc1c863 [libc] Fix integration test header dependency. 2020-06-10 21:52:27 -07:00
Siva Chandra Reddy b622a255a3 [libc][Obvious] Use full path with cmake's if(EXISTS ...).
That if(EXISTS ...) works only with full paths was missed in couple of
places a in recent cleanup.
2020-06-10 15:08:00 -07:00
Siva Chandra 1f567b2c6f [libc] Add a simple linux aarch64 config.
Summary:
With this change, "ninja check-libc" on linux/aarch64 succeeds.

However, all entrypoints with machine dependent implementations
have been skipped. A good number of these skipped entrypoints can
be enabled once we have aarch64 syscall support available.

Reviewers: abrachet, asteinhauser

Differential Revision: https://reviews.llvm.org/D81533
2020-06-10 11:19:52 -07:00
Siva Chandra c76a1d0fc0 [libc][NFC] Make cpu feature check tolerate non-x86 architectures.
The feature check should probably be enhanced for non-x86 architectures,
but this change shields them from x86 specific pieces until then.

This patch has been split out from https://reviews.llvm.org/D81533.
2020-06-10 11:11:04 -07:00
Siva Chandra Reddy 4be1c116ad [libc] Add implementations of round and roundf.
Reviewers: asteinhauser

Differential Revision: https://reviews.llvm.org/D80779
2020-06-09 23:01:20 -07:00
Siva Chandra Reddy 9894236e70 [libc] Skip fuzzer as well if its dependent entrypoints are skipped.
Reviewers: asteinhauser

Subscribers: mgorny, tschuett, ecnelises, libc-commits

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D81519
2020-06-09 21:49:50 -07:00
Siva Chandra Reddy ef0ea8717a [libc][NFC] Adjust sinf and cosf around -infinity inputs.
The current tests verify if the result of -infinity is a quiet NaN with
sign bit set. But, that need not be the case on all platforms. So, just
checking that the result is a quiet NaN and ignoring the sign bit is
good enough.
2020-06-09 16:23:12 -07:00
Siva Chandra Reddy 235e9cc924 [libc][NFC][Obvious] Tidy up some CMake files.
Conditionally adding subdirectories was missed in a few places previously.
This change adds the conditionals. A sub-directory was being added
needlessly in another place. That has been removed.
2020-06-09 15:54:07 -07:00
Siva Chandra Reddy fd3295fb6f [libc] Skip entrypoints not present in the entrypoints list.
Summary:
If a test depends on a skipped entrypoint, then the test is also
skipped. This setup will be useful as we gradually add support for
more operating systems and target architectures.

Reviewers: asteinhauser

Differential Revision: https://reviews.llvm.org/D81489
2020-06-09 14:40:28 -07:00
Siva Chandra Reddy 11eafdb1d9 [libc][NFC] Add few more missing entrypoints to the entrypoint list.
They were likely missed while rebasing.
2020-06-08 22:08:42 -07:00
Siva Chandra Reddy 63bbddf4cd [libc][NFC] Add bzero to list of entrypoints.
A new LLVM libc specific extension standard spec has been added.
2020-06-08 21:44:39 -07:00
Siva Chandra Reddy e9de9e3368 [libc][NFC][Obvious] Add names to various string entrypoints. 2020-06-08 17:13:53 -07:00
Siva Chandra Reddy b28167928d [libc][NFC] Add ceil[f], floor[f] and trunc[f] to the spec and config files. 2020-06-03 22:39:34 -07:00
Paula Toth d5e0dfd507 [libc] Remove integration test target from check libc.
Summary:
This is failing on the asan build because we use `-nostdlib`.
I also took this opportunity to make the target name match the naming structure we've been using.

Reviewers: sivachandra

Reviewed By: sivachandra

Subscribers: mgorny, tschuett, ecnelises, libc-commits

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D81029
2020-06-02 13:32:21 -07:00
Paula Toth b836ae24a9 [libc] Add integration tests.
Summary:
This patch aims to add integration tests to check the following:
1) Header files are generated as expected.
2) Libc functions have the correct public name.
3) Libc functions have the correct return type and parameter types.
4) Symbols are exposed in the public lib.a files.

Reviewers: sivachandra, abrachet

Reviewed By: sivachandra

Subscribers: aheejin, ecnelises, dxf, mgorny, jfb, tschuett, libc-commits

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D79192
2020-06-02 12:14:07 -07:00
Paula Toth 1ab092b758 [libc] Expose APIGenerator.
Summary: This is split off from D79192 and exposes APIGenerator (renames to APIIndexer) for use in generating the integrations tests.

Reviewers: sivachandra

Reviewed By: sivachandra

Subscribers: tschuett, ecnelises, libc-commits

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D80832
2020-06-01 12:30:35 -07:00
Siva Chandra Reddy 1caedd0c55 [libc] Add implementations of ceil[f], floor[f] and trunc[f] from math.h.
Reviewers: abrachet

Differential Revision: https://reviews.llvm.org/D80612
2020-06-01 08:36:59 -07:00
Siva Chandra Reddy 0baf0e8cfc [libc] Add implementation of call_once from threads.h.
Reviewers: abrachet, maskray

Differential Revision: https://reviews.llvm.org/D79828
2020-05-28 23:45:09 -07:00
Siva Chandra Reddy c7614faa05 [libc][NFC][Obvious] Fix few header guards in src/threads. 2020-05-28 15:07:27 -07:00
Siva Chandra Reddy 10bb03c1c1 [libc][NFC][Obvious] Remove line break from a CMake message.
The line break was giving an impression of something going wrong.
2020-05-28 14:55:24 -07:00
Anthony Steinhauser 504d8d9d8a [libc] Fixing the build command for benchmarks.
Building libc without clang fails with:
CMake Error at /home/asteinhauser/llvm-project/libc/CMakeLists.txt:49 (message):
'clang' and 'clang-tools-extra' are required in LLVM_ENABLE_PROJECTS to
lint llvm-libc. The linting step performs important checks to help prevent
the introduction of subtle bugs, but it may increase build times.

Reviewers: sivachandra

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D80495
2020-05-28 11:19:20 -07:00
Siva Chandra Reddy 9f69d3d0bc [libc][NFC][Obvious] Convert the MPFR operations enum to an enum class.
This was suggested in https://reviews.llvm.org/D79149.
2020-05-26 22:26:41 -07:00
Guillaume Chatelet 0d52a7d038 [libc][NFC] Simplify memcpy implementation
Summary: This is a NFC, it aims at simplifying both the code and build files.

Reviewers: abrachet, sivachandra

Subscribers: mgorny, tschuett, ecnelises, libc-commits, courbet

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D80291
2020-05-26 11:38:48 +00:00
Paula Toth 2a4c30985d [libc] Make clang-tidy use host compiler's resource dir.
Summary: When building llvm-libc with linting enabled, clang-tidy would use the resource dir of the monorepo rather then the host compiler's resource dir. This presented issues when including headers from the host compiler e.g. for sanitizers. Therefore this patch explicitly tells clang-tidy to use the host compiler's resource dir.

Reviewers: sivachandra

Reviewed By: sivachandra

Subscribers: mgorny, tschuett, ecnelises, libc-commits

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D80265
2020-05-21 18:40:59 -07:00
Paula Toth b2a485e37e [libc] Fix accidental inclusion of system libc headers.
Summary:
I found that because `--system-headers` flag was not included when running clang-tidy, errors produced from compiler provided headers were being suppressed. After passing this flag I realized that by including headers like stdint.h we were indirectly including headers from the system libc. To prevent this we pass `-ffreestanding`.
We don't want to pass `--system-headers` for all checks just the `llvmlibc-restrict-system-libc-headers` therefore we do a separate invocation of clang-tidy for this check.

Reviewers: abrachet, sivachandra

Reviewed By: sivachandra

Subscribers: mgorny, aheejin, tschuett, ecnelises, libc-commits

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D80178
2020-05-21 01:21:37 -07:00
Mehdi Amini c32d695b09 Fix typo in CMake error message "LLVM_LIBC_ENABLE_PROJECTS"->"LLVM_ENABLE_PROJECTS" (NFC) 2020-05-21 03:08:47 +00:00
Guillaume Chatelet 6ca54e0114 [libc] Add memset and bzero implementations
Summary: This patch adds general purpose `memset` and `bzero` implementations.

Reviewers: sivachandra, abrachet

Subscribers: mgorny, tschuett, ecnelises, libc-commits, courbet

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D80010
2020-05-20 06:35:13 +00:00
Siva Chandra Reddy 96d85726b0 [libc] Move implementations of expf and exp2f from the AOR to src/math.
Reviewers: phosek

Differential Revision: https://reviews.llvm.org/D79149
2020-05-15 12:43:03 -07:00
Siva Chandra Reddy 4a39a33d44 [libc] Add implementation of fabs and fabsf.
Reviewers: phosek

Differential Revision: https://reviews.llvm.org/D79725
2020-05-15 11:10:43 -07:00
Siva Chandra Reddy 32a22a423c [libc] Consolidate floating point utils into a single utils library.
A new utils library named 'fputil' is added. This library is used in
math tests and the MPFR wrapper. The math implementations will be
modified to use this library in a later round.

Reviewers: phosek

Differential Revision: https://reviews.llvm.org/D79724
2020-05-15 11:08:41 -07:00
Siva Chandra Reddy b7afa92e75 [libc] Call mtx_init in mtx_test.
A typo which was caught has also been fixed.

Reviewers: abrachet

Differential Revision: https://reviews.llvm.org/D79826
2020-05-13 09:48:31 -07:00
Siva Chandra Reddy e17a47b2d3 [libc][Obvious] Fix deps of few threads targets.
A missing dep has been added, and a few redundent deps have been
removed.
2020-05-12 16:14:12 -07:00
Paula Toth bf6f3894c4 [libc] Fix warnings on release build.
Summary:
These warnings were present when building llvm-libc in release mode.

```
workspace/llvm-project/libc/utils/benchmarks/LibcMemoryBenchmarkTest.cpp:50:34: warning: 'None' is deprecated: Use Align() or Align(1) instead [-Wdeprecated-declarations]
  Conf.AddressAlignment = Align::None();

workspace/llvm-project/libc/utils/testutils/FDReaderUnix.cpp:19:7: warning: unused variable 'err' [-Wunused-variable]
  int err = ::pipe(pipefd);
```

For test-utils it seems in general we should use `report_fatal_error` instead of asserts as these are turned off when building in release mode.
https://llvm.org/docs/CodingStandards.html#assert-liberally

Reviewers: abrachet, sivachandra

Reviewed By: abrachet, sivachandra

Subscribers: tschuett, libc-commits

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D79469
2020-05-07 11:56:11 -07:00
Eric Christopher 880115e65e [libc] Reorganize and clarify a few points around benchmarking
A few documentation clarifications and moving one part of the
docs around to be closer to the first mention of display so that
it's easier to spot based on some user feedback.

Differential Revision: https://reviews.llvm.org/D79443
2020-05-06 13:54:13 -07:00
Siva Chandra Reddy a7e1149699 [libc] Fix how math results are compared with MPFR results.
Summary:
Math results are compared with MPFR results by checking if they are
within a tolerance level of the MPFR result. The tolerance level is set
using additional bits of precision of the fractional part of a floating
point value. Hence, the actual value of the tolerance depends on not
only the additional bits, but also on the exponent part of the floating
point number.

Previously, the exponent part was not considered in evaluating the
tolerance value. While it was OK for small values less than 1 (hence
sinf, cosf, sincosf tests were OK), it breaks for large values which
functions like exp and friends produce. This change uses the exponent
value also to evaluate the tolerance value. LLVM libc produced results
can now be compared with MPFR produced results for large values also.

Reviewers: abrachet

Differential Revision: https://reviews.llvm.org/D79278
2020-05-06 10:47:23 -07:00
Paula Toth d80715d1d4 [libc] Change target name for testing benchmark utils infrastructure.
Reviewers: sivachandra

Reviewed By: sivachandra

Subscribers: gchatelet, mgorny, tschuett, libc-commits

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D79466
2020-05-06 01:22:15 -07:00
Siva Chandra Reddy fbaaa16802 [libc] Add no_sanitize("address") attribute to the getMPFRMatcher function.
This dramtically reduces the run time of tests. For example,
sincosf_test takes over 25 minutes without this attribute but only 8
seconds with this attribute.
2020-05-05 13:30:30 -07:00
Siva Chandra Reddy d69cbd826a [libc] Improve information printed on failure of a math test which uses MPFR.
A new test matcher class MPFRMatcher is added along with helper macros
EXPECT|ASSERT_MPFR_MATCH.

New type traits classes RemoveCV and IsFloatingPointType have been
added and used to implement the above class and its helpers.

Reviewers: abrachet, phosek

Differential Revision: https://reviews.llvm.org/D79256
2020-05-05 10:26:29 -07:00
Siva Chandra Reddy 9ae2564396 [libc] Include object files from alias entrypoints also in entrypoint libraries.
Reviewers: abrachet

Differential Revision: https://reviews.llvm.org/D79185
2020-05-04 11:39:37 -07:00
Siva Chandra Reddy 245cbd15a4 [libc] Add definitions of double_t and float_t to math.h.
This change does not handle any extensions. Only the C standard
variations are handled.

Reviewers: abrachet

Differential Revision: https://reviews.llvm.org/D79150
2020-04-30 11:59:11 -07:00
Siva Chandra Reddy 675eea46f0 [libc][NFC] Rename cpp::function to cpp::Function.
Summary: Just to be consistent with other names in cpp.

Reviewers: abrachet

Subscribers: tschuett, libc-commits

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D79189
2020-04-30 11:58:26 -07:00
Paula Toth 6b01964271 [libc] Add strlen to library entrypoints.
Reviewers: sivachandra, abrachet

Reviewed By: abrachet

Subscribers: mgorny, tschuett, libc-commits

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D79016
2020-04-28 16:14:54 -07:00
Siva Chandra Reddy 1852af16a1 [libc] Fix benchmarks build.
Reviewers: gchatelet, echristo

Subscribers: mgorny, tschuett, libc-commits

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D79040
2020-04-28 14:30:48 -07:00
Eric Christopher f1ecf560bf Add StringRef include to libc benchmark. 2020-04-28 13:12:26 -07:00
Paula Toth 29213878e7 [libc] Add spec for sigdelset and sigfillset.
Summary: Caught by libc-tidy from patch D77281.

Reviewers: abrachet, sivachandra

Reviewed By: abrachet

Subscribers: mgorny, tschuett, libc-commits

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D78703
2020-04-23 16:38:47 -07:00