[Zlib-devel] infnew-5 available for testing

Chris Anderson christop at fellspt.charm.net
Fri Jan 10 03:25:01 EST 2003


On Thu, 9 Jan 2003, Mark Adler wrote:

>
> That's certainly an improvement to keep the counter in a register,
> though I'm a little perplexed about what the
>
> >         lea       1(%edx), %edi                                 #231.36
> >         lea       1(%ebp), %ebx                                 #231.25
>
> instructions are for.
>
> mark
>

I tried my best to trace them (I ain't an x86 expert), and it appears that
icc is speculatively saving &from[ 1 ] and &out[ 1 ] for use after the
loop in the if (len) {} statement on line 236.  I didn't try to follow the
case where len == 0 on 236 because it appears to toss the register that
from (%edi) is in.

My hand trace follows.  I should have tried to run it through gdb instead.
Right around ..B1.38 and ..B1.39 is where %edi and %ebx are used again.

###     from = out - dist;
..B1.36:
        movl      %esi, 44(%esp) # save hold
        movl      %ebp, (%esp)   # save bits                    #229.34
        negl      %edx           # edx = -dist                  #229.34
        addl      52(%esp), %edx # edx += out                   #229.34
        movl      52(%esp), %ebp # load out                     #229.34
        movl      %edx, 48(%esp) # save from                    #229.34

..B1.37:
###     do {
###         PUP(out) = PUP(from);

        movb      (%edx), %bl    # load from[ 0 ]               #231.36
        movb      %bl, (%ebp)    # out[ 0 ] = from[ 0 ]         #231.25
        movb      1(%edx), %cl   # load from[ 1 ]               #232.36
        lea       1(%edx), %edi  # edi = &from[ 1 ]             #231.36
        lea       1(%ebp), %ebx  # ebx = &out[ 1 ]              #231.25

###         PUP(out) = PUP(from);

        movb      %cl, 1(%ebp)   # out[ 1 ] = from[ 1 ]         #232.25
        movb      2(%edx), %cl   # load from[ 2 ]               #233.36

###         PUP(out) = PUP(from);

        movb      %cl, 2(%ebp)   # out[ 2 ] = from[ 2 ]         #233.25

###         len -= 3;

        addl      $-3, %eax      # len -= 3                     #234.25
        addl      $3, %edx       # from = &from[ 3 ]            #233.36
        addl      $3, %ebp       # out = &out[ 3 ]              #233.25

###     } while (len > 2);

        cmpl      $2, %eax       # len > 2                      #235.30
        ja        ..B1.37                                       #235.30

..B1.38:
        movl      44(%esp), %esi # load hold
        movl      %ebp, 52(%esp) # save out
        movl      (%esp), %ebp   # load bits
        movl      %edx, 48(%esp) # save from = &from[ -2 ]

###     if (len) {

        testl     %eax, %eax     # len == 0                     #236.21
        je        ..B1.41                                       #236.21

###         PUP(out) = PUP(from);
..B1.39:
        movb      2(%edi), %dl   # load from[ -2 + 2 = 0 ]      #237.36
        addl      $1, 48(%esp)   # save from = from + 1         #237.36
        movb      %dl, 2(%ebx)   # out[ -2 + 2 = 0 ] = from[ 0 ]#237.25
        addl      $1, 52(%esp)   # save out = out + 1           #237.25

###         if (len > 1)

        cmpl      $1, %eax         # len <= 1                   #238.25
        jbe       ..B1.41       # Prob 50%                      #238.25

###             PUP(out) = PUP(from);
..B1.40:
        movl      48(%esp), %ebx   # load from                  #239.40
        movl      52(%esp), %edx   # load out                   #237.25
        movb      (%ebx), %al      # load from[ 0 ]             #239.40
        movl      %edx, %edi       # edi = out                  #237.25
        addl      $1, %edx         # out++                      #239.29
        movb      %al, (%edi)      # out[ 0 ] = from[ 0 ]       #239.29
        movl      %edx, 52(%esp)   # save out                   #239.29








More information about the Zlib-devel mailing list