aboutsummaryrefslogtreecommitdiff
path: root/libc
AgeCommit message (Collapse)AuthorFilesLines
2021-01-21[libc] Distinguish compiler and run failuresPetr Hosek1-2/+4
This is useful for debugging issues, for example when cross-compiling. Differential Revision: https://reviews.llvm.org/D95118
2021-01-20[libc][NFC][obvious] fix the names of MPFR testsMichael Jones6-21/+30
I missed the MPFR tests in my previous commit. They have now been fixed to not fail the prefix check in the test macro.
2021-01-20[libc][NFC] add "LlvmLibc" as a prefix to all test namesMichael Jones121-443/+487
Summary: Having a consistent prefix makes selecting all of the llvm libc tests easier on any platform that is also using the gtest framework. This also modifies the TEST and TEST_F macros to enforce this change moving forward. Reviewers: sivachandra Subscribers:
2021-01-19[libc] Extend the current fenv functions to aarch64.Siva Chandra3-0/+213
This change does not try to move the common parts of x86 and aarch64 and build few abstractions over them. While this is possible, x86 story needs a bit of cleanup, especially around manipulation of the mxcsr register. Moreover, on x86 one can raise exceptions without performing exception raising operations. So, all of this can be done in follow up patches. Reviewed By: lntue Differential Revision: https://reviews.llvm.org/D94947
2021-01-19[libc][NFC] remove dependency on non standard ssize_tGuillaume Chatelet1-10/+14
`ssize_t` is from POSIX and is not standard unfortunately. Rewritting the code so it doesn't depend on it. Differential Revision: https://reviews.llvm.org/D94760
2021-01-19[libc][NFC] Remove dead codeGuillaume Chatelet2-7/+0
2021-01-18[libc][NFC][Obvious] Add a missing dep.Siva Chandra1-0/+1
2021-01-18[libc][NFC] Use ASSERT_EQ instead of EXPECT_EQ in fenv/exception_status_testSiva Chandra Reddy1-22/+22
2021-01-15[libc] CopyAlignedBlocks can now specify alignment on top of block sizeGuillaume Chatelet3-14/+62
This has been requested in D92236 Differential Revision: https://reviews.llvm.org/D94770
2021-01-15[libc] Allow customization of memcpy via flags.Guillaume Chatelet2-14/+48
- Adds LLVM_LIBC_IS_DEFINED macro to libc/src/__support/common.h - Adds a few knobs to memcpy to help with experimentations: - LLVM_LIBC_MEMCPY_X86_USE_ONLY_REPMOVSB replaces the implementation with a single call to rep;movsb - LLVM_LIBC_MEMCPY_X86_USE_REPMOVSB_FROM_SIZE customizes where the usage of rep;movsb Differential Revision: https://reviews.llvm.org/D94692
2021-01-15[libc] Add memmove implementation.Cheng Wang7-0/+176
Use `memcpy` rather than copying bytes one by one, for there might be large size structs to move. Reviewed By: gchatelet, sivachandra Differential Revision: https://reviews.llvm.org/D93195
2021-01-14[libc] Use #undef isascii in specific headerRoland McGrath3-8/+4
Standard C allows all standard headers to declare macros for all their functions. So after possibly including any standard header like <ctype.h>, it's perfectly normal for any and all of the functions it declares to be defined as macros. Standard C requires explicit `#undef` before using that identifier in a way that is not compatible with function-like macro definitions. The C standard's rules for this are extended to POSIX as well for the interfaces it defines, and it's the expected norm for nonstandard extensions declared by standard C library headers too. So far the only place this has come up for llvm-libc's code is with the isascii function in Fuchsia's libc. But other cases can arise for any standard (or common extension) function names that source code in llvm-libc is using in nonstandard ways, i.e. as C++ identifiers. The only correct and robust way to handle the possible inclusion of standard C library headers when building llvm-libc source code is to use `#undef` explicitly for each identifier before using it. The easy and obvious place to do that is in the per-function header. This requires that all code, such as test code, that might include any standard C library headers, e.g. via utils/UnitTest/Test.h, make sure to include those *first* before the per-function header. This change does that for isascii and its test. But it should be done uniformly for all the code and documented as a consistent convention so new implementation files are sure to get this right. Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D94642
2021-01-13[libc][NFC] change isblank and iscntrl from implicit castingMichael Jones2-2/+2
isblank and iscntrl were casting an int to a char implicitly and this was throwing errors under Fuchsia. I've added a static cast to resolve this issue. Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D94634
2021-01-13[libc][NFC] add macro for fuchsia to switch test backend to zxtestMichael Jones5-253/+292
This moves utils/UnitTest/Test.[h/cpp] to LibcTest.[h/cpp] and adds a new Test.h that acts as a switcher so that Fuchsia can use the zxtest backend for running our tests as part of their build. FuchsiaTest.h is for including fuchsia's zxtest library and anything else needed to make the tests work under fuchsia (currently just undefining the isascii macro for the test). Downstream users, please fix your build instead of reverting. Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D94625
2021-01-13[libc] Refresh benchmark progress bar when needed.Guillaume Chatelet1-3/+8
2021-01-12[libc][NFC] Use more specific comparison macros in LdExpTest.h.Siva Chandra Reddy1-2/+2
2021-01-12[libc] add isascii and toascii implementationsMichael Jones12-1/+190
adding both at once since these are trivial functions. Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D94558
2021-01-11[libc][NFC] Make __support/common.h an in tree header.Siva Chandra Reddy2-16/+12
It was previously a generated header. It can easily converted to a generated header if required in future. Reviewed By: michaelrj Differential Revision: https://reviews.llvm.org/D94445
2021-01-09[libc][NFC] add includes for internal headers to all libc functionsMichael Jones94-3/+95
this will make sure that all of the functions are using the correct prototypes. Explained much better in the comments of this diff: https://reviews.llvm.org/D94195
2021-01-08[libc] Switch to use a macro which does not insert a section for every libc ↵Michael Jones147-222/+210
function. Summary: The new macro also inserts the C alias for the C++ implementations without needing an objcopy based post processing step. The CMake rules have been updated to reflect this. More CMake cleanup can be taken up in future rounds and appropriate TODOs have been added for them. Reviewers: mcgrathr, sivachandra Subscribers:
2021-01-06[libc] Use a wrapper for rand instead of calling std::rand in fma tests.Siva Chandra Reddy4-4/+41
Reviewed By: lntue Differential Revision: https://reviews.llvm.org/D94198
2021-01-06[libc] Add implementation of fmaf.Tue Ly12-17/+363
Differential Revision: https://reviews.llvm.org/D94018
2021-01-06[libc] Align src buffer instead of dst bufferGuillaume Chatelet2-12/+12
We used to align destination buffer instead of source buffer for the loop of block copy. This is a mistake. Differential Revision: https://reviews.llvm.org/D93457
2021-01-06[libc] remove modulo from CircularArrayRef iteratorGuillaume Chatelet1-2/+6
2021-01-05[libc] Add implementations of nextafter[f|l] functions.Siva Chandra Reddy21-1/+618
A differential fuzzer for these functions has also been added. Along the way, a small correction has been done to the normal/subnormal limits of x86 long double values. Reviewed By: lntue Differential Revision: https://reviews.llvm.org/D94109
2021-01-05[libc] Add implementations of nearbyint[f|l].Siva Chandra Reddy9-0/+151
The implementation is exactly the same as rint* as even rint does not raise any floating point exceptions currently. [Note that the standards do not specify that floating point exceptions must be raised - they leave it up to the implementation to choose to raise FE_INEXACT when rounding non-integral values.] Reviewed By: lntue Differential Revision: https://reviews.llvm.org/D94112
2020-12-30[libc][NFC] Use ASSERT_FP_EQ to compare nan values in tests.Siva Chandra Reddy1-1/+1
This change "fixes" one of the uses that was missed in 0524da67b448dcce6569fae0f54c10f208c2dc56.
2020-12-29[libc] Add implementations of rounding functions which depend rounding mode.Siva Chandra Reddy36-49/+1147
Namely, implementations for rint, rintf, rintl, lrint, lrintf, lrintl, llrint, llrintf and llrintl have been added. Reviewed By: lntue Differential Revision: https://reviews.llvm.org/D93889
2020-12-18[libc][NFC] Use `#include <math.h>` in utils/FPUtil/ManipulationFunctions.h.Siva Chandra Reddy1-1/+1
This reverts commit 352cba2441c6c4e00f067c9c68358cc0a6a5fffb. "add back math.h #include utils/FPUtil/ManipulationFunctions.h". Using `<math.h>` correct so downstream setup should be fixed.
2020-12-17[libc][NFC] Use ASSERT_FP_EQ to comapre NaN values in tests.Siva Chandra Reddy8-14/+14
This is a continuation of the previous CL which did a similar change in other tests. To elaborate a little about why we need this - under C++ compilation with headers not from LLVM libc, libraries like libc++ and libstdc++ provide their own math.h which undefine macros like `isnan` and provide the overloaded C++ isnan functions which return a boolean value instead of an integer value returned by the isnan macro.
2020-12-17[libc][Obvious] Fix typo is wrappergen unittest.Siva Chandra Reddy1-1/+1
2020-12-17[libc] Add python3 to libc buildbot depedencies.Paula Toth1-4/+3
Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D93463
2020-12-17[libc] Refactor WrapperGen to make the flow cleaner.Siva Chandra Reddy2-104/+172
Reviewed By: michaelrj Differential Revision: https://reviews.llvm.org/D93417
2020-12-17Fix dead linkGuillaume Chatelet1-1/+1
2020-12-17[libc] revamp memory function benchmarkGuillaume Chatelet20-995/+769
The benchmarking infrastructure can now run in two modes: - Sweep Mode: which generates a ramp of size values (same as before), - Distribution Mode: allows the user to select a distribution for the size paramater that is representative from production. The analysis tool has also been updated to handle both modes. Differential Revision: https://reviews.llvm.org/D93210
2020-12-17[libc] add back math.h #include utils/FPUtil/ManipulationFunctions.hKrasimir Georgiev1-1/+1
This partially reverts cee1e7d14f4628d6174b33640d502bff3b54ae45: [libc][NFC][Obvious] Remove few unnecessary #include directives in tests. That commit causes a test failure in our configuration: [ RUN ] ILogbTest.SpecialNumbers_ilogb third_party/llvm/llvm-project/libc/test/src/math/ILogbTest.h:28: FAILURE Expected: FP_ILOGBNAN Which is: 2147483647 To be equal to: func(__llvm_libc::fputil::FPBits<T>::buildNaN(1)) Which is: -2147483648
2020-12-15[libc][NFC] Use ASSERT_FP_EQ to comapre NaN values in tests.Siva Chandra Reddy13-25/+13
2020-12-15[libc][NFC] Rename global `nan` in tests to `aNaN`.Siva Chandra Reddy28-85/+85
The name `nan` conflicts with the function `nan` defined declared in math.h.
2020-12-15[libc][NFC][Obvious] Remove few unnecessary #include directives in tests.Siva Chandra Reddy15-36/+5
2020-12-14[libc] Add remainder[f|l] and remquo[f|l] to the list of aarch64 entrypoints.Siva Chandra1-0/+6
2020-12-14[libc][NFC] Skip adding dummy targets for skipped unit tests.Siva Chandra2-8/+3
2020-12-15[libc] Add memcmp implementation.Cheng Wang7-0/+101
Reviewed By: gchatelet Differential Revision: https://reviews.llvm.org/D93009
2020-12-14[libc][Obvious] Mark functions in DummyFEnv.h as static inline.Siva Chandra Reddy1-5/+5
2020-12-14[libc][Obvious] Include <fenv.h> from DummyFenv.h.Siva Chandra Reddy1-0/+1
2020-12-11[libc] Let wrappergen pick LLVM libc mangled name from aliasee file.Siva Chandra Reddy4-4/+89
Along the way, made a change to run tool unittests when the target "check-libc" is run by introducing a libc testsuite for tool unittests. Reviewed By: michaelrj Differential Revision: https://reviews.llvm.org/D93142
2020-12-11[libc] Add implementations of lround[f|l] and llround[f|l].Siva Chandra Reddy28-2/+805
A new function to MPFRWrapper has been added, which is used to set up the unit tests. Reviewed By: lntue Differential Revision: https://reviews.llvm.org/D93007
2020-12-11[libc] Add [l|ll]abs implementation.Cheng Wang16-0/+263
Implement abs, labs and llabs with template. Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D92626
2020-12-08[libc] Raise x87 exceptions by synchronizing with "fwait".Siva Chandra Reddy5-8/+204
Couple of helper functions enableExcept and disableExcept have been added. In a later round, they will be used to implemented the GNU extension functions feenableexcept and fedisableexcept. Differential Revision: https://reviews.llvm.org/D92821
2020-12-04[libc] add tests to WrapperGenMichael Jones5-0/+296
This adds an initial test that can serve as a basis for other tests on wrappergen. Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D92137
2020-12-03[libc][NFC] Remove dependence on xmmintrin.h to read/write MXCSR.Siva Chandra Reddy1-10/+19
The version of clang on the bots is unhappy with using xmmintrin.h. So, this change removes dependence on xmmintrin by using inline assembly.