[Issue 9991] Optimizer Doesn't Enregister Static Array Elements With Compile-Time Constant Index

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jun 14 03:16:08 PDT 2013


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


bearophile_hugs at eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs at eml.cc


--- Comment #4 from bearophile_hugs at eml.cc 2013-06-14 03:16:06 PDT ---
(In reply to comment #0)

> In GDC, the main loops do, though the pre-loop setup stuff
> does compile differently for reasons I don't understand.

ldc2 compiles them to the same asm (-release -profile-verifier-noassert -O5
-output-s):

__D4test4sum1FxAiZi:
    pushl    %ebx
    pushl    %edi
    pushl    %esi
    movl    16(%esp), %eax
    movl    20(%esp), %esi
    leal    -12(%esi,%eax,4), %ebx
    xorl    %ecx, %ecx
    xorl    %edx, %edx
    xorl    %edi, %edi
    xorl    %eax, %eax
    jmp    LBB0_2
    .align    16, 0x90
LBB0_1:
    addl    12(%esi), %eax
    addl    8(%esi), %edi
    addl    4(%esi), %edx
    addl    (%esi), %ecx
    addl    $16, %esi
LBB0_2:
    cmpl    %ebx, %esi
    jb    LBB0_1
    addl    %edi, %eax
    addl    %edx, %eax
    addl    %ecx, %eax
    popl    %esi
    popl    %edi
    popl    %ebx
    ret    $8


__D4test4sum2FxAiZi:
    pushl    %ebx
    pushl    %edi
    pushl    %esi
    movl    16(%esp), %eax
    movl    20(%esp), %esi
    leal    -12(%esi,%eax,4), %ebx
    xorl    %ecx, %ecx
    xorl    %edx, %edx
    xorl    %edi, %edi
    xorl    %eax, %eax
    jmp    LBB1_2
    .align    16, 0x90
LBB1_1:
    addl    12(%esi), %ecx
    addl    8(%esi), %edx
    addl    4(%esi), %edi
    addl    (%esi), %eax
    addl    $16, %esi
LBB1_2:
    cmpl    %ebx, %esi
    jb    LBB1_1
    addl    %edi, %eax
    addl    %edx, %eax
    addl    %ecx, %eax
    popl    %esi
    popl    %edi
    popl    %ebx
    ret    $8

-- 
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