linux-mips
[Top] [All Lists]

Re: how does these two instruction mean?

To: Bin Chen <binary.chen@gmail.com>
Subject: Re: how does these two instruction mean?
From: Herbert Valerio Riedel <hvr@gnu.org>
Date: Fri, 26 May 2006 09:20:40 +0200
Cc: linux-mips@linux-mips.org
In-reply-to: <5800c1cc0605252319l1fe2954amcd649fd4798259a2@mail.gmail.com>
Organization: Free Software Foundation
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <5800c1cc0605252319l1fe2954amcd649fd4798259a2@mail.gmail.com>
Sender: linux-mips-bounce@linux-mips.org
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

Attachment: signature.asc
Description: This is a digitally signed message part

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