Re: Single asm instruction

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

 



On Mon, Feb 03, 2003 at 04:46:28PM +0200, Gilad Benjamini wrote:
> AFAIK, embedded assembly code (__asm) can not be optimized by the
> compiler.

It can't be optimised away, but register and memory usage can be
optimised.

> I heard through the grapevine that you can embed a single assembly
> instruction,
> using a "__" prefix, and in this case the compiler CAN optimize. The
> code.
> Is this correct ?

No.

> What's the exact syntax ?

__asm__ ( "asm code" : "input variables" : "output variables" : "clobber" );

> Where is this documented ?

The gcc info pages (try tkinfo or pinfo, they're better info readers
than info). Also be sure to check the links section on
kernelnewbies.org, we have a couple of links to inline assembly.

BIG FAT WARNING: Try to avoid assembly! It makes your code non-portable
and hard to maintain!


Erik

-- 
J.A.K. (Erik) Mouw
Email: J.A.K.Mouw@its.tudelft.nl  mouw@nl.linux.org
WWW: http://www-ict.its.tudelft.nl/~erik/

Attachment: pgp00284.pgp
Description: PGP signature


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux