https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95867
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Not really __uint128_t related. Since PR18589 we perform such optimizations on floating point multiply, and on signed integers we punt on reassociation because of the undefined signed overflow issues (the proposal to do a very late reassoc that would essentially turn on -fwrapv from that point onwards or at least turn rewritten expressions into unsigned ones has not materialized yet), but for unsigned integral types we could indeed replace those with the minimal number of multiplications. Or alternatively we could do that in forwprop1, which can handle similar case for addition into multiplications, though I guess only reassoc will be able to handle it if it isn't just one variable as the multiplication operands, but several. return x * x * y * z * x * z * x * w * w * u * x * z * y * w * u * x * x * w * w * w; etc.