PDA

View Full Version : sh4 delayed branches all parallel executing



NecroRomancist
February 22nd, 2006, 23:45
Hi.This is my first post on this forum so hi everyone.
I'm one of the developer working on dcemu and a couple of days back while i trying to run one demo which didn't work on dcemu.The reason why it didn't ran layed on a code like this

TST R1 R1
something
BTS the_address_of_TST
something
move stuff from a given address to R1

Does because of the superscalar nature of the sh4 the 2 instructions after a delayed branch always get executed?

PS - Sorry if this isn't the right place to be asking this :)

quzar
February 23rd, 2006, 02:03
no. even though the sh4 allows for multiple simultaneous opcode execution, it is smart enough not to let that happen with a delayed branch so that the asm can be written as normal. if you want to illicit that effect, the best way would be to do a jmp to another segment of code, and then execute two ops simultaneously (depending on the cycles of each of the ops of course).

That is my understanding of the way it works, but i've only written a little asm code, so I could be wrong.

fox68k
February 23rd, 2006, 11:24
Hi,

the BT/S instruction is "branch if T with delayed slot". This is, the following instruction to the BT/S is executed before the jump is evaluated and despiting the fact the jump is taken. If the jump is taken, the "move stuff from a given address to R1" will not be executed.

Cheers.