[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#372913: assembler output...



I made a diff of the assembler code with -O0 and -O2:

     1  --- test_O0     2006-06-12 15:30:56.000000000 +0200
     2  +++ test_O2     2006-06-12 15:30:49.000000000 +0200
     3  @@ -1,5 +1,6 @@
     4          .file   "test.c"
     5          .text
     6  +       .p2align 4,,15
     7   .globl main
     8          .type   main, @function
     9   main:
    10  @@ -9,18 +10,8 @@
    11          pushl   %ebp
    12          movl    %esp, %ebp
    13          pushl   %ecx
    14  -       subl    $16, %esp
    15  -       movb    $0, -5(%ebp)
    16   .L2:
    17  -       incb    -5(%ebp)
    18  -       cmpb    $0, -5(%ebp)
    19  -       jne     .L2
    20  -       movl    $0, %eax
    21  -       addl    $16, %esp
    22  -       popl    %ecx
    23  -       popl    %ebp
    24  -       leal    -4(%ecx), %esp
    25  -       ret
    26  +       jmp     .L2
    27          .size   main, .-main
    28          .ident  "GCC: (GNU) 4.1.2 20060604 (prerelease) (Debian 4.1.1-2)"
    29          .section        .note.GNU-stack,"",@progbits

Seems like it "optimizes" the essential comparision around line 18...


Regards,
Erik



Reply to: