cvs commit: src/sys/sparc64/include in_cksum.h

Bruce Evans brde at
Sun Jun 29 09:47:45 UTC 2008

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


More information about the cvs-src mailing list