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

--- Comment #11 from Segher Boessenkool <segher at gcc dot gnu.org> ---
> Segher, is this a case of needing to add a combiner pattern to translate that 
> splat/shift into an add of itself?

You only ever do "combiner patterns" to recognise something that combine
generates that we do not recognise otherwise.  Usually we do a splitter
then; combine does not usually generate RTL representations that we do
not want to recognise otherwise :-)

Sometimes combine generates something that is not canonical.  Yes, that is
a bug then.  In some cases it has its own ideas of what a good representation
is.  Just because combine generates a certain representation does not make
that canonical, although it often is treated like that: canonical are
exactly those things that in the manual are called canonical, nothing more,
and nothing less.

There are various places in GCC that convert

  x*2

to

  x<<1

and also some that make it

  x+x

(but not as many as me might want).  The backend can help with this (none of
the three patterns have any side effect ever, so it is easy for use).

On almost every arch x*2 is the slowest, and also almost always x+x is the
fastest.  But for things like 128-bit ints ymmv on pretty much every arch!

Reply via email to