[Issue 5100] -O Degrades performance of loop statements

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Dec 7 01:01:24 PST 2010


http://d.puremagic.com/issues/show_bug.cgi?id=5100



--- Comment #5 from Iain Buclaw <ibuclaw at ubuntu.com> 2010-12-07 00:59:45 PST ---
Been playing about with GCC, this seems to be a better performant:

Objdump:

push   %ebp
mov    %esp,%ebp
and    $0xfffffff0,%esp
push   %eax
sub    $0xc,%esp
lea    0x0(%esi),%esi
add    $0x1,%eax
cmp    $0x7fffffff,%eax
jne    30 <_Dmain+0x10>
add    $0xc,%esp
mov    %ebp,%esp
pop    %ebp
ret    



GCC assembly:

.globl _Dmain
        .type   _Dmain, @function
_Dmain:
.LFB0:
        .cfi_startproc
        .cfi_personality 0x0,__gdc_personality_v0
        pushl   %ebp
        .cfi_def_cfa_offset 8
        movl    %esp, %ebp
        .cfi_offset 5, -8
        .cfi_def_cfa_register 5
        andl    $-16, %esp
        pushl   %eax
        .cfi_escape 0x10,0x3,0x7,0x55,0x9,0xf0,0x1a,0x9,0xfc,0x22
        subl    $12, %esp
        .p2align 4,,7
        .p2align 3
.L4:
        addl    $1, %eax
        cmpl    $2147483647, %eax
        jne     .L4
        addl    $12, %esp
        movl    %ebp, %esp
        popl    %ebp
        ret
        .cfi_endproc
.LFE0:
        .size   _Dmain, .-_Dmain


Can attach the full .s file if needed.

Regards

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list