public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Manjunath S M <81matti@gmail.com>
To: gcc-help@gcc.gnu.org
Subject: Re: Inline Assembly Help
Date: Wed, 17 Mar 2010 06:20:00 -0000	[thread overview]
Message-ID: <27927993.post@talk.nabble.com> (raw)
In-Reply-To: <201003170126.01103.root@localhost>


Hi Brian,

I would like to tell you that your question has been answered in the GCC 
documentation for inline assembly.

Your first question related to operand numbering,

Operands corresponding to the C expressions are represented by %0, %1 ...
etc.
In the assembler template, each operand is referenced by numbers. 
Numbering is done as follows. If there are a total of n operands (both input
and output inclusive), 
then the first output operand is numbered 0, continuing in increasing order, 
and the last input operand is numbered n-1. 

Now getting back to your question, a single variable may serve as both the
input 
and the output operand.

Such cases may be specified in "asm" by using matching constraints. 
asm ("incl %0" :"=a"(var):"0"(var)); 

For more information on the same kindly refer 
http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html

Regards
Manjunath S M


Brian O'Mahoney-4 wrote:
> 
> A very simple question, but no-where explicitly documented, when using 
> extended assembly, how are operand numbers ie %n relate to input and
> output 
> constraint-lists ?
> 
> Do they independently count from zero, in each constraint list? What if an 
> operand is in & out put?
> 
> Thanks, Brian
> 
> -- 
> Greetings (mit freundlichen Grüßen), Brian.
> 
> Dr. Brian O'Mahoney Email: omb@teraflex.ch
> 
> 

-- 
View this message in context: http://old.nabble.com/Inline-Assembly-Help-tp27926516p27927993.html
Sent from the gcc - Help mailing list archive at Nabble.com.

  reply	other threads:[~2010-03-17  6:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-17  6:16 Brian O'Mahoney
2010-03-17  6:20 ` Manjunath S M [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-04-18 18:58 Inline assembly help James Philbin
2000-01-01 12:16 inline " johnnydoeslinux
2000-04-01  0:00 ` johnnydoeslinux

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=27927993.post@talk.nabble.com \
    --to=81matti@gmail.com \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).