Conditionally branches to the address contained within the Count Register.
PowerPC | |
---|---|
bcctr | BO,BI |
bcctrl | BO,BI |
POWER | |
---|---|
bcc | BO,BI |
bccl | BO,BI |
See "Extended Mnemonics of Branch Instructions" for more information.
The bcctr and bcc instructions conditionally branch to an instruction specified by the branch target address contained within the Count Register. The branch target address is the concatenation of Count Register bits 0-29 and b'00'.
The bcctr and bcc instructions have two syntax forms. Each syntax form has a different effect on the Link bit and Link Register.
Syntax Form | Absolute Address Bit (AA) | Fixed-Point Exception Register | Link Bit (LK) | Condition Register Field 0 |
bcctr | None | None | 0 | None |
bcctrl | None | None | 1 | None |
bcc | None | None | 0 | None |
bccl | None | None | 1 | None |
The two syntax forms of the bcctr and bcc instructions never affect the Fixed-Point Exception Register or Condition Register Field 0. If the Link bit is 1, then the effective address of the instruction following the branch instruction is placed into the Link Register.
The Branch Option field (BO) is used to combine different types of branches into a single instruction. Extended mnemonics are provided to set the Branch Option field automatically.
The encoding for the BO field is defined in PowerPC Architecture. The following list gives brief descriptions of the possible values for this field:
In the PowerPC Architecture, the z bit denotes a bit that must be 0. If the bit is not 0, the instruction form is invalid.
In the PowerPC Architecture, the y bit provides a hint about whether a conditional branch is likely to be taken. The value of this bit can be either 0 or 1. The default value is 0.
In the POWER Architecture, the z and y bits can be either 0 or 1.
The following code branches from a specific address, dependent on a bit in the Condition Register, to the address contained in the Count Register:
bcctr 0x4,0 cror 31,31,31 # Branch occurs if LT bit in the Condition Register is 0. # The branch will be to the address contained in # the Count Register. bcctrl 0xC,1 return: cror 31,31,31 # Branch occurs if GT bit in the Condition Register is 1. # The branch will be to the address contained in # the Count Register. # The Link register now contains the address of return.