[Top] [All Lists]

Re: how does these two instruction mean?

To: Bin Chen <>
Subject: Re: how does these two instruction mean?
From: Herbert Valerio Riedel <>
Date: Fri, 26 May 2006 09:20:40 +0200
In-reply-to: <>
Organization: Free Software Foundation
Original-recipient: rfc822;
References: <>
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)


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

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