Re: The Kommunity vs. Dick Johnson

Petko Manolov (petkan@varel.bg)
Tue, 17 Nov 1998 12:44:16 +0200


Theodore Y. Ts'o wrote:
>
> People who say that compilers can "obviously" always produce better code
> than hand-assemblers are usually parrotting the usual dogma heard in
> compiler classes. While it's usually true, there are notable
> exceptions, and it shouldn't be all that surprising that kernel
> programmers (and crypto programmers) have an easier time finding the
> sticky cases which gcc doesn't handle well at all.
>
> - Ted

I'm agree with this. There are many young (and not so young)
high level programmers that think they can do everything in C
or Pascal. And if this is almost thrue in user level, i'll be
very interested to see OS entirely writen on C or something.
Here are some pieces of some [3456]86 instructions that are very hard
to be coded in C with even similar performance.

inline int BTC( int bit, int offset ) {
register int __res;
__asm__ __volatile__ (
"btcl %1, %0"
: "=r" (__res), "=q" (bit)
: "0" (offset), "1" (bit));
return __res;
}

inline int BTC( int bit, int offset ) {
register int tmp=(1<<bit);
if ( offset & tmp )
return (offset & (~tmp));
else
return (offset | tmp);
}

regards

-- 
Petko Manolov - petkan@varel.bg
http://www.varel.bg/~petkan

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/