linux-mips
[Top] [All Lists]

Re: how does these two instruction mean?

To: "Herbert Valerio Riedel" <hvr@gnu.org>
Subject: Re: how does these two instruction mean?
From: "Bin Chen" <binary.chen@gmail.com>
Date: Fri, 26 May 2006 15:49:52 +0800
Cc: linux-mips@linux-mips.org
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=RjD3o4iu6EJiykMAkpceS/9nZkWgLFNEUlCsrTMoL694o9ImX/9WMkr3R92QThToQn4bWWtOHaCeCVcvQWtEe3M84gc21MD2JXALoq5otWy+FmKyaoTfUn1dHUB2c1cVNJW85ZCAlQoOe3ziIGayl5NPjZ5RoMFsLd3EFJJ69Fc=
In-reply-to: <1148628040.2150.5.camel@localhost.localdomain>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <5800c1cc0605252319l1fe2954amcd649fd4798259a2@mail.gmail.com> <1148628040.2150.5.camel@localhost.localdomain>
Sender: linux-mips-bounce@linux-mips.org
What is dumb-mode?

On 5/26/06, Herbert Valerio Riedel <hvr@gnu.org> wrote:
On Fri, 2006-05-26 at 14:19 +0800, Bin Chen wrote:
> In my program the gcc produce two lines of binary code:
>
> 100020e0:       ffc20000        sd      v0,0(s8)
> 100020e4:       dfc20000        ld      v0,0(s8)
>
> first store v0->[s8], then load from [s8]->v0, why?

without knowing the source-code that got compiled it's guessing...

and I'd guess that [s8] might have been marked as a volatile location
(assuming the compiler isn't set to dumb-mode wrt to optimization ;-)

e.g. a code like the following

extern int cb(void);

int set(volatile int *p)
{
  return *p = cb();
}

will lead to something similar to the fragment below (with s0 being the
pointer p):

[..]
  38:   ae020000        sw      v0,0(s0)
  3c:   8e020000        lw      v0,0(s0)
[..]

regards,
hvr


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)

iD8DBQBEdqxHSYHgZIg/QUIRAmLNAJ9aYiVRSnr9F4A+LhZOVB8pSCYL1ACeIq48
Q+6zs8VJ6u0iNAVUEsVBupE=
=iTAC
-----END PGP SIGNATURE-----




<Prev in Thread] Current Thread [Next in Thread>