fsel

Floating Select

fsel FRT,FRA,FRC,FRB
fsel. FRT,FRA,FRC,FRB

Selects FRA if FRC >= 0, else FRB (Optional).

Details

Selects between FRA and FRB based on the sign of FRC: if FRC ≥ 0, the result is FRA; otherwise, the result is FRB. The optional dot (.) form sets CR1 based on the result's FPRF. This is an optional category instruction.

Pseudocode Operation

if FRC ≥ 0.0 then
  FRT ← FRA
else
  FRT ← FRB
if Rc = 1 then CR1 ← FPRF(FRT)

Programming Note

Warning: Care must be taken in using fsel if IEEE compatibility is required, or if the values being tested can be NaNs or infinities.

Example

fsel f1, f2, f4, f3

Encoding

Binary Layout
63
0
FRT
6
FRA
11
FRB
16
FRC
21
23
26
/
 
Format A-form
Opcode 0xFC00002E
Extension Floating-Point
Registers Altered CR1, FPSCR

Operands

  • FRT
    Target
  • FRA
    True
  • FRC
    Cond
  • FRB
    False