Mail Archives: djgpp/2001/02/09/21:26:15
clusty <clusty AT poland DOT com> wrote:
> Użytkownik "Clark L. Coleman" <clc5q AT cobra DOT cs DOT Virginia DOT EDU> napisał w wiadomo¶ci
> news:95h3j1$frf$1 AT murdoch DOT acc DOT Virginia DOT EDU...
>> Could you answer my question: Why does it have to be inline assembly
>> when it could be done in C code?
> Because it has to be. In case you didn't know its faster that way. :)
Nonsense --- at least in the absolutistic way you put it. Yes, inline
assembly can be faster than compiled C, for certain operations. But
nothing I see in this thread gives a good reason why *this* particular
operation might profit from being written in inline assembly. GCC is a
C compiler, so computing and applying structure offsets to addresses
is something it's almost necessarily rather good at, already.
Always keep in mind: to make inline assembly noticeably faster than
compiled code, your understanding of the CPU usually has to be better
than that of the GCC authors. Do you *really* think you're that good?
Have you ever looked at the assembly generated by gcc -O2 or higher to
validate that opinion? And, if you really are consistently better
than GCC: why don't you spend your work time on improving GCC,
instead, to get the maximal effect out of it?
And that's not yet taking into account that badly written inline
assembly (e.g.: most occurences of __asm__ __volatile__) can easily
make GCC's remaining task so much harder that, over all, the whole
things is *slower* than without the asm.
--
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.
- Raw text -