aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vectorizer.h
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2023-10-17 14:25:00 +0200
committerJakub Jelinek <jakub@redhat.com>2023-10-17 14:25:00 +0200
commitfbdf88a1f6de2399101ecea948ff1abbf82459fc (patch)
treec96ccb92bfa2b1a3b3ca984d83abcf2d854fb217 /gcc/tree-vectorizer.h
parent5bb79a427adb57d4a55690f29d4f49e42d68c2a5 (diff)
downloadgcc-fbdf88a1f6de2399101ecea948ff1abbf82459fc.zip
gcc-fbdf88a1f6de2399101ecea948ff1abbf82459fc.tar.gz
gcc-fbdf88a1f6de2399101ecea948ff1abbf82459fc.tar.bz2
wide-int-print: Don't print large numbers hexadecimally for print_dec{,s,u}
The following patch implements printing of wide_int/widest_int numbers decimally when asked for that using print_dec{,s,u}, even if they have precision larger than 64 and get_len () above 1 (right now we printed them hexadecimally and even negative numbers as huge positive hexadecimal). In order to avoid the expensive division/modulo by 10^19 twice, once to estimate how many will be needed and another to actually print it, the patch prints the 19 digit chunks in reverse order (from least significant to most significant) and then reorders those with linear complexity to form the right printed number. Tested with printing both 256 and 320 bit numbers (first as an example of even number of 19 digit chunks plus one shorter above it, the second as an example of odd number of 19 digit chunks plus one shorter above it). The l * HOST_BITS_PER_WIDE_INT / 3 + 3 estimatition thinking about it now is one byte too much (one byte for -, one for '\0') and too conservative, so we could go with l * HOST_BITS_PER_WIDE_INT / 3 + 2 as well, or e.g. l * HOST_BITS_PER_WIDE_INT * 10 / 33 + 3 as even less conservative estimation (though more expensive to compute in inline code). But that l * HOST_BITS_PER_WIDE_INT / 4 + 4; is likely one byte too much as well, 2 bytes for 0x, one byte for '\0' and where does the 4th one come from? Of course all of these assuming HOST_BITS_PER_WIDE_INT is a multiple of 64... 2023-10-17 Jakub Jelinek <jakub@redhat.com> * wide-int-print.h (print_dec_buf_size): For length, divide number of bits by 3 and add 3 instead of division by 4 and adding 4. * wide-int-print.cc (print_decs): Remove superfluous ()s. Don't call print_hex, instead call print_decu on either negated value after printing - or on wi itself. (print_decu): Don't call print_hex, instead print even large numbers decimally. (pp_wide_int_large): Assume len from print_dec_buf_size is big enough even if it returns false. * pretty-print.h (pp_wide_int): Use print_dec_buf_size to check if pp_wide_int_large should be used. * tree-pretty-print.cc (dump_generic_node): Use print_hex_buf_size to compute needed buffer size.
Diffstat (limited to 'gcc/tree-vectorizer.h')
0 files changed, 0 insertions, 0 deletions