Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: "Mike Uhler" <uhler@mips.com>
To: justinca@cs.cmu.edu
Cc: linux-mips@linux-mips.org
Cc: uhler@mips.com
Subject: Re: [OT] Re: unaligned load in branch delay slot
Date: Tue, 28 Jan 2003 13:39:48 -0800	[thread overview]
Message-ID: <200301282139.h0SLdmf29392@uhler-linux.mips.com> (raw)
In-Reply-To: Your message of "28 Jan 2003 16:30:09 EST." <1043789409.23571.12.camel@gs256.sp.cs.cmu.edu>

> On Tue, 2003-01-28 at 14:48, Mike Uhler wrote:
> 
> > If the patch assumes that one can look backward by one instruction
> > in the STATIC code to determine if the instruction is in a
> > delay slot, one can not have code that jumps directly to the
> > instruction following another branch, as this would cause the
> > code to assume that it was in the delay slot of the branch.
> 
> A while back, when working on a different architecture that also had
> branch delay slots, it took me a while to get my head around the
> branch-in-a-delay-slot case, e.g.
> 
> 
> 10:  b 100
> 20:  b 30
> 30:  foo
> ...
> 100: bar
> 
> where the actual program flow would be
> 
> 10
> 20
> 100
> 30
> 
> and instruction 100 would be considered to be in the delay slot of 20.
> 
> I was *very* happy when I first looked at MIPS to see that this was 
> specified as unpredictable, even if it was pretty cool to be able to
> make the CPU execute a single instruction in the middle of nowhere. 
> Pointless, but cool.  :)

I presume that you're talking about Sparc, where such a construct is
used to execute a single instruction out of a table.  This is, in
fact, very, very unpredictable on a MIPS implementation, ranging from
reserved instruction, to branching to one of the two branch targets,
to wandering off into hyperspace.  So please do not assume that because
a particular implementation does something that all implementations
do the same thing. In this particular case, I can guarantee you that
you won't like the answer you get.

/gmu

-- 

  =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
  Michael Uhler, VP, Systems, Architecture, and Software Products 
  MIPS Technologies, Inc.   Email: uhler@mips.com   Pager: uhler_p@mips.com
  1225 Charleston Road      Voice:  (650)567-5025   FAX:   (650)567-5225
  Mountain View, CA 94043   Mobile: (650)868-6870   Admin: (650)567-5085

WARNING: multiple messages have this Message-ID (diff)
From: "Mike Uhler" <uhler@mips.com>
To: justinca@cs.cmu.edu
Cc: linux-mips@linux-mips.org, uhler@mips.com
Subject: Re: [OT] Re: unaligned load in branch delay slot
Date: Tue, 28 Jan 2003 13:39:48 -0800	[thread overview]
Message-ID: <200301282139.h0SLdmf29392@uhler-linux.mips.com> (raw)
Message-ID: <20030128213948.mRIfKnpcPJyFKYdZAitELlI3VqRJUv6l6rjRPNWijzQ@z> (raw)
In-Reply-To: Your message of "28 Jan 2003 16:30:09 EST." <1043789409.23571.12.camel@gs256.sp.cs.cmu.edu>

> On Tue, 2003-01-28 at 14:48, Mike Uhler wrote:
> 
> > If the patch assumes that one can look backward by one instruction
> > in the STATIC code to determine if the instruction is in a
> > delay slot, one can not have code that jumps directly to the
> > instruction following another branch, as this would cause the
> > code to assume that it was in the delay slot of the branch.
> 
> A while back, when working on a different architecture that also had
> branch delay slots, it took me a while to get my head around the
> branch-in-a-delay-slot case, e.g.
> 
> 
> 10:  b 100
> 20:  b 30
> 30:  foo
> ...
> 100: bar
> 
> where the actual program flow would be
> 
> 10
> 20
> 100
> 30
> 
> and instruction 100 would be considered to be in the delay slot of 20.
> 
> I was *very* happy when I first looked at MIPS to see that this was 
> specified as unpredictable, even if it was pretty cool to be able to
> make the CPU execute a single instruction in the middle of nowhere. 
> Pointless, but cool.  :)

I presume that you're talking about Sparc, where such a construct is
used to execute a single instruction out of a table.  This is, in
fact, very, very unpredictable on a MIPS implementation, ranging from
reserved instruction, to branching to one of the two branch targets,
to wandering off into hyperspace.  So please do not assume that because
a particular implementation does something that all implementations
do the same thing. In this particular case, I can guarantee you that
you won't like the answer you get.

/gmu

-- 

  =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
  Michael Uhler, VP, Systems, Architecture, and Software Products 
  MIPS Technologies, Inc.   Email: uhler@mips.com   Pager: uhler_p@mips.com
  1225 Charleston Road      Voice:  (650)567-5025   FAX:   (650)567-5225
  Mountain View, CA 94043   Mobile: (650)868-6870   Admin: (650)567-5085

  reply	other threads:[~2003-01-28 21:40 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-13 16:13 unaligned load in branch delay slot Geert Uytterhoeven
2003-01-13 17:19 ` Mike Uhler
2003-01-13 17:19   ` Mike Uhler
2003-01-13 18:04   ` Geert Uytterhoeven
2003-01-13 20:12     ` Mike Uhler
2003-01-13 20:12       ` Mike Uhler
2003-01-28  2:39     ` Ralf Baechle
2003-01-28  9:30       ` Geert Uytterhoeven
2003-01-28 11:47         ` Ralf Baechle
2003-01-28 12:27           ` Geert Uytterhoeven
2003-01-29  1:39             ` Brad Parker
2003-01-29  6:40               ` Ralf Baechle
2003-01-28 12:30           ` Maciej W. Rozycki
2003-01-28 12:54             ` Ralf Baechle
2003-01-28 17:53 ` Jun Sun
2003-01-28 19:48   ` Mike Uhler
2003-01-28 19:48     ` Mike Uhler
2003-01-28 21:30     ` [OT] " justinca
2003-01-28 21:39       ` Mike Uhler [this message]
2003-01-28 21:39         ` Mike Uhler
2003-01-29 14:25     ` Ralf Baechle

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=200301282139.h0SLdmf29392@uhler-linux.mips.com \
    --to=uhler@mips.com \
    --cc=justinca@cs.cmu.edu \
    --cc=linux-mips@linux-mips.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