GO $X,$Y,Z |
GO $X,$Y,$Z |
Specification:
u($X) | ← @+4 |
@ | ← $Y + Z |
Timing:
3υ
Description:
Unconditional jump to Address $Y+$Z, respectively $Y+Z. The target address is rounded down to a multiple of 4. The address of the next instruction is stored as return address in $X. The instruction can be used to link subroutines or coroutines.
GO: | MMIX takes its next instruction from location $Y + $Z or $Y + Z, and continues from there. Register $X is set equal to λ + 4, the location of the instruction that would ordinarily have been executed next. (GO is similar to a jump, but it is not relative to the current location. Since GO has the same format as a load or store instruction, a loading routine can treat program labels with the same mechanism that is used to treat references to data.) An old-fashioned type of subroutine linkage can be implemented by saying either "GO r,subloc,0" or "GETA r,@+8; JMP Sub" (The Symbol @ is interpreted by the assembler as an abbreviation for "the location of the current instruction.") to enter a subroutine, then "GO r,r,0" to return. But subroutines are normally entered with the instructions PUSHJ or PUSHGO. The two least significant bits of the address in a GO command are essentially ignored. They will, however, appear in the value of λ returned by GETA instructions, and in the return-jump register rJ after PUSHJ or PUSHGO instructions are performed, and in the where-interrupted register at the time of an interrupt. Therefore they could be used to send some kind of signal to a subroutine or (less likely) to an interrupt handler. |
See also: