Commit Graph

239 Commits

Author SHA1 Message Date
Anthony Steinhauser ef36e8380a [libc] Using llvm_libc memcpy in mem* benchmarks.
Currently the mem* benchmarks use memcpy from Glibc and memset from LLVM libc.
That's misleading and produces inconsistent results and behaviors.

This change makes Memcpy.cpp consistent with Memset.cpp:
https://github.com/llvm/llvm-project/blob/master/libc/benchmarks/Memset.cpp#L49

Reviewers: sivachandra

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D88271
2020-09-24 22:03:52 -07:00
Tue Ly f55963d501 [libc] Add implementation for hypotf
Truncating the sum of squares, and then use shift-and-add algorithm to compute its square root.
Required MPFR testing infra is updated in https://reviews.llvm.org/D87514

Differential Revision: https://reviews.llvm.org/D87516
2020-09-17 23:28:36 -04:00
Guillaume Chatelet c3fd2a50ba [libc] Remove special case for 8 and 16 bytes
They don't seem to gain much in real apps and its better to favor less branches and smaller code.
2020-09-15 20:48:27 +00:00
Guillaume Chatelet c19fda9aa0 [libc] use stddef instead of string header 2020-09-15 20:12:55 +00:00
Guillaume Chatelet 00ba1a3de7 [libc] remove useless headers 2020-09-15 20:04:12 +00:00
Guillaume Chatelet e328456a9e [libc] Add missing TableGen dependency
Differential Revision: https://reviews.llvm.org/D87689
2020-09-15 14:26:04 +00:00
Guillaume Chatelet 00d6e7116c [libc] Add missing LibcFPTestHelpers library
Differential Revision: https://reviews.llvm.org/D87690
2020-09-15 14:25:34 +00:00
Guillaume Chatelet 85763e0758 [libc] Fix typo in platform_defs.h.inc
Differential Revision: https://reviews.llvm.org/D87687
2020-09-15 14:25:01 +00:00
Tue Ly abf1c82dcc [libc] Extend MPFRMatcher to handle 2-input-1-output and support hypot function.
Differential Revision: https://reviews.llvm.org/D87514
2020-09-14 14:53:46 -04:00
cgyurgyik c92d1aa44b [libc] Decouple string functions.
This revision removes dependencies that exist between different string functions. This allows for the libc user to use a specific function X of this library without also depending on Y and Z.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D87421
2020-09-14 12:22:05 -04:00
Siva Chandra Reddy cb19e8c6d1 [libc][obvious] Include Sqrt.h in SqrtLongDoubleX86.h.
This makes SqrtLongDoubleX86.h includable by itself.
2020-09-10 13:25:54 -07:00
Siva Chandra Reddy 878cb5170d [libc][NFC][obvious] Remove a redudant dep of strcmp implementation. 2020-09-10 12:34:32 -07:00
Siva Chandra Reddy fb542b0b8c [libc][MPFRWrapper] Provide a way to include MPFR header in downstream repos.
Reviewed By: asteinhauser

Differential Revision: https://reviews.llvm.org/D87412
2020-09-09 12:58:58 -07:00
Siva Chandra Reddy ba5b1371ec [libc][NFC] Add spec files as dependencies of integration test. 2020-09-09 10:22:27 -07:00
Siva Chandra Reddy e59d829971 [libc][obvious] Fix strtok_r signature in the spec. 2020-09-09 09:50:17 -07:00
Siva Chandra Reddy 17ac4543d4 [libc][obvious] Use constants of type double in remquo_test. 2020-09-03 22:26:25 -07:00
Siva Chandra Reddy 8514ecb02d [libc] Add implementations of remquo[f|l] and remainder[f|l].
The implementation is not fully standards compliant in the sense that
errno is not set on error, and floating point exceptions are not raised.

Subnormal range and normal range are tested separately in the tests.

Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D86666
2020-09-03 22:00:17 -07:00
Pavel Labath 9cb222e749 [cmake] Make gtest include directories a part of the library interface
This applies the same fix that D84748 did for macro definitions.
Appropriate include path is now automatically set for all libraries
which link against gtest targets, which avoids the need to set
include_directories in various parts of the project.

Differential Revision: https://reviews.llvm.org/D86616
2020-08-27 15:35:57 +02:00
Tue Ly 5078825aa9 [libc] Add implementations for sqrt, sqrtf, and sqrtl.
Differential Revision: https://reviews.llvm.org/D84726
2020-08-26 09:46:18 -04:00
Siva Chandra Reddy fe44992b79 [libc][NFC] For remquo quotient, compare only 3 bits of MPFR and libc results. 2020-08-25 23:42:06 -07:00
Siva Chandra Reddy 1948acb61b [libc][obvious] Add back the accidentally removed MPFRNumber destructor. 2020-08-25 21:57:46 -07:00
Siva Chandra Reddy 3f4674a557 [libc] Extend MPFRMatcher to handle multiple-input-multiple-output functions.
Tests for frexp[f|l] now use the new capability. Not all input-output
combinations have been addressed by this change. Support for newer combinations
can be added in future as needed.

Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D86506
2020-08-25 21:42:49 -07:00
Siva Chandra Reddy 87bf0b0ee9 [libc] Add a class called NormalFloat which represents normalized floats.
This class helps in dealing with normal and subnormal numbers uniformly.
Moreover, since this class has been designed to handle all floating
formats across platforms, it helps implement floating point functions in
a uniform manner.

The implementations of frexp and logb have been switched to use this new
class as it allows us to use just one implementation across all
different floating point formats.

Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D86241
2020-08-20 09:00:35 -07:00
Siva Chandra Reddy ed8982da3e [libc][NFC] Switch math tests to the new ULP based tolerance.
Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D86267
2020-08-20 08:31:31 -07:00
Siva Chandra Reddy e2645488ca [libc][obvious] Fix x86 long double conversion to integer.
Fixes incorrectly constructed ceill tests.
2020-08-19 14:48:55 -07:00
Siva Chandra Reddy f768eb216f [libc][obvious] Fix link order of math tests. 2020-08-18 11:04:58 -07:00
Tue Ly 9887a70e7a [libc] Add ULP function to MPFRNumber class to test correctly rounded functions such as SQRT, FMA.
Add ULP function to MPFRNumber class to test correctly rounded functions.

Differential Revision: https://reviews.llvm.org/D84725
2020-08-18 13:51:58 -04:00
Anthony Steinhauser 25d759c143 [libc] Make benchmark boxplots transparent.
So that the configuration box does not make a part of the plot invisible.

Reviewers: sivachandra

Differential Revision: https://reviews.llvm.org/D85953
2020-08-17 07:34:26 -07:00
cgyurgyik 79ce64ea08 [libc] Add restrict qualifiers to string library; give consistent naming scheme to TableGen files.
Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D85945
2020-08-14 15:41:02 -04:00
Chris Gyurgyik d28f67292e
[libc] [obvious] Fix typographical error. 2020-08-14 08:34:42 -04:00
parallels bc45bab7eb [libc] Add strtok_r implementation.
Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D85779
2020-08-13 15:51:38 -04:00
Siva Chandra 578ac8bfa5 [libc][obvious] Remove the unused file utils/CPP/StringRef.h. 2020-08-12 12:19:11 -07:00
Siva Chandra a87576592c [libc][obvious] Switch copysign[f|l] and fabs[f|l] to the new test matchers. 2020-08-12 00:20:58 -07:00
Siva Chandra 01b99c6e1d [libc][obvious] Switch nearest integer function tests to the new matchers. 2020-08-11 23:33:15 -07:00
Siva Chandra df79e18796 [libc][obvious] Remove a commented out block. 2020-08-11 13:31:17 -07:00
cgyurgyik 667843cc07 [libc] Add strtok implementation.
Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D85615
2020-08-11 13:44:53 -04:00
Siva Chandra Reddy f6d74b29d6 [libc][NFC] Disable a loader test as ld.gold fails to link.
Will be reenabled after investigating and fixing the problem.
2020-08-07 23:45:18 -07:00
Siva Chandra Reddy db936e0e91 [libc][NFC] Add library of floating point test matchers.
This eliminates UnitTest's dependency on FPUtil and hence prevents
non-math tests from depending indirectly on FPUtil. The patch
essentially moves some of the existing pieces into a library of its own.

Along the way, renamed add_math_unittest to add_fp_unittest.

Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D85486
2020-08-07 23:34:15 -07:00
Siva Chandra Reddy 5d59385ba6 [libc] Setup TLS in x86_64 loader.
The new code added is still very x86_64 specific. AArch64 support will
be added very soon and refactoring of the loader code will be done as
part of the patches adding it.

Reviewed By: asteinhauser

Differential Revision: https://reviews.llvm.org/D82700
2020-08-07 23:19:03 -07:00
cgyurgyik dc13a9a781 [libc] Add strcpsn and strpbrk implementation.
Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D85386
2020-08-07 16:14:32 -04:00
cgyurgyik 128bf458ab [libc] Add tolower, toupper implementation.
Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D85326
2020-08-06 15:21:38 -04:00
cgyurgyik f3b4150255 [libc] Add strspn implementation and std::bitset
Reviewed By: sivachandra, abrachet

Differential Revision: https://reviews.llvm.org/D85103
2020-08-05 16:48:38 -04:00
Chris Gyurgyik 049f6ad4f6
[libc] [obvious] Add ctype functions to linux api.
Adds isspace, isprint, and isxdigit to Linux API to fix failed integration test.
2020-08-05 11:05:50 -04:00
cgyurgyik 1fdab96130 [libc] Add isspace, isprint, isxdigit implementations.
Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D85270
2020-08-05 10:51:43 -04:00
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