aboutsummaryrefslogtreecommitdiff
path: root/libc/utils
AgeCommit message (Collapse)AuthorFilesLines
2020-09-15[libc] Add missing TableGen dependencyGuillaume Chatelet1-1/+1
Differential Revision: https://reviews.llvm.org/D87689
2020-09-15[libc] Add missing LibcFPTestHelpers libraryGuillaume Chatelet1-1/+1
Differential Revision: https://reviews.llvm.org/D87690
2020-09-14[libc] Extend MPFRMatcher to handle 2-input-1-output and support hypot function.Tue Ly2-2/+91
Differential Revision: https://reviews.llvm.org/D87514
2020-09-10[libc][obvious] Include Sqrt.h in SqrtLongDoubleX86.h.Siva Chandra Reddy1-0/+2
This makes SqrtLongDoubleX86.h includable by itself.
2020-09-09[libc][MPFRWrapper] Provide a way to include MPFR header in downstream repos.Siva Chandra Reddy1-1/+11
Reviewed By: asteinhauser Differential Revision: https://reviews.llvm.org/D87412
2020-09-03[libc] Add implementations of remquo[f|l] and remainder[f|l].Siva Chandra Reddy4-0/+129
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-08-26[libc] Add implementations for sqrt, sqrtf, and sqrtl.Tue Ly2-0/+328
Differential Revision: https://reviews.llvm.org/D84726
2020-08-25[libc][NFC] For remquo quotient, compare only 3 bits of MPFR and libc results.Siva Chandra Reddy1-1/+1
2020-08-25[libc][obvious] Add back the accidentally removed MPFRNumber destructor.Siva Chandra Reddy1-0/+4
2020-08-25[libc] Extend MPFRMatcher to handle multiple-input-multiple-output functions.Siva Chandra Reddy2-74/+471
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-20[libc] Add a class called NormalFloat which represents normalized floats.Siva Chandra Reddy3-97/+243
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[libc][NFC] Switch math tests to the new ULP based tolerance.Siva Chandra Reddy2-94/+5
Reviewed By: lntue Differential Revision: https://reviews.llvm.org/D86267
2020-08-19[libc][obvious] Fix x86 long double conversion to integer.Siva Chandra Reddy1-2/+2
Fixes incorrectly constructed ceill tests.
2020-08-18[libc] Add ULP function to MPFRNumber class to test correctly rounded ↵Tue Ly2-16/+106
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-12[libc][obvious] Remove the unused file utils/CPP/StringRef.h.Siva Chandra2-25/+0
2020-08-11[libc][obvious] Remove a commented out block.Siva Chandra1-15/+0
2020-08-07[libc][NFC] Add library of floating point test matchers.Siva Chandra Reddy5-66/+195
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-05[libc] Add strspn implementation and std::bitsetcgyurgyik2-0/+40
Reviewed By: sivachandra, abrachet Differential Revision: https://reviews.llvm.org/D85103
2020-07-30[libc] Add a tool called WrapperGen.Siva Chandra Reddy6-2/+87
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-29[libc] [obvious] Fix typo in binary header.Chris Gyurgyik1-1/+1
2020-07-28[libc][obvious] Add license headers to APIIndexer.[cpp|h].Siva Chandra Reddy2-0/+19
2020-07-28[libc][NFC] Move tablegen indexer class into a util library of its own.Siva Chandra Reddy9-206/+238
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[libc][NFC] Zero out padding bits in the uint form of x86 FPBits<long double>.Siva Chandra Reddy1-4/+12
2020-07-28[libc][obvious] Move ErrnoSetterMatcher to test/ErrnoSetterMetcher.h.Siva Chandra Reddy2-77/+0
2020-07-23[libc] Add implementations of fmax, fmaxf, and fmaxl.Tue Ly1-0/+19
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-21Add implementations for fmin, fminf, and fminl. Testing infrastructure ↵Tue Ly2-0/+20
update is splitted to https://reviews.llvm.org/D83931.
2020-07-21Update Test (EXPECT_EQ and friends) to accept __uint128_t and floating point ↵Tue Ly3-35/+129
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-17[libc][NFC] Use RemoveCVType to implement IsIntegral and IsPointerType.Siva Chandra Reddy1-21/+24
Added IsSameV as a convenience variable and used it where convenient. Reviewers: abrachet, lntue Differential Revision: https://reviews.llvm.org/D83980
2020-07-17[libc][Obvious] Cleanup of include lines and target listings in FPUtil.Siva Chandra Reddy2-1/+4
2020-06-25[libc] Add the remaining long double flavors of nearest integer functions.Siva Chandra Reddy1-38/+28
Specifically: ceill, floorl and roundl have been added. Reviewers: asteinhauser Differential Revision: https://reviews.llvm.org/D82591
2020-06-23[libc] Add long double flavors of the floating point manipulation functions.Siva Chandra Reddy1-42/+111
Specifically: copysignl, frexpl, logbl and modfl have been added. Reviewers: asteinhauser Differential Revision: https://reviews.llvm.org/D82357
2020-06-22[libc] Match x86 long double NaN classification with that of the compiler.Siva Chandra Reddy1-2/+11
Reviewers: asteinhauser Differential Revision: https://reviews.llvm.org/D82330
2020-06-18[libc] Add implementations long double fabsl and truncl functions.Siva Chandra Reddy7-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
2020-06-17[libc][benchmarks] Link the memory benchmark exes to functions from LLVM libc.Siva Chandra Reddy21-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
2020-06-15[lib][NFC] Split the floating point util functions into multiple files.Siva Chandra Reddy5-217/+278
The grouping now reflects the grouping on cppreference.com.
2020-06-11[libc] Add implementation of few floating point manipulation functions.Siva Chandra Reddy4-10/+123
Implementations of copysign[f], frexp[f], logb[f], and modf[f] are added. Reviewers: asteinhauser Differential Revision: https://reviews.llvm.org/D81134
2020-06-09[libc] Add implementations of round and roundf.Siva Chandra Reddy1-0/+56
Reviewers: asteinhauser Differential Revision: https://reviews.llvm.org/D80779
2020-06-02[libc] Add integration tests.Paula Toth4-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
2020-06-01[libc] Expose APIGenerator.Paula Toth2-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
2020-06-01[libc] Add implementations of ceil[f], floor[f] and trunc[f] from math.h.Siva Chandra Reddy4-8/+147
Reviewers: abrachet Differential Revision: https://reviews.llvm.org/D80612
2020-05-28[libc] Fixing the build command for benchmarks.Anthony Steinhauser1-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
2020-05-26[libc][NFC][Obvious] Convert the MPFR operations enum to an enum class.Siva Chandra Reddy2-8/+8
This was suggested in https://reviews.llvm.org/D79149.
2020-05-15[libc] Move implementations of expf and exp2f from the AOR to src/math.Siva Chandra Reddy2-5/+7
Reviewers: phosek Differential Revision: https://reviews.llvm.org/D79149
2020-05-15[libc] Add implementation of fabs and fabsf.Siva Chandra Reddy3-0/+11
Reviewers: phosek Differential Revision: https://reviews.llvm.org/D79725
2020-05-15[libc] Consolidate floating point utils into a single utils library.Siva Chandra Reddy7-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
2020-05-07[libc] Fix warnings on release build.Paula Toth2-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
2020-05-06[libc] Reorganize and clarify a few points around benchmarkingEric Christopher1-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
2020-05-06[libc] Fix how math results are compared with MPFR results.Siva Chandra Reddy1-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
2020-05-06[libc] Change target name for testing benchmark utils infrastructure.Paula Toth1-2/+2
Reviewers: sivachandra Reviewed By: sivachandra Subscribers: gchatelet, mgorny, tschuett, libc-commits Tags: #libc-project Differential Revision: https://reviews.llvm.org/D79466
2020-05-05[libc] Add no_sanitize("address") attribute to the getMPFRMatcher function.Siva Chandra Reddy1-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.