If any of the operands is NaN, return the operand instead of a new constant.
When the rhs operand is a constant, the second arith.cmpf+select ops will be folded away.
https://reviews.llvm.org/D117010 marks the two ops commutative, which will place the constant on the rhs.
Can you add a comment, why it suffices to check the rhs? Also, this is only true of the unordered comparisons are used. Maybe add an assert to make sure this is not changed.