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/39838] [4.3/4.4/4.5 regression] unoptimal code for two simple loops



------- Comment #6 from steven at gcc dot gnu dot org  2010-01-02 00:57 -------
On x86 -O2:

      1 call
      1 leal
      1 ret
      1 subl
      2 cmpl
      2 testl
      2 xorl
      3 addl
      4 popl
      4 pushl
     20 movl

test:
        pushl   %ebp
        movl    %esp, %ebp
        pushl   %edi
        pushl   %esi
        xorl    %esi, %esi
        pushl   %ebx
        subl    $44, %esp
        movl    8(%ebp), %ecx
        movl    $0, -28(%ebp)
        movl    (%ecx), %edx
        testl   %edx, %edx
        jle     .L1
        .p2align 4,,7
        .p2align 3
.L8:
        movl    16(%ebp), %eax
        leal    4(%esi), %edi
        testl   %eax, %eax
        jle     .L6
        movl    %edi, %eax
        xorl    %ebx, %ebx
        movl    %ecx, %edi
        movl    %eax, %ecx
        .p2align 4,,7
        .p2align 3
.L4:
        movl    4(%edi), %eax
        addl    $1, %ebx
        movl    (%eax,%ecx), %edx
        movl    %edx, 4(%esp)
        movl    (%eax,%esi), %eax
        movl    %ecx, -32(%ebp)
        movl    %eax, (%esp)
        call    func
        movl    -32(%ebp), %ecx
        cmpl    %ebx, 16(%ebp)
        jg      .L4
        movl    %ecx, %eax
        movl    %edi, %ecx
        movl    %eax, %edi
.L6:
        addl    $1, -28(%ebp)
        movl    %edi, %esi
        movl    -28(%ebp), %eax
        cmpl    %eax, (%ecx)
        jg      .L8
.L1:
        addl    $44, %esp
        popl    %ebx
        popl    %esi
        popl    %edi
        popl    %ebp
        ret


-- 


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


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