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
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
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
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
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:
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
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
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
This reverts commit 352cba2441.
"add back math.h #include utils/FPUtil/ManipulationFunctions.h".
Using `<math.h>` correct so downstream setup should be fixed.
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.
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
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
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
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
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
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
Refactor src/math/hypotf.cpp and test/src/math/hypotf_test.cpp and reuse them for hypot and hypot_test
Differential Revision: https://reviews.llvm.org/D91831
These two cases are fixed:
1. If numerator is not zero and denominator is infinity, then the
numerator is returned as the remainder.
2. If numerator and denominator are equal in magnitude, then quotient
with the right sign is returned.
The differet tests of remquo, remquof and remquol have been unified
into a single file to avoid duplication.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D92353
This introduces mktime to LLVM libc, based on C99/C2X/Single Unix Spec.
Co-authored-by: Jeff Bailey <jeffbailey@google.com>
This change doesn't handle TIMEZONE, tm_isdst and leap seconds. It returns -1 for invalid dates. I have verified the return results for all the possible dates with glibc's mktime.
TODO:
+ Handle leap seconds.
+ Handle out of range time and date values that don't overflow or underflow.
+ Implement the following suggestion Siva - As we start accumulating the seconds, we should be able to check if the next amount of seconds to be added can lead to an overflow. If it does, return the overflow value. If not keep accumulating. The benefit is that, we don't have to validate every input, and also do not need the special cases for sizeof(time_t) == 4.
+ Handle timezone and update of tm_isdst
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D91551
This switches all of the files in src/string, src/math, and
test/src/math from using relative paths (e.g. `#include “include/string.h”`)
to global paths (e.g. `#include <string.h>`) to make bringing up those
functions on other platforms, such as fuchsia, easier.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D91394
Also added diffing of a few more math functions. Combining the diff check
for all of these functions helps us meet the OSS fuzz bar of a minimum of
100 program edges.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D91817