Encoding:

COP2

010010

BC2EQZ

01001

ct

offset

COP2

010010

BC2NEZ

01101

ct

offset

6

5

5

16

Format:

BC2EQZ BC2NEZ 

Branch if Coprocessor 2 Condition (Register) is Equal to Zero

BC2EQZ ct, offset

MIPS32 Release 6

Branch if Coprocessor 2 Condition (Register) is Equal to Zero

BC2NEZ ct, offset

MIPS32 Release 6

Branch if Coprocessor 2 Condition (Register) is Not Equal to Zero

Purpose:

Branch if Coprocessor 2 Condition (Register) Equal/Not Equal to Zero

BC2EQZ: Branch if Coprocessor 2 Condition (Register) is Equal to Zero

BC2NEZ: Branch if Coprocessor 2 Condition (Register) is Not Equal to Zero

Description:

BC2EQZ:  if COP2Condition[ct] = 0 then branch
BC2NEZ:  if COP2Condition[ct] != 0 then branch

The 5-bit field ct specifies a coprocessor 2 condition.

A 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), to form a PC-relative effective target address. Execute the instruction in the delay slot before the instruction at the target.

Restrictions:

Control Transfer Instructions (CTIs) should not be placed in branch delay slots or Release 6 forbidden slots. CTIs

include all branches and jumps, NAL, ERET, ERETNC, DERET, WAIT, and PAUSE.

If a control transfer instruction (CTI) is executed in the delay slot of a branch or jump, Release 6 implementations are required to signal a Reserved Instruction exception.

If access to Coprocessor 2 is not enabled, a Coprocessor Unusable Exception is signaled.

Availability and Compatibility:

These instructions are introduced by and required as of Release 6.

Exceptions:

Coprocessor Unusable, Reserved Instruction

Operation:

   tmpcond = Coprocessor2Condition(ct)
   if BC2EQZ then 
    tmpcond = not(tmpcond)
   endif
   if tmpcond then
      PC = PC+4 + sign_extend( immediate << 2 ) )
   endif

Implementation Notes:

As of Release 6 these instructions, BC2EQZ and BC2NEZ, replace the pre-Release 6 instructions BC2F and BC2T, which had a 3-bit condition code field (as well as nullify and true/false bits). Release 6 makes all 5 bits of the ct condition code available to the coprocessor designer as a condition specifier.

A customer defined coprocessor instruction set can implement any sort of condition it wants. For example, it could implement up to 32 single-bit flags, specified by the 5-bit field ct. It could also implement conditions encoded as values in a coprocessor register (such as testing the least significant bit of a coprocessor register) as done by Release

6 instructions BC1EQZ/BC1NEZ.