This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/15513] New: loop peeling failed


The code:

double ff( double* x )
{
    double a=0;
    for( int p = 0; p < 2; ++p ) for( int q = p; q < 2; ++q ) a += x[q];
    return a;
}

compiled with
/opt/gcc34/bin/g++ -save-temps -O3 -c xtest.cc -fpeel-loops

results in assembler code that still contains the loops, instead of the obvious
straightforward code.

Regards,
Thomas Kunert

        .file   "xtest.cc"
        .text
        .align 2
        .p2align 4,,15
.globl _Z2ffPd
        .type   _Z2ffPd, @function
_Z2ffPd:
.LFB2:
        pushl   %ebp
.LCFI0:
        fldz
        movl    %esp, %ebp
.LCFI1:
        movl    8(%ebp), %ecx
        xorl    %edx, %edx
.L9:
        cmpl    $1, %edx
        movl    %edx, %eax
        jle     .L14
.L13:
        incl    %edx
        cmpl    $1, %edx
        jle     .L9
        popl    %ebp
        ret
        .p2align 4,,7
.L14:
        faddl   (%ecx,%eax,8)
        incl    %eax
        cmpl    $1, %eax
        jg      .L13
        faddl   (%ecx,%eax,8)
        incl    %eax
        cmpl    $1, %eax
        jle     .L14
        jmp     .L13
.LFE2:
        .size   _Z2ffPd, .-_Z2ffPd
        .section        .note.GNU-stack,"",@progbits
        .ident  "GCC: (GNU) 3.4.0"

[kunert@ptpp80 dymol]$ /opt/gcc34/bin/g++ -v
Reading specs from /opt/gcc34/lib/gcc/i686-pc-linux-gnu/3.4.0/specs
Configured with: ../configure --enable-shared --disable-checking
--with-arch=pentiumpro --prefix=/opt/gcc34 --enable-__cxa_atexit
--enable-languages=c,c++
Thread model: posix
gcc version 3.4.0

-- 
           Summary: loop peeling failed
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kunert at physik dot tu-dresden dot de
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]