Re: Disobeying jet engines - why?



"Jan Panteltje" <pNaonStpealmtje@xxxxxxxxx> wrote in message
news:fnqlse$qhu$1@xxxxxxxxxxx
eh, using C, with the modern compilers highly optimising,
they 'know' the processor', may actually improve performance, and reduce
chances of errors that could have occurred by misunderstanding some CPU
features
by an asm programmer.

Something as simple as a standard CRC routine such as this one:

ULONG CalcCRC(ULONG rc,const UCHAR* buf,UINT len)
{
while (len > 0)
{
UCHAR nb = *buf;
UCHAR i = (rc & 0xff);
i ^= nb;
rc = rc >> 8;
rc ^= CRCTable [i];
buf++;
len--;
}

return rc;
}

....is a lot quicker to implement in C than it is in assembly; if I'm paying
someone to do this C is certainly the way to go here. It's also then a lot
faster to change the code around to use pointers (effectively changing the
addressing mode used in the generated code) and check whether or not the
performance improves (on this CPU it became a little worse).

Much is 'vague', for example if you use FPGA, then you depend on the
vendor's soft
to create the interconnects from the HDL.

This is a good point that a lot of people overlook. Even if you're
programming in assembly, you're still making use of the (seemingly reasonable,
at first blush) assumption that the code will execute the way you wrote it.
With superscalar CPUs that dynamically reorder program execution, that's a
HUGE amount of complexity going on behind the scenes to give the _appearance_
that that's what's happening, and of course the end result is that pretty much
all "big iron" (32 or 64 bit desktop) CPUs today have non-negligible errata
lists of what doesn't quite work the way it should.

---Joel


.



Relevant Pages

  • Re: Thinking assembly?
    ... I simply needs to understand the CPU and how it works, ... > understand the instructions, be a good and experienced programmer, ... assembly language is the machine's language (or, at least, ...
    (alt.lang.asm)
  • Re: How does this make you feel?
    ... >>>primitives to implement, say, a memcpy just as efficiently as microcode ... > The work is offloaded from the programmer in any case - this type of code ... library macros need updating for new CPU products, ... And designing such instruction such that they don't ...
    (comp.arch)
  • Re: CPU time differences for the same job
    ... Your answer, though, betrays a system programmer ... Management of development areas still are tasked with reducing the CPU ... consumption and elapsed running times of their applications, ... CPU time differences for the same job ...
    (bit.listserv.ibm-main)
  • Re: Significant Pure Assembler Application In MASM ?
    ... probability for having, later, a Processor emulating, by ... your execution and data environment. ... so the poor low level programmer have to rewrite the same programme ... so define an assembly language for that cpu; so c or c++ compiler can ...
    (alt.lang.asm)
  • Re: Significant Pure Assembler Application In MASM ?
    ... probability for having, later, a Processor emulating, by ... your execution and data environment. ... so the poor low level programmer have to rewrite the same programme ... so define an assembly language for that cpu; so c or c++ compiler can ...
    (alt.lang.asm)