summaryrefslogtreecommitdiff
path: root/libc/test/src/__support/FPUtil/fpbits_test.cpp
AgeCommit message (Collapse)Author
2024-11-12[libc] Fix fpbits test running 80bit ld everywhere (#115937)Michael Jones
After #115084 the 80 bit long double tests error if sizeof(long double) isn't 96 or 128 bits. This caused failures in long double is double systems (since long double is 64 bits) so I've disabled the 80 bit long double tests on systems that don't use them.
2024-11-12[libc][i386] FPBit support for 96b long double (#115084)Nick Desaulniers
`long double` is haunted on most architectures, but it is especially so on i386-linux-gnu. While have 80b of significant data, on i386-linux-gnu this type has 96b of storage. Fixes for supporting printf family of conversions for `long double` on i386-linux-gnu. This allows the libc-stdlib-tests and libc_stdio_unittests ninja target tests to pass on i386-linux-gnu. Fixes: #110894 Link: #93709 Co-authored-by: Michael Jones <michaelrj@google.com>
2024-10-01[libc] Move struct Sign into LIBC_NAMESPACE (#110709)Michael Jones
The struct Sign should be in the correct namespace. Also update the various tests that use it.
2024-09-11[libc] Add osutils for Windows and make libc and its tests build on Windows ↵Sirui Mu
target (#104676) This PR first adds osutils for Windows, and changes some libc code to make libc and its tests build on the Windows target. It then temporarily disables some libc tests that are currently problematic on Windows. Specifically, the changes besides the addition of osutils include: - Macro `LIBC_TYPES_HAS_FLOAT16` is disabled on Windows. `clang-cl` generates calls to functions in `compiler-rt` to handle float16 arithmetic and these functions are currently not linked in on Windows. - Macro `LIBC_TYPES_HAS_INT128` is disabled on Windows. - The invocation to `::aligned_malloc` is changed to an invocation to `::_aligned_malloc`. - The following unit tests are temporarily disabled because they currently fail on Windows: - `test.src.__support.big_int_test` - `test.src.__support.arg_list_test` - `test.src.fenv.getenv_and_setenv_test` - Tests involving `__m128i`, `__m256i`, and `__m512i` in `test.src.string.memory_utils.op_tests.cpp` - `test_range_errors` in `libc/test/src/math/smoke/AddTest.h` and `libc/test/src/math/smoke/SubTest.h`
2024-07-15[libc] Fix warnings emitted by GCC (#98751)OverMighty
Fixes #98709.
2024-03-20[libc][NFC] Move `Sign` type to separate header (#85930)Guillaume Chatelet
2024-03-10[libc][NFC] Clean up stray ';' and default enum warningJoseph Huber
Summary: Cleans up two warnings I get locally while building.
2024-03-07[reland][libc] Remove UB specializations of type traits for `BigInt` (#84299)Guillaume Chatelet
Note: This is a reland of #84035. The standard specifies that it it UB to specialize the following traits: - `std::is_integral` - `std::is_unsigned` - `std::make_unsigned` - `std::make_signed` This patch: - Removes specializations for `BigInt` - Transforms SFINAE for `bit.h` functions from template parameter to return type (This makes specialization easier). - Adds `BigInt` specialization for `bit.h` functions. - Fixes code depending on previous specializations.
2024-03-04[libc][NFC] Rename `LIBC_LONG_DOUBLE_IS_` macros (#83399)Guillaume Chatelet
Umbrella bug #83182
2024-02-29[libc][NFC] Rename `LIBC_COMPILER_HAS_FLOAT128` to `LIBC_TYPES_HAS_FLOAT128` ↵Guillaume Chatelet
(#83395) Umbrella bug #83182
2024-02-22[libc] add FXBits class (#82065)Michael Jones
The FXBits class is what will be used to modify fixed point numbers on a bit level. This patch adds a basic implementation as well as basic tests.
2024-02-16[reland][libc][NFC] Use user defined literals to build 128 and 256 bit ↵Guillaume Chatelet
constants (#81998) - #81835 - Fix for platforms where uint64_t is not available
2024-02-15Revert "[reland][libc][NFC] Use user defined literals to build 128 and 256 ↵Guillaume Chatelet
bit constants" (#81882) Reverts llvm/llvm-project#81835 This is breaking arm32 which does not support 64 bit types.
2024-02-15[reland][libc][NFC] Use user defined literals to build 128 and 256 bit ↵Guillaume Chatelet
constants (#81835) This is a reland of #81746
2024-02-14Revert "[libc][NFC] Use user defined literals to build 128 and 256 bit ↵Guillaume Chatelet
constants." (#81771) Reverts llvm/llvm-project#81746
2024-02-14[libc][NFC] Use user defined literals to build 128 and 256 bit constants. ↵Guillaume Chatelet
(#81746)
2024-02-14[libc] Add user defined literals to initialize `BigInt` and `__uint128_t` ↵Guillaume Chatelet
constants (#81267) Adds user defined literal to construct unsigned integer constants. This is useful when constructing constants for non native C++ types like `__uint128_t` or our custom `BigInt` type.
2024-02-09[libc][NFC] Fix few warnings in tests. (#81262)lntue
``` /usr/local/google/home/lntue/experiment/llvm/llvm-project/libc/test/src/__support/FPUtil/fpbits_test.cpp:268:2: warning: extra ';' outside of a function is incompatible with C++98 [-Wc++98-compat-extra-semi] }; ^ 1 warning generated. ``` ``` In file included from /usr/local/google/home/lntue/experiment/llvm/llvm-project/libc/test/src/sys/socket/linux/bind_test.cpp:17: /usr/local/google/home/lntue/experiment/llvm/llvm-project/libc/test/UnitTest/Test.h:17:9: warning: 'libc_make_test_file_path' macro redefined [-Wmacro-redefined] #define libc_make_test_file_path(file_name) (file_name) ^ /usr/local/google/home/lntue/experiment/llvm/llvm-project/libc/test/UnitTest/LibcTest.h:20:9: note: previous definition is here #define libc_make_test_file_path(file_name) \ ^ 1 warning generated. ```
2024-02-05[libc] Add `next_toward_inf` fo `FPBits` (#80654)Guillaume Chatelet
It is needed to provide correct rounding when building FPRep from greater precision representations.
2024-02-05[libc][NFC] Make FPRep more testable (#80453)Guillaume Chatelet
2024-01-30[libc][NFC] Rename `FPBits` nan functions (#79998)Guillaume Chatelet
- [libc][NFC] Rename FPBits nan functions - rename build_signaling_nan in signaling_nan - rename build_quiet_nan to quiet_nan
2024-01-30[libc] Add test to check all properties for all FPBit types. (#79851)Guillaume Chatelet
This test is platform agnostic, it runs all tests on all architectures.
2024-01-29[libc] Remove specific nan payload in math functions (#79165)Guillaume Chatelet
2024-01-23[libc] Remove specific nan payload in math functions (#79133)Guillaume Chatelet
2024-01-23[reland][libc] Remove unnecessary `FPBits` functions and properties (#79128)Guillaume Chatelet
- reland #79113 - Fix aarch64 RISC-V build
2024-01-23Revert "[libc] Remove unnecessary `FPBits` functions and properties" (#79118)Guillaume Chatelet
Reverts llvm/llvm-project#79113 It broke aarch64 build bot machines.
2024-01-23[libc] Remove unnecessary `FPBits` functions and properties (#79113)Guillaume Chatelet
This patch reduces the surface of `FPBits`.
2024-01-22[reland][libc] `FPRep` builders return `FPRep` instead of raw `StorageType` ↵Guillaume Chatelet
(#78978) Reland #78588
2024-01-22Revert "[libc] `FPRep` builders return `FPRep` instead of raw `StorageType`" ↵Guillaume Chatelet
(#78974) Reverts llvm/llvm-project#78588
2024-01-22[libc] `FPRep` builders return `FPRep` instead of raw `StorageType` (#78588)Guillaume Chatelet
2024-01-18[libc][NFC] Introduce a Sign type for FPBits (#78500)Guillaume Chatelet
Another patch is needed to cover `DyadicFloat` and `NormalFloat` constructors.
2024-01-17[reland][libc][NFC] Refactor FPBits and remove LongDoubleBits specialization ↵Guillaume Chatelet
(#78465) - [reland] #78192 - [reland] #78447 - Turn `as` static function into a `to_storage_type` member function.
2024-01-17Revert "[reland][libc][NFC] Refactor FPBits and remove LongDoubleBits ↵Guillaume Chatelet
specialization" (#78457) Reverts llvm/llvm-project#78447 This broke the gcc buildbot.
2024-01-17[reland][libc][NFC] Refactor FPBits and remove LongDoubleBits specialization ↵Guillaume Chatelet
(#78447) - [reland] #78192 - Make the implementation work when `__uint128_t` is not available on the plaftorm.
2024-01-16Revert "[libc][NFC] Refactor FPBits and remove LongDoubleBits specialization ↵Nick Desaulniers
(#78192)" (#78329) This reverts commit fdbf255c96cb18bc1fb08fa7264446bcbbd5fbd0. Causes build breakage on 32b arm (see reports: https://github.com/llvm/llvm-project/pull/78192). These are reproducible for the 32b arm baremetal target on x86 hosts as well.
2024-01-16[libc][NFC] Refactor FPBits and remove LongDoubleBits specialization (#78192)Guillaume Chatelet
This patch removes the `FPBits` specialization for x86 Extended Precision by moving it up to `FPRep`. It also introduces enums (`Exponent`, `BiasedExponent` and `Significand`) to represent the exponent and significant parts of the floating point numbers. These enums are used to construct and observe floating point representations. Additionally, we remove `LongDoubleBits.h` that is now unnecessary.
2024-01-04[libc][math] Fix `is_quiet_nan` function in FPBits (#76931)Nishant Mittal
2023-12-11[libc][NFC] Fix mixed up biased/unbiased exponent (#75037)Guillaume Chatelet
According to [wikipedia](https://en.wikipedia.org/wiki/Exponent_bias) the "biased exponent" is the encoded form that is always positive whereas the unbiased form is the actual "real" exponent that can be positive or negative. `FPBits` seems to be using `unbiased_exponent` to describe the encoded form (unsigned). This patch simply use `biased` instead of `unbiased`.
2023-12-01[libc][NFC] rename LONG_DOUBLE_IS_DOUBLE into LIBC_LONG_DOUBLE_IS_FLOAT64 ↵Guillaume Chatelet
(#73948)
2023-11-10[libc][math] Add initial support for C23 float128 math functions, starting ↵lntue
with copysignf128. (#71731)
2023-11-06[libc][math] Add min/max/min_denorm/max_denorm constants to FPBits and clean ↵lntue
up its constants return types. (#71298)
2023-09-26[libc] Mass replace enclosing namespace (#67032)Guillaume Chatelet
This is step 4 of https://discourse.llvm.org/t/rfc-customizable-namespace-to-allow-testing-the-libc-when-the-system-libc-is-also-llvms-libc/73079
2023-06-10[libc][math] Move str method from FPBits class to testing utils.Tue Ly
str method of FPBits class is only used for pretty printing its objects in tests. It brings cpp::string dependency to FPBits class, which is not ideal for embedded use case. We move str method to a free function in test utils and remove this dependency of FPBits class. Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D152607
2023-05-19[libc] Fix test failing on the GPU due to undefined floating point typeJoseph Huber
We got build failures due to the handling here, explicitly set the type. Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D150983
2023-05-19[libc] Add a str() method to FPBits which returns a string representation.Siva Chandra Reddy
Unit tests for the str() method have also been added. Previously, a separate test only helper function was being used by the test matchers which has regressed over many cleanups. Moreover, being a test only utility, it was not tested separately (and hence the regression). Reviewed By: michaelrj Differential Revision: https://reviews.llvm.org/D150906