开发者

Does mips branch delay slots propagates through successive branches?

开发者 https://www.devze.com 2023-01-27 11:49 出处:网络
I was playing around with branch delay slots. Tried that on spim. j some j a j b j c j d ori $9, $0, 13

I was playing around with branch delay slots. Tried that on spim.

j some
j a 
j b 
j c 
j d 
ori $9, $0, 13

some:
a:  
b:  
c:  
d:  

For my surprise it changed the $9 to 13. So my question is can 开发者_Python百科a delay slot propagate or this is a spim thing and doesn't happen on real mips32 processors? If this is the expected behavior can someone give me a little enlightenment on what's happening there?


Mips states that placing branch instruction in to a branch delay slot leads to undefined results.


As a disclaimer, I've never worked with a real MIPS machine, but I imagine that using a branch delay slot for another branch will almost certainly cause problems. One common practice on processors like MIPS is to use the branch delay slot for a no-op, such as ori $0, $0, 0, just to make sure that nothing executes that isn't supposed to.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号