http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56069



             Bug #: 56069

           Summary: [4.6/4.7/4.8 Regression] RA pessimization

    Classification: Unclassified

           Product: gcc

           Version: 4.8.0

            Status: UNCONFIRMED

          Keywords: missed-optimization, ra

          Severity: normal

          Priority: P3

         Component: rtl-optimization

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: ja...@gcc.gnu.org

                CC: rsand...@gcc.gnu.org, vmaka...@gcc.gnu.org

            Target: x86_64-linux





Since http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=139993

unsigned long foo (unsigned long mem)

{

  return (mem >> 3) | (1UL << 44);

}



unsigned long bar (unsigned long mem)

{

  return (mem >> 3) + (1UL << 44);

}



on x86_64-linux at -O2 (and -Os) the generated code for foo is one insn longer.

We used to emit:

        shrq    $3, %rdi

        movabsq $17592186044416, %rax

        orq     %rdi, %rax

        ret

but now emit:

        movq    %rdi, %rax

        movabsq $17592186044416, %rdx

        shrq    $3, %rax

        orq     %rdx, %rax

        ret

Reply via email to