aboutsummaryrefslogtreecommitdiff
path: root/gcc/value-range.cc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2022-11-01 13:41:57 +0100
committerJakub Jelinek <jakub@redhat.com>2022-11-01 13:41:57 +0100
commit81f98afa22815e7397714caf6fa0fc815803ebaa (patch)
tree582a423d7f04db8e004af5371a0026d8c2bc33e1 /gcc/value-range.cc
parent0ae26533b3e26866f4130d40ec0659c273552643 (diff)
downloadgcc-81f98afa22815e7397714caf6fa0fc815803ebaa.zip
gcc-81f98afa22815e7397714caf6fa0fc815803ebaa.tar.gz
gcc-81f98afa22815e7397714caf6fa0fc815803ebaa.tar.bz2
libstdc++: std::from_chars std::{,b}float16_t support
The following patch adds std::from_chars support, similarly to the previous std::to_chars patch through APIs that use float instead of the 16-bit floating point formats as container. The patch uses the fast_float library and doesn't need any changes to it, like the previous patch it introduces wrapper classes around float that represent the float holding float16_t or bfloat16_t value, and specializes binary_format etc. from fast_float for these classes. The new test verifies exhaustively to_chars and from_chars afterward results in the original value (except for nans) in all the fmt cases. 2022-11-01 Jakub Jelinek <jakub@redhat.com> * include/std/charconv (__from_chars_float16_t, __from_chars_bfloat16_t): Declare. (from_chars): Add _Float16 and __gnu_cxx::__bfloat16_t overloads. * config/abi/pre/gnu.ver (GLIBCXX_3.4.31): Export _ZSt22__from_chars_float16_tPKcS0_RfSt12chars_format and _ZSt23__from_chars_bfloat16_tPKcS0_RfSt12chars_format. * src/c++17/floating_from_chars.cc (fast_float::floating_type_float16_t, fast_float::floating_type_bfloat16_t): New classes. (fast_float::binary_format<floating_type_float16_t>, fast_float::binary_format<floating_type_bfloat16_t>): New specializations. (fast_float::to_float<floating_type_float16_t>, fast_float::to_float<floating_type_bfloat16_t>, fast_float::to_extended<floating_type_float16_t>, fast_float::to_extended<floating_type_bfloat16_t>): Likewise. (fast_float::from_chars_16): New template function. (__floating_from_chars_hex): Allow instantiation with fast_float::floating_type_{,b}float16_t. (from_chars): Formatting fixes for float/double/long double overloads. (__from_chars_float16_t, __from_chars_bfloat16_t): New functions. * testsuite/20_util/to_chars/float16_c++23.cc: New test.
Diffstat (limited to 'gcc/value-range.cc')
0 files changed, 0 insertions, 0 deletions