[Bug target/96173] double to _Decimal64 or _Decimal128 conversion with BID generates 3 MB of code

vincent-gcc at vinc17 dot net gcc-bugzilla@gcc.gnu.org
Sun Jul 12 02:20:45 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96173

--- Comment #2 from Vincent Lefèvre <vincent-gcc at vinc17 dot net> ---
IMHO, the implementation is highly inefficient. Even with all these functions
(which are similar, thus should share most code), 3 MB seems a lot to me.

In particular, some user complained that the size of the GNU MPFR library
(which now uses such conversions) has been multiplied by 5. This is even worse
with the GCC 11 snapshot, using ./configure CC=gcc-snapshot CFLAGS="-O2":

 663880 with --disable-decimal-float
4836016 with --enable-decimal-float
1914376 with --enable-decimal-float and hardcoded values instead of conversions
 668240 with --enable-decimal-float and even more hardcoded values

Note that this is MPFR that does the binary-to-decimal conversion itself (MPFR
uses _Decimal128 operations just for the format conversion, to generate either
NaN/±Inf/±0 from a double or some regular value from a decimal character
sequence). If MPFR can do this conversion within its few hundreds of KB[*], I
don't see why this can't be done by GCC.

[*] This does not include the small part of GMP on which MPFR is based, but
this includes much unrelated code, for all the functions MPFR implements.


More information about the Gcc-bugs mailing list