[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [microblaze-uclinux] Can I use assembly language code in uClinux



Brettschneider Falk wrote:
> Hi,
> I've looked at the assembler the gcc compiler generates and it's quite efficient with optimization level -O3. I'm not sure if pure assembler really speeds up.
> CU, F@lk
>
>   
    I believe Mr. Kishore was primarily interested in using Assembler
because he is already compitent in it and does not know C.

    I have heard many claims that modern optimizing C compilers such as
GCC are as efficient or better than hand written assembler. And
personally beleived that was true until I recently had to
    write a lightweight equivalent of U-Boot in less than 16K. While the
project is primarily in C, it was absolutely essential to hand code
numerous functions in assembler to squeeze into the required space. We
probably saved about 4K by writing approximately a dozen common
functions in assembler. For the most part only size was an issue not
performance, but a RamTest needed to perfrom well to actually be a good
test and the assembler version was not only 1/5 the size of the C
version but over 100 times faster.

    Obviously there are significant variables associated with the skill
of the programmer working in C as well as the of the assembler
programmer. In this instance I was dealing with extremely experienced
programmers with a well established track record for generating
efficient code (in any language).

    A good C programmer will probably still write more efficient code
than a poor assembler programmer. And the instances where even an order
of magnitude in size actually matters anymore are rare. There is no good
reason to make a project harder and less portable when it is not
necescary. And it is certainly true that the skill of the programmer is
more important than the choice of C vs. assembler whether optimizing for
size or performance (or both), but if you really need to count bytes or
squeeze out the last bit of performance there is still alot to be gained
with Assembler.

    That said trying to write Linux Kernel drivers in assembler is still
going to be substantially more difficult than learning C.







-- 
Dave Lynch 					  	    DLA Systems
Software Development:  				         Embedded Linux
717.627.3770 	       dhlii@xxxxxxxxxx 	  http://www.dlasys.net
fax: 1.253.369.9244 			           Cell: 1.717.587.7774
Over 25 years' experience in platforms, languages, and technologies too
numerous to list.

"Any intelligent fool can make things bigger and more complex... It
takes a touch of genius - and a lot of courage to move in the opposite
direction."
Albert Einstein
___________________________
microblaze-uclinux mailing list
microblaze-uclinux@xxxxxxxxxxxxxx
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/