4.There are two functionally identical
Figure A–1: Branch-Format BSR and BR Opcodes
31 | 26 25 | 21 20 | 0 |
BSR
Ra
Displacement
Branch Format
BR
Ra
Displacement
Branch Format
Compilers should use the first one for subroutine calls, and the second for GOTOs. Some implementations may push a stack of predicted return addresses for BSR and not push the stack for BR. Failure to compile the correct opcode will result in mispredicted return addresses, and hence make subroutine returns slow.
5.The
Figure A–2: Memory-Format JSR Instruction
31 | 16 15 | 0 |
JSR
Ra
Rb
Memory Format
If the JSR is used for a computed GOTO or a CASE statement, compile bits <15:14> as 00, and bits <13:0> such that (updated PC+Instr<13:0>*4) <15:0> equals (likely_target_addr) <15:0>. In other words, pick the low 14 bits so that a normal PC+displacement*4 calculation will match the low 16 bits of the most likely target longword address. (Implementations will likely prefetch from the matching cache block.)
If the JSR is used for a computed subroutine call, compile bits <15:14> as 01, and bits <13:0> as above. Some implementations will prefetch the call target using the prediction and also push updated PC on a
If the JSR is used as a subroutine return, compile bits <15:14> as 10. Some implementations will pop an address off a
If the JSR is used as a coroutine linkage, compile bits <15:14> as 11. Some implementations will pop an address off a
Implementors should give first priority to executing
Software Considerations