On May 19, 2017 5:47:10 PM GMT+02:00, Alexander Monakov <amona...@ispras.ru> wrote: >On Fri, 19 May 2017, Marek Polacek wrote: >> > I think it's possible to keep this folding, note that it's valid to >transform to >> > >> > (n * 1 * z) * 500000 >> > >> > (i.e. accumulate multiplications on the outermost factor) > >(to be precise, if the multiplication is done in a signed type and the >middle >constant factor was a negated power of two, the sign change needs to >remain: > > a * -4 * b * 2 > >needs to be transformed to > > a * -1 * b * 8 ) > >> > so would it be possible to adjust things here to remove the >innermost >> > multiplication instead? >> >> I think I'd rather not expand this function any more, sorry. > >I'd be happy to look into that myself, if the idea sounds feasible and >desirable. >I've never looked at this code before, so I'd appreciate a quick >yay-or-nay >before diving in. Richard, can you share your opinion on this point?
I'd rather extend the fold-binary associate: case to handle this, or do this via match.pd pattern(s). Of course in the end we miss to associate signed integer ops in the reassoc pass... Richard. >Thanks. >Alexander