This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: preprocessor: % as args to #defines
Andrew Pinski wrote:
On Jan 29, 2004, at 10:55, Syd Polk wrote:
It seems that most of Apple's customers do not agree at all; most
major Macintosh software vendors have many many lines of inline
assembly in their source files. It is one of the big preventers of
GCC adoption in the Apple world.
I wished GCC never supplied an inline-asm because it causes so much
problems in that
it can cause seg faults when you are using %c0 or some other operand
character which
does not work for your case, there are three different bugs for this on
three different
targets. The idea of using a compiler is to have the compiler optimize
for you, if the
compiler does not, then either drop the compiler, improve it, or write
full asm.
I have to wade in here. Inline assembler is an easy thing to abuse but
it is an incredibly useful and powerful thing when use judiciously.
RTEMS has VERY few pure assembly files because we have macros to
let you do tings like enable/disable interrupts and access processor
special registers. We do not attempt to write context switches
in inline-asm.
And I would never attempt to beat the compiler at its own game
with it trying to hand optimize. And I have reject code which
has too much or the wrong type of assembly language.
Inline-asm to gcc basically gives the information for the machine
descriptions to the user
which is a bad thing.
I agree that it exposes gcc machine descriptions which is weird
in that those are internal and hard to grok as a user writing
inline assembly.
I have to agree with Zack here that most of the problems come from
people abusing inline-asm
too much problems for people to use with more than one asm instructions
as most of gcc does
not understand really that the asm is really more than one instruction
(yes parts of it does
but the problems that come with thins like this:
asm("lots of
asm":"=r"(x0),"=r"(x1),"=r"(x2),"=r"(x3),"=r"(x4),"=r"(x5):"r"(y0),"r"(y
1),"r"(y2),"r"(y3),"r"(y4),"r"(y5));
people do not why this fails on targets like x86 which does not have
enough registers to fill
all those constraints. There are others things like this happens a lot
in people's code.
Also glibc has ugly (I mean ugly) inline-asm in their headers for some
string and math
functions (at least on x86).
I agree the above is quite abusive. But getting to special math
instructions and being able to inline them is a powerful speedup.
Inlining a 50 instruction memcpy wouldn't make that type of cut to
me.
Some of the code in the gdb stubs looks like even worse to me.
Thanks,
Andrew Pinski
a gcc bug master (and not speaking for Apple at all)
(go ahead .. speak for Apple) :)
--joel