setbc
Set Boolean Condition
setbc RT, BI
Sets RT to 1 if CR bit is set, else 0. (Branchless logic).
Encoding
Binary Layout
31
0:5
RT
6:10
BI
11:15
/
16:20
384
21:30
/
31
Operands
-
RT
Target -
BI
CR Bit
Reference
View in PowerISA v3.1C Specification ↗
OPF Power ISA v3.1C
Description
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.
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.