fsel
Floating Select
fsel FRT,FRA,FRC,FRB
Selects FRA if FRC >= 0, else FRB (Optional).
Encoding
Binary Layout
63
0:5
FRT
6:10
FRA
11:15
FRB
16:20
FRC
21:25
23
26:30
/
31
Operands
-
FRT
Target -
FRA
True -
FRC
Cond -
FRB
False
Reference
View in PowerISA v3.1C Specification ↗
OPF Power ISA v3.1C
Description
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.
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.