isel
Integer Select
isel RT, RA, RB, BC
Conditionally copies RA or RB to RT based on a CR bit. (Equivalent to C ternary operator 'cond ? a : b').
Details
Conditionally selects between RA and RB based on the value of a single bit in the Condition Register, writing the result to RT. If the CR bit BC is 1, RT ← RA (or 0 if RA=0); otherwise RT ← RB. This provides a branch-free ternary operation.
Pseudocode Operation
BIT ← CR[BC]
if BIT = 1 then
RT ← (RA)
else
RT ← (RB)
Programming Note
isel is used for conditional moves based on the condition register.
Extended Mnemonics
| Extended Mnemonic | Equivalent Instruction |
|---|---|
| iselgt | |
| iseleq | |
| isellt |
Example
isel r3, r4, r5, 2
// r3 = (CR.eq) ? r4 : r5
Encoding
Binary Layout
31
0
RT
6
RA
11
RB
16
BC
21
15
26
/
31
Operands
-
RT
Target Register -
RA
Source (If True) - 0 means 0 -
RB
Source (If False) -
BC
CR Bit Index (Condition) -
CR
Condition Register Field