setbc

Set Boolean Condition

setbc RT, BI

Sets RT to 1 if CR bit is set, else 0. (Branchless logic).

Details

The setbc instruction sets the register RT to 1 if the specified bit BI in the Condition Register (CR) is 1, otherwise it sets RT to 0.

Pseudocode Operation

RT ← (CRBI = 1) ? 1 : 0

Programming Note

The setbc instruction is useful for conditionally setting a register based on the state of a specific bit in the Condition Register. Ensure that the correct bit index BI is specified to avoid unintended behavior. This instruction operates at user privilege level and does not generate exceptions under normal conditions.

Example

setbc r3, 0

Encoding

Binary Layout
31
0
RT
6
BI
11
/
16
384
21
/
31
 
Format X-form
Opcode 0x7C000300
Extension Base
Registers Altered CR

Operands

  • RT
    Target
  • BI
    CR Bit