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

           Summary: Extra instruction generated in 4.5.2
           Product: gcc
           Version: 4.5.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: b...@broadcom.com


I encounter a performance regression in 4.5.2 (4.6 as well) compared with
4.5.1.

The code is from Core Mark. 

Compile the attached .i file. 

~/work/install-x86-452/bin/gcc core_matrix.i -O2 -S -o x86-452.s
...
.L5:
    movl    %r8d, %r10d
.L3:
    mov    %r9d, %r8d
    movswl    (%rcx,%rax), %r11d
    addq    $2, %rax
    movswl    (%rdx,%r8,2), %r8d
    addl    $1, %r9d
    imull    %r11d, %r8d
    addl    %r10d, %r8d
    cmpq    %rbx, %rax
    jne    .L5
...

~/work/install-x86-451/bin/gcc core_matrix.i -O2 -S -o x86-451.s
...
.L3:
    mov    %r9d, %r8d
    movswl    (%rcx,%rax), %r11d
    addq    $2, %rax
    movswl    (%rdx,%r8,2), %r8d
    addl    $1, %r9d
    imull    %r11d, %r8d
    addl    %r8d, %r10d
    cmpq    %rbx, %rax
    jne    .L3
...

The performance hit is even worse on our architecture because zero-overhead
loop instruction cannot be used in such irregular loop produced by 4.5.2

The configuration used is:
../gcc-4.5.1/configure
--prefix=/projects/firepath/tools/work/bmei/install-x86-451
--with-mpfr=/projects/firepath/tools/work/bmei/packages/mpfr/2.4.1/x86-64
--with-gmp=/projects/firepath/tools/work/bmei/packages/gmp/4.3.0/x86-64
--with-mpc=/projects/firepath/tools/work/bmei/packages/mpc/0.8.1/x86-64
--with-elf=/projects/firepath/tools/work/bmei/packages/libelf/x86-64
--disable-bootstrap --enable-languages=c --no-create --no-recursion


The difference between 4.5.1 and 4.5.2 seems to occur in RTL expand pass.

Reply via email to