This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: MS/CW-style inline assembly for GCC


Paul Koning wrote:

 Geoff> Why wouldn't you write the code in C in these cases?  It seems
 Geoff> to me that if you're willing to have the compiler schedule the
 Geoff> code, you might as well let it select the instructions and do
 Geoff> register allocation as well.

Good argument.

Assembler belongs in places where you need more performance than a
compiler can give you -- in which case you MUST know scheduling.  And
it belongs in places where you need absolute control over what happens
-- diagnostics, DRAM initialization, bootstraps, stuff like that.

One obvious reason for using ASM inserts is that GCC simply can't generate good code for some things. A very painful example from Ada's point of view is integer overflow checking. On many machines this can be done efficiently but GCC does not know how (yes, it should be taught, it is on our list :-)

So if someone wanted to have efficient integer overflow
checking they would have to use ASM inserts, and in such
a case, they do want full optimization (providing that
GCC can do it correctly :-)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]