Re: Embedding assembler in a language



On 2009-11-19, tm <thomas.mertes@xxxxxx> wrote:
such crap.

If there is a genuine need for assembler, isn't it much better to make it
available within the discipline of a high-level language?

Why is there a need for assembler?
I want to know about each and every problem where people think they
need assembler and where they think something cannot be solved in a
high level language. If it is for performance reasons I want to know
which language feature is considered slow.

These are slower than assembler in Pascal/Delphi, and thus in all languages:

- move a block of memory
- fill a block of memory (byte/word/dword/qword)
- search for a value in a block of memory (byte/word/dword/qword)
- Compare a range of memory (byte/word/dword/qword)
- int64/qword language helpers
- (>32-bit elements) set language helpers
- Two hands full of the deepest string primitives. While maybe these
could be expressed in other primitives, coding these out, and
with certain assumptions about used registers is notacibly faster.
- mpi routines. Every cycle the loop is shorter is noticable
- most math primitives, due to setting copro mask inline and using FPU
instructions.

Some stuff is only doable in assembler, because they e.g. break the
procedural regime or touch registers and instructions not modeled by the
language:

- most math primitives, due to setting copro mask inline and using FPU
instructions.
- exception helpers
- Change a coprocessor exceptions mask. Switch to MMX mode etc
- check cpu version and capabilityies
- spinlock primitives, CAS etc.

.