Am Mittwoch, 16. April 2008 10:14:33 schrieb Jens M Andreasen:
Yes, it bothers me if the compiler can beat
"hand-optimized" ASM :-D
It turns out that I get different results on consecutive runs of the
same binary, look:
Well, those two mixing tasks are really simple examples and it's easi(er) to
write good hand crafted assembly code for them. But if you consider more
complex algorithms, probably even involving differential calculations, it
gets a lot harder to beat the compiler, since you have to deal with so many
side effects on assembly level (especially all pipelining related issues) to
achieve maximum performance results with modern CPUs. That doesn't mean you
cannot beat the compiler of course, but often you end up working on an
assembly algorithm for a month or so until you finally beat (a good) pure
C++ / gcc vector variant which you just wrote in some hours.
So in practice, if the results are very close together anyway, probably not
even noticeable, I would definitely prefer to spend that time on other tasks
and enjoy the fact that the implementation compiles with very good
performance results on other architectures as well.
CU
Christian