[RFC] overflow safe scaling of 64bit values

Jan Hubicka hubicka@ucw.cz
Wed Oct 11 17:23:00 GMT 2017


> > Any ideas for better version? If not I will go ahead with this variant and
> > increase profile probability base.
> 
> Why not use GCC wide int?

Because I would like to keep operations fast on in common case where overflows
do not happen. There was at least one case (the propagation of probabilities
to frequencies) where this was compilation time critical. This particular code
runs on sreals but similar type of propagation is done by rtl expansion (on
smaller scale)

But using wide int is what i do as fallback- see if multiplication fits in
64bit arithmetics, if 128bit arithmetics is available and go for wide int
otherwise.

Honza



More information about the Gcc-patches mailing list