summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* [libc] Add the remaining long double flavors of nearest integer functions.Siva Chandra Reddy2020-06-251-38/+28
| | | | | | | | Specifically: ceill, floorl and roundl have been added. Reviewers: asteinhauser Differential Revision: https://reviews.llvm.org/D82591
* [libc] Add long double flavors of the floating point manipulation functions.Siva Chandra Reddy2020-06-231-42/+111
| | | | | | | | Specifically: copysignl, frexpl, logbl and modfl have been added. Reviewers: asteinhauser Differential Revision: https://reviews.llvm.org/D82357
* [libc] Match x86 long double NaN classification with that of the compiler.Siva Chandra Reddy2020-06-221-2/+11
| | | | | | Reviewers: asteinhauser Differential Revision: https://reviews.llvm.org/D82330
* [libc] Add implementations long double fabsl and truncl functions.Siva Chandra Reddy2020-06-187-24/+332
| | | | | | | | | | | | | | | | | | | | | 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
* [libc][benchmarks] Link the memory benchmark exes to functions from LLVM libc.Siva Chandra Reddy2020-06-1721-2628/+0
| | | | | | | | | | | | | | 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
* [lib][NFC] Split the floating point util functions into multiple files.Siva Chandra Reddy2020-06-155-217/+278
| | | | The grouping now reflects the grouping on cppreference.com.
* [libc] Add implementation of few floating point manipulation functions.Siva Chandra Reddy2020-06-114-10/+123
| | | | | | | | Implementations of copysign[f], frexp[f], logb[f], and modf[f] are added. Reviewers: asteinhauser Differential Revision: https://reviews.llvm.org/D81134
* [libc] Add implementations of round and roundf.Siva Chandra Reddy2020-06-091-0/+56
| | | | | | Reviewers: asteinhauser Differential Revision: https://reviews.llvm.org/D80779
* [libc] Add integration tests.Paula Toth2020-06-024-0/+81
| | | | | | | | | | | | | | | | | | | 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
* [libc] Expose APIGenerator.Paula Toth2020-06-012-185/+218
| | | | | | | | | | | | | | 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
* [libc] Add implementations of ceil[f], floor[f] and trunc[f] from math.h.Siva Chandra Reddy2020-06-014-8/+147
| | | | | | Reviewers: abrachet Differential Revision: https://reviews.llvm.org/D80612
* [libc] Fixing the build command for benchmarks.Anthony Steinhauser2020-05-281-1/+1
| | | | | | | | | | | | | | 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
* [libc][NFC][Obvious] Convert the MPFR operations enum to an enum class.Siva Chandra Reddy2020-05-262-8/+8
| | | | This was suggested in https://reviews.llvm.org/D79149.
* [libc] Move implementations of expf and exp2f from the AOR to src/math.Siva Chandra Reddy2020-05-152-5/+7
| | | | | | Reviewers: phosek Differential Revision: https://reviews.llvm.org/D79149
* [libc] Add implementation of fabs and fabsf.Siva Chandra Reddy2020-05-153-0/+11
| | | | | | Reviewers: phosek Differential Revision: https://reviews.llvm.org/D79725
* [libc] Consolidate floating point utils into a single utils library.Siva Chandra Reddy2020-05-157-42/+255
| | | | | | | | | | 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
* [libc] Fix warnings on release build.Paula Toth2020-05-072-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [libc] Reorganize and clarify a few points around benchmarkingEric Christopher2020-05-061-16/+21
| | | | | | | | 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
* [libc] Fix how math results are compared with MPFR results.Siva Chandra Reddy2020-05-061-18/+84
| | | | | | | | | | | | | | | | | | | | | 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
* [libc] Change target name for testing benchmark utils infrastructure.Paula Toth2020-05-061-2/+2
| | | | | | | | | | | | Reviewers: sivachandra Reviewed By: sivachandra Subscribers: gchatelet, mgorny, tschuett, libc-commits Tags: #libc-project Differential Revision: https://reviews.llvm.org/D79466
* [libc] Add no_sanitize("address") attribute to the getMPFRMatcher function.Siva Chandra Reddy2020-05-051-0/+1
| | | | | | 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.
* [libc] Improve information printed on failure of a math test which uses MPFR.Siva Chandra Reddy2020-05-055-32/+137
| | | | | | | | | | | | 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
* [libc][NFC] Rename cpp::function to cpp::Function.Siva Chandra Reddy2020-04-301-4/+4
| | | | | | | | | | | | 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
* [libc] Fix benchmarks build.Siva Chandra Reddy2020-04-283-2/+7
| | | | | | | | | | Reviewers: gchatelet, echristo Subscribers: mgorny, tschuett, libc-commits Tags: #libc-project Differential Revision: https://reviews.llvm.org/D79040
* Add StringRef include to libc benchmark.Eric Christopher2020-04-281-0/+1
|
* [libc] Link mpfr and gmp wrapper to the libcMPFRWrapper.Siva Chandra Reddy2020-04-231-0/+1
| | | | | | | | | This will fix building the wrapper shared library when BUILD_SHARED_LIBS is ON. Reviewers: PaulkaToast Differential Revision: https://reviews.llvm.org/D78737
* [libc] Add write(2) implementation for Linux and FDReader test utilityAlex Brachet2020-04-173-0/+73
| | | | | | | | | | | | Summary: Adds `write` for Linux and FDReader utility which should be useful for some stdio tests as well. Reviewers: sivachandra, PaulkaToast Reviewed By: sivachandra Subscribers: mgorny, tschuett, libc-commits Differential Revision: https://reviews.llvm.org/D78184
* [libc] Move implementations of cosf, sinf, sincosf to src/math directory.Siva Chandra Reddy2020-04-165-0/+174
| | | | | | | | | | | | | | NFC intended in the implementaton. Only mechanical changes to fit the LLVM libc implementation standard have been done. Math testing infrastructure has been added. This infrastructure compares the results produced by the libc with the high precision results from MPFR. Tests making use of this infrastructure have been added for cosf, sinf and sincosf. Reviewers: abrachet, phosek Differential Revision: https://reviews.llvm.org/D76825
* [libc] Remove <functional> dependency in syscall_test.cppAlex Brachet2020-04-142-0/+32
| | | | | | | | | | | | Summary: Create self contained functional header which has a type similar to `std::function` Reviewers: sivachandra, PaulkaToast Reviewed By: sivachandra Subscribers: mgorny, tschuett, libc-commits Differential Revision: https://reviews.llvm.org/D77948
* [libc] Add fully-qualified target names.Siva Chandra Reddy2020-04-101-1/+1
| | | | | | | | | | Only targets setup by the special LLVM libc rules now have fully qualified names. The naming style is similar to fully qualified names in Python. Reviewers: abrachet, PaulkaToast, phosek Differential Revision: https://reviews.llvm.org/D77340
* [libc][NFC] Make all top of file comments consistent.Paula Toth2020-04-0834-31/+80
| | | | | | | | | | | | | | | | Summary: Made all header files consistent based of this documentation: https://llvm.org/docs/CodingStandards.html#file-headers. And did the same for all source files top of file comments. Reviewers: sivachandra, abrachet Reviewed By: sivachandra, abrachet Subscribers: MaskRay, tschuett, libc-commits Tags: #libc-project Differential Revision: https://reviews.llvm.org/D77533
* [libc] NFC: Fix trivial typo in comments, documents, and messagesKazuaki Ishizaki2020-04-065-6/+6
| | | | Differential Revision: https://reviews.llvm.org/D77462
* [libc][NFC] Fix typo in millisecondsAlex Brachet2020-03-221-2/+2
|
* [libc] Add signalAlex Brachet2020-03-221-6/+13
| | | | | | | | | | | | | | Summary: This patch adds a Linux implementation for `signal` It also fixes `ASSERT|EXPECT_THAT` macros Reviewers: sivachandra, PaulkaToast, MaskRay Reviewed By: sivachandra Subscribers: mgorny, tschuett, libc-commits Differential Revision: https://reviews.llvm.org/D76536
* [libc] Add AOR testing dependencies for buildbot workers.Paula Toth2020-03-171-0/+3
| | | | | | | | | | | | | | Summary: These dependencies are needed for testing on the buildbots until we migrate AORs into libc. Reviewers: sivachandra Reviewed By: sivachandra Subscribers: MaskRay, tschuett, libc-commits Tags: #libc-project Differential Revision: https://reviews.llvm.org/D76330
* [libc] Resolve race condition in sub-process test runner.Paula Toth2020-03-171-2/+6
| | | | | | | | | | | | | | | | | Summary: There seems to be a race condition between the pipe closing and the child process death. Likely these two events are not atomic on some versions of linux. With the removal of `WNOHANG` we eliminate the race condition, however if the child closes the pipe intentionally then it could result in the test runner hanging. I find this situation less likely, where as I experience failures locally with this race condition rather consistently. Reviewers: sivachandra, abrachet Reviewed By: sivachandra, abrachet Subscribers: MaskRay, jfb, tschuett, libc-commits Tags: #libc-project Differential Revision: https://reviews.llvm.org/D76267
* [libc] [UnitTest] Add timeout to death testsAlex Brachet2020-03-113-14/+81
| | | | | | | | | | | | | | | | | Summary: This patch adds a timeout of 500ms to death tests. As we add multithreaded code and locks, deadlocks become more likely so timeout will be useful. Additionally: - Better error handling in `invokeSubprocess` - Makes `ProcessStatus`'s methods const Reviewers: sivachandra, MaskRay, gchatelet, PaulkaToast Reviewed By: sivachandra, PaulkaToast Subscribers: tschuett, libc-commits Differential Revision: https://reviews.llvm.org/D75651
* [libc] Add docker container for llvm-libc buildbot worker.Paula Toth2020-03-113-0/+60
| | | | | | | | | | | | | | Summary: Created a docker container to provide transparency and easy changes to the llvm-libc buildbot intfra. Reviewers: sivachandra Reviewed By: sivachandra Subscribers: MaskRay, tschuett, libc-commits Tags: #libc-project Differential Revision: https://reviews.llvm.org/D75596
* [libc] [NFC] Use matchers in testsAlex Brachet2020-03-071-0/+1
| | | | | | | | | | | | | | | Summary: Use `EXPECT_THAT` where possible in tests NFC intended. Added a `void *` template instantiation of `StreamWrapper::operator<<` Reviewers: sivachandra, PaulkaToast Reviewed By: sivachandra Subscribers: MaskRay, tschuett, libc-commits Differential Revision: https://reviews.llvm.org/D75717
* [libc] [UnitTest] Add MatchersAlex Brachet2020-03-057-1/+201
| | | | | | | | | | | | Summary: This patch adds gtest-like matchers and `EXPECT|ASSERT_THAT` macros. It also adds matchers `Succeeds` and `Fails` and has examples using these in test/src/signal/sigaddset_test.cpp. Reviewers: sivachandra, gchatelet, PaulkaToast Reviewed By: sivachandra, PaulkaToast Subscribers: mgorny, MaskRay, tschuett, libc-commits Differential Revision: https://reviews.llvm.org/D75487
* [libc] Add ability to generate enum types/values to HdrGen.Siva Chandra Reddy2020-02-281-0/+32
| | | | | | | | | A target to generate the std C threads.h file has been added. This utilizes the new feature added in this change. Reviewers: phosek Differential Revision: https://reviews.llvm.org/D75379
* [libc] Fix build when -DBUILD_SHARED_LIBS=OnAlex Brachet2020-02-262-5/+8
| | | | | | | | | | Reviewers: gchatelet, sivachandra Reviewed By: gchatelet, sivachandra Subscribers: libc-commits, mgorny, MaskRay, tschuett Differential Revision: https://reviews.llvm.org/D75136
* [libc] [UnitTest] Give UnitTest gtest like colorsAlex Brachet2020-02-251-3/+6
| | | | | | | | | | | | | | Summary: This is a quality of life change to make it a little nicer to look at, NFC. This patch makes the RUN and OK lines green and FAILED lines red to match gtest's output. Reviewers: sivachandra, gchatelet, PaulkaToast Reviewed By: gchatelet Subscribers: MaskRay, tschuett, libc-commits Differential Revision: https://reviews.llvm.org/D75103
* [libc] [UnitTest] Create death testsAlex Brachet2020-02-246-2/+202
| | | | | | | | | | | | Summary: This patch adds `EXPECT_EXITS` and `EXPECT_DEATH` macros for testing exit codes and deadly signals. They are less convoluted than their analogs in GTEST and don't have matchers but just take an int for either the exit code or the signal respectively. Nor do they have any regex match against the stdout/stderr of the child process. Reviewers: sivachandra, gchatelet Reviewed By: sivachandra Subscribers: mgorny, MaskRay, tschuett, libc-commits Differential Revision: https://reviews.llvm.org/D74665
* [libc] Add a README to the sub-directories under the utils directory.Siva Chandra Reddy2020-02-233-4/+34
| | | | | | | | | Also, the source layout document has been updated to reflect the current layout of the `utils` directory. Reviewers: PaulkaToast Differential Revision: https://reviews.llvm.org/D74502
* [libc] Add [EXPECT|ASSERT]_[TRUE|FALSE] unittest macros.Siva Chandra Reddy2020-01-303-6/+19
| | | | | | | | | | | | | Also, other EXPECT_* and ASSERT_* macros have been extended to accept bool values. Reviewers: abrachet, gchatelet Subscribers: MaskRay, tschuett, libc-commits Tags: #libc-project Differential Revision: https://reviews.llvm.org/D73668
* [libc] Add a missing `this->` in __llvm_libc::cpp:MutableArrayRef::end.Siva Chandra Reddy2020-01-301-1/+1
| | | | I had removed it to verify a review comment, but forgot to put it back.
* [libc] Add a library of standalone C++ utilities.Siva Chandra Reddy2020-01-2910-81/+270
| | | | | | | | | | | Some of the existing utils in utils/UnitTest/Test.h have been moved to this new library. Reviewers: abrachet, gchatelet Tags: #libc-project Differential Revision: https://reviews.llvm.org/D73530
* [libc] Fix build after 777180a32b61070a10dd330b4f038bf24e916af1.Siva Chandra Reddy2020-01-293-10/+12
| | | | | Implicit conversion from llvm::StringRef to std::string was made explicit in the above commit.
* [libc] Fix benchmarks CMakeLists.txtGuillaume Chatelet2020-01-291-3/+11
| | | | | | | | | | | | | | Summary: This is a follow up on https://reviews.llvm.org/rGaba80d0734d1#886881. `target_link_options` requires CMake>=3.13. Reviewers: abrachet Subscribers: mgorny, MaskRay, tschuett, libc-commits Tags: #libc-project Differential Revision: https://reviews.llvm.org/D73452