![](http://datasheet.mmic.net.cn/230000/79RC32438-200BB_datasheet_15568909/79RC32438-200BB_581.png)
IDT
Instruction Set
79RC32355 User Reference Manual
A - 31
November 4, 2002
Notes
BGEZAL
Format:
BGEZAL rs, offset
MIPS32
Purpose:
To test a GPR then do a PC-relative conditional procedure call
Description:
if rs
≥
0 then procedure_call
Place the return address link in GPR
31. The return link is the address of the second instruction
following the branch, where execution continues after a procedure call.
An 18-bit signed offset (the 16-bit
offset
field shifted left 2 bits) is added to the address of the
instruction following the branch (not the branch itself), in the branch delay slot, to form a PC-rela-
tive effective target address.
If the contents of GPR
rs
are greater than or equal to zero (sign bit is 0), branch to the effective
target address after the instruction in the delay slot is executed.
Restrictions:
Processor operation is
UNPREDICTABLE
if a branch, jump, ERET, DERET, or WAIT instruction
is placed in the delay slot of a branch or jump.
GPR 31 must not be used for the source register
rs
, because such an instruction does not have
the same effect when re-executed. The result of executing such an instruction is
UNPREDICT-
ABLE
. This restriction permits an exception handler to resume execution by re-executing the
branch when an exception occurs in the branch delay slot.
Operation:
I:
target_offset
←
sign_extend(offset || 0
2
)
condition
←
GPR[rs]
≥
0
GPRLEN
GPR[31]
←
PC + 8
if condition then
PC
←
PC + target_offset
endif
I+1:
Exceptions:
None
Programming Notes:
With the 18-bit signed instruction offset, the conditional branch range is ± 128 KBytes. Use jump
and link (JAL) or jump and link register (JALR) instructions for procedure calls to addresses out-
side this range.
BGEZAL r0, offset, expressed as BAL offset, is the assembly idiom used to denote a PC-relative
branch and link. BAL is used in a manner similar to JAL, but provides PC-relative addressing and
a more limited target PC range.
31
26 25
21 20
16 15
0
REGIMM
000001
rs
BGEZAL
10001
offset
6
5
5
16
Branch on Greater Than or Equal to Zero and Link
BGEZAL