This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: preprocessor: % as args to #defines
On Jan 29, 2004, at 12:50 PM, Jim Wilson wrote:
inline asms can be replaced with intrinsics (built-in functions) with
no significant loss of functionality. We may even gain functionality
in some cases, because we may be able to optimize intrinsics better
than inline asms. inline asms are a black box, but we know exactly
what an intrinsic does.
This places a burden on the compiler writer, since we need an
intrinsic for every instruction that the end user might want to use,
which means we may need hundreds of intrisics. However, this makes
things easier for users, since intrinsics are much easier to use than
inline asms.
I am working on adding PowerPC intrinsics to GCC as we speak...
The Intel IA-64 compiler does not support inline asm, but it is able
to compile the linux kernel, because it defines an intrinsic for
almost every instruction. The IA-64 linux kernel calls the intrinsics
directly, and then if compiled by gcc, it uses inline asm to implement
the intrinsics.
The main disadvantage I see of intrinsics is that it makes it easier
for other compilers to replace gcc. Currently, anyone using gcc
inline asm is captive to gcc, because no other compiler can reasonably
implement it. This isn't a very good argument for it though. And we
have already lost one major captive, the linux kernel.
Also, another disadvantage is that people who insist on embedding
assembly code in C, despite compiler experts telling them not to, will
not be happy with intrinsics. You can't get your hands dirty writing
intrinsics, like you can when you write inline asm.
We have customers who want each, with some overlap.
Syd Polk
Apple Computer
Technology EPM, Mac OS X Development Tools
+1 408 974-0577