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

            Bug ID: 66217
           Summary: PowerPC rotate/shift/mask instructions not optimal
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: segher at gcc dot gnu.org
          Reporter: segher at gcc dot gnu.org
  Target Milestone: ---
            Target: powerpc*-*-*

GCC does not generate optimal instruction sequences for rotate/shift/mask
sequences; it pretty often makes quite bad code, even, esp. when it
involves 64-bit instructions.

One part of the problem is that the masks we allow are less general
than what the hardware allows.  Not a huge problem for the rlwinm
instructions, but we shouldn't need "mask_operand_wrap" there either.

Another big part of the problem is our rtx_cost function does not
handle rotate-and-mask correctly; it recurses to get the cost of
the mask, but then it looks at the mode of it, which is VOIDmode
(it is a const_int), and things go south.

It would be nice to not need that rtx_cost at all, certainly not
for combine  (which has access to full insns always), but that is
a bigger project.

Another problem is with the insert insns.  They are not as general
as they should be, as before.  Also, we should be able to handle
things like (a << 16) | (b >> 16), which is an insert insn followed
by a "normal" rotate (or the other way around).  This should also
make the bswap patterns a little bit simpler.

Reply via email to