"Ensor" wrote:
The last time I had a job as an assembly language programmer was 16 years
ago, and even then those types of jobs were damn thin on the ground (now
they're non-existant) - since every idiot these days seems to think "C" is
the way to go....which it isn't.... :-(
The last thing I want is 1600 posts to this list on a flame war about "c
versus asm", so *PLEASE* don't respond to this over and over,
but, as an anecdote,
I recently hand coded a PPC algorithm in assembler, and spend 3-4 days
working on it, got it all pretty and tight and when I benchmarked it,
the hand written code was *SLOWER* than the C code.
GCC is pretty good at generating fast code these days if - like any tool -
you learn how to use it.
Now I did hand-tune the c-code for a number of days, checking cycle
counts on a simulator and moving things around to force the compiler to
do things, did a lot of inline-ing and things like using constant array
indexes and explicit if's where possible.
So these days my feeling is that C is just a high level assembler, with
a expression optimizer on top.
don't get me wrong. I use assemblers all the time, for lots of different
machines, but I was recently surprised to be beaten by a machine.
I'll also note that this is a 32 bit machine. My comments only really
apply to 32 bit machines with a reasonable pipeline and some amount of
branch prediction.
I've been able to do *much* better than the compiler writing assembler on
super-super-scaler cpu's like the TI DM642. But trying to keep 6 ALU's
going at one time can make your head explode.
-brad