setbc

Set Boolean Condition

setbc RT, BI

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

Details

Set register RT to 1 if the condition register bit identified by BI is set, else set RT to 0. This instruction provides a branchless way to materialize a boolean value from a condition register bit, useful for conditional assignment without branching.

Pseudocode Operation

if CR[BI] = 1 then
  RT ← 1
else
  RT ← 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