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

            Bug ID: 105991
           Summary: rldicl+sldi+add generated instead of rldimi
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mpolacek at gcc dot gnu.org
  Target Milestone: ---

Starting with r12-2731-g96146e61cd7aee, this code (on ppc64le)

unsigned long long
foo (unsigned long long value)
{
  value &= 0xffffffff;
  value |= value << 32;
  return value;
}

compiled with -O2 generates

        rldicl 9,3,0,32
        sldi 3,3,32
        add 3,3,9
        blr

while previously it was just

        rldimi 3,3,32,0
        blr


It doesn't look like a wrong code problem, but it seems more optimal to use
rldimi (rotate left, mask insert) rather than rotate left by 0 bits, AND with a
mask, shift left, and add.

Reply via email to