The 'ord' and 'uno' predicates have a logic operation for NAN built into their definitions:

FCMP_ORD = 7, ///< 0 1 1 1 True if ordered (no nans) FCMP_UNO = 8, ///< 1 0 0 0 True if unordered: isnan(X) | isnan(Y)

So we can simplify patterns like this:

(fcmp ord NNAN, X) && (fcmp ord X, Y) --> fcmp ord X, Y (fcmp uno NNAN, X) || (fcmp uno X, Y) --> fcmp uno X, Y