This is something I meant to do a long time ago but never got around to it. These instructions should be an improvement over the compare/fsel sequence we currently emit.
The semantics of the instructions as specified in the ISA match the semantics specified in the description of the nodes.
We will get the ISD::FMAXNUM/ISD::FMINNUM node if mark it as legal.
define dso_local float @testfmax_fast(float %a, float %b) { entry: %cmp = fcmp fast ogt float %a, %b %cond = select i1 %cmp, float %a, float %b ret float %cond }llc test.ll -mattr=+vsx
And also for the intrinsic llvm.minnum/llvm.maxnum.
Initial selection DAG: %bb.0 'testfmax_fast:entry' SelectionDAG has 11 nodes: t0: ch = EntryToken t2: f32,ch = CopyFromReg t0, Register:f32 %0 t4: f32,ch = CopyFromReg t0, Register:f32 %1 t6: i1 = setcc nnan ninf nsz arcp contract afn reassoc t2, t4, setgt:ch t7: f32 = fmaxnum t2, t4 t9: ch,glue = CopyToReg t0, Register:f32 $f1, t7 t10: ch = PPCISD::RET_FLAG t9, Register:f32 $f1, t9:1The node is built directly not combined by select_cc. And I think, we need to lower it if we know that, the operand is NaN or not(i.e. isKnownNeverNaN()).