[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Low-level vs. High-level programming (was My First Computer)
On Sun, 22 Jun 2003 06:38:34 +0000, Scott Moore wrote:
> Joel Kolstad wrote:
>
>> how many of the 'old school' 8 bit assembly programmers are familiar
>> with modern superscalar processor design these days? ... With a
>> supserscalar CPU, often the optimal assembly code looks like a God-
>> awful mess.
>
> I'm sure there were 8 bit programmers who let their skills ossify. Most of
> them are in management now.
Although the technologies are very different, I get the same kind of
feeling when programming an 6502 and an Athlon in assembler. In
both cases you can just code it the obvious way and you will pay the
performance penalty. Figuring out how to do things the fast way is
on both machines sometimes a tortuous process.
On the 6502 I rack my brains to figure out how to eliminate a variable,
or keep everything I need in the three 8-bit registers, or rearrange the
computation so that the condition flags are always set nicely without
having to waste time and bytes doing it explicitly.
On the Athlon I rack my brains figuring out how to order the
instructions so that they fall into the right slots to keep the ALUs
working, and how to rearrange the computation so that the caches
don't get trashed, and how to make sure that the branches are
predicted properly, and how to minimize dependencies that stall
the pipeline.
In both cases I can do a lot better than any compiler I've seen,
but it's not usually easy.