This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: preprocessor: % as args to #defines
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.
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.
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com