linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Frank van Maarseveen <frankvm@frankvm.com>
To: linuxppc-dev@ozlabs.org
Subject: include/asm-ppc/atomic.h: fluff in inline assembly code?
Date: Wed, 29 Jun 2005 16:50:13 +0200	[thread overview]
Message-ID: <20050629145013.GA21494@janus> (raw)

Does anyone know why there are often excess arguments in asm() here?

For example,

	static __inline__ void atomic_add(int a, atomic_t *v)
	{
		int t;

		__asm__ __volatile__(
	"1:     lwarx   %0,0,%3         # atomic_add\n\
		add     %0,%2,%0\n"
		PPC405_ERR77(0,%3)
	"       stwcx.  %0,0,%3 \n\
		bne-    1b"
		: "=&r" (t), "=m" (v->counter)
		: "r" (a), "r" (&v->counter), "m" (v->counter)
		: "cc");
	}

seems equivalent to 

	static __inline__ void atomic_add(int a, atomic_t *v)
	{
		int t;

		__asm__ __volatile__(
	"1:     lwarx   %0,0,%2         # atomic_add\n\
		add     %0,%1,%0\n"
		PPC405_ERR77(0,%2)
	"       stwcx.  %0,0,%2 \n\
		bne-    1b"
		: "=&r" (t)
		: "r" (a), "r" (&v->counter)
		: "cc");
	}

What is the point of all those v->counter arguments?

-- 
Frank

             reply	other threads:[~2005-06-29 16:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-29 14:50 Frank van Maarseveen [this message]
2005-06-29 16:14 ` include/asm-ppc/atomic.h: fluff in inline assembly code? Andreas Schwab
2005-06-29 18:36   ` Frank van Maarseveen
2005-06-29 22:34     ` Andreas Schwab

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=20050629145013.GA21494@janus \
    --to=frankvm@frankvm.com \
    --cc=linuxppc-dev@ozlabs.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 NNTP newsgroup(s).