lkml.org 
[lkml]   [1996]   [Dec]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: gcc anomalities (fwd)
From
Date
Neptho T <Neptho@hagan.reno.nv.us> writes:

> I've been looking at the assembly code generated by gcc for some of the
> Linux code, and there seem to be some weird anomolies...
>
> In net/ipv4/tcp_output.c there are a few references to "sk->rcvbuf/2" and
> "sk->rmem_alloc/2". For some reason which I'm trying to ascertain, gcc
> generates the awkward instruction sequence:
>
> 77:tcp_output.c **** window = sk->rcvbuf/2;
> 1473 .LM10:
> 1474 003a 8B861C01 movl 284(%esi),%eax
> 1474 0000
> 1475 0040 C1E81F shrl $31,%eax
> 1476 0043 03861C01 addl 284(%esi),%eax
> 1476 0000
> 1477 0049 89C2 movl %eax,%edx
> 1478 004b C1FA01 sarl $1,%edx

That is to get the rounding correct for negative numbers when using
shift to do a signed division. The code would be simpler if the
numerator were unsigned.

Tom.

\
 
 \ /
  Last update: 2005-03-22 13:38    [W:0.043 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site