#include "src/__support/macros/config.h"
#include "str_to_fp_test.h"
#include "src/__support/integer_literals.h"
namespace LIBC_NAMESPACE_DECL {
LlvmLibcStrToLongDblTest;
operator""_u128;
#if defined(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT64)
TEST_F(LlvmLibcStrToLongDblTest, EiselLemireFloat64AsLongDouble) {
eisel_lemire_test(123, 0, 0x1EC00000000000, 1029);
}
#elif defined(LIBC_TYPES_LONG_DOUBLE_IS_X86_FLOAT80)
TEST_F(LlvmLibcStrToLongDblTest, EiselLemireFloat80Simple) { … }
TEST_F(LlvmLibcStrToLongDblTest, EiselLemireFloat80LongerMantissa) { … }
TEST_F(LlvmLibcStrToLongDblTest, EiselLemireFloat80TableLimits) { … }
TEST_F(LlvmLibcStrToLongDblTest, EiselLemireFloat80Fallback) { … }
TEST_F(LlvmLibcStrToLongDblTest, ClingerFastPathFloat80Simple) { … }
#elif defined(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT128)
TEST_F(LlvmLibcStrToLongDblTest, EiselLemireFloat128Simple) {
eisel_lemire_test(123, 0, 0x1ec00'00000000'00000000'00000000_u128, 16389);
eisel_lemire_test(12345678901234568192u, 0,
0x156a9'5319d63e'18000000'00000000_u128, 16446);
}
TEST_F(LlvmLibcStrToLongDblTest, EiselLemireFloat128LongerMantissa) {
eisel_lemire_test(0x12345678'12345678'12345678'12345678_u128, 0,
0x12345'67812345'67812345'67812345_u128, 16507);
eisel_lemire_test(0x12345678'12345678'12345678'12345678_u128, 300,
0x1b2ee'afbcad5b'6cb8b445'1dfcde19_u128, 17503);
eisel_lemire_test(0x12345678'12345678'12345678'12345678_u128, -300,
0x1861f'd734ec30'8afa7189'f0f7595f_u128, 15510);
}
TEST_F(LlvmLibcStrToLongDblTest, EiselLemireFloat128Fallback) {
ASSERT_FALSE(internal::eisel_lemire<long double>(
{0x5ce0e9a5'6015fec5'aadfa328'ae39b333_u128, 1})
.has_value());
}
TEST_F(LlvmLibcStrToLongDblTest, ClingerFastPathFloat128Simple) {
clinger_fast_path_test(123, 0, 0x1ec00'00000000'00000000'00000000_u128,
16389);
clinger_fast_path_test(1234567, 1, 0x178c2'8c000000'00000000'00000000_u128,
16406);
clinger_fast_path_test(12345, -5, 0x1f9a6'b50b0f27'bb2fec56'd5cfaace_u128,
16379);
}
#else
#error "Unknown long double type"
#endif
}