Re: how does these two instruction mean?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux