Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 29 Jun 2008 19:47:41 +1000 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Christoph Mallon <christoph.mallon@gmx.de>
Cc:        cvs-src@freebsd.org, Marius Strobl <marius@freebsd.org>, src-committers@freebsd.org, cvs-all@freebsd.org, Bruce Evans <brde@optusnet.com.au>
Subject:   Re: cvs commit: src/sys/sparc64/include in_cksum.h
Message-ID:  <20080629174222.V93221@delplex.bde.org>
In-Reply-To: <486731F4.9050400@gmx.de>
References:  <200806252105.m5PL5AUp064418@repoman.freebsd.org> <48654667.1040401@gmx.de> <20080628114028.M89039@delplex.bde.org> <4865F895.8030600@gmx.de> <20080629132901.Q92490@delplex.bde.org> <486731F4.9050400@gmx.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 29 Jun 2008, Christoph Mallon wrote:

> Bruce Evans wrote:

>>> I have to disagree. Where does the GCC documentation state, that "cc" has 
>>> no effect on x86? It is the other way round: The compiler assumes, the 
>> 
>> Well, in gcc-1.40, gcc.info says nothing about "cc", apparently because
>> "cc" didn't exist in gcc-1.40.  gcc-1.40 had to assume that cc was
>> always clobbered.  I think there are enough old i386 asm statements
>
> GCC 1.4? Would you please bury this corpse again? It smells. (;

I don't remember using gcc.1.4, but many of the basic asm statements in
FreeBSD and Linux have the same age as gcc-1.40.

>> since gcc doesn't really understand cc in asms).  (Linux-2.6.10/include/
>> asm-i386/*.h has 177 __asm__ statements (133 with volatile) with only
>> 11 "cc"'s.  Examples of ones without "cc"'s are everything in string.h,
>> where things like scasb for strcmp() normally clobber "cc".)
>> 
>> Newer versions of gcc.info have to say to use it in clobber lists, to
>> support CPUs with a shorter history than i386 and to prepare for changing
>> the assumptions on i386.
>
> Three fourth of the assembler statements needing volatile seems way to high 
> to me.

Three fourths of asm statements would need cc clobbers with your rule, and
only 1 hundredth of them currently have them :-(.  I exaggerate slightly --
the ratios might be more like 2/4 and 1/10, depending on how common
arithmetic operations are in asm statements (they aren't in most asm
statements because C handles plain arithmetic operations well).  BTW, what
happens for floating point condition codes?  Nothing is documented, so we
have to guess that the cc clobber covers FP condition codes or that all
condition codes are assumed to be clobbered by all asms.

> I did not find the strcmp() implementation, which uses scasb. I only 
> found strcmp.S, which is not inline assembler and does not use scas either, 
> which would have suprised me (nor cmpsb, which would be more logical).

Try linux-x.y.z/include/asm-i386/string.h.  Some of this has been imported
into FreeBSD, in i386-bitops.h in ext2fs.  File systems don't benefit from
this much micro-optimization (for i486's), but checksumming does.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080629174222.V93221>