https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125484
--- Comment #2 from Drea Pinski <pinskia at gcc dot gnu.org> ---
The other option here is the min/max patterns use the ranger to figure out if
it can be NAN.
Right now it is based on the type. not inputs:
```
(for cmp (eq ne le lt unle unlt ge gt unge ungt uneq ltgt)
(simplify
(cond (cmp:c (nop_convert1?@c0 @0) (nop_convert2?@c1 @1))
(convert3? @0) (convert4? @1))
(if (!HONOR_SIGNED_ZEROS (type)
&& (/* Allow widening conversions of the compare operands as data. */
(INTEGRAL_TYPE_P (type)
&& types_match (TREE_TYPE (@c0), TREE_TYPE (@0))
&& types_match (TREE_TYPE (@c1), TREE_TYPE (@1))
&& TYPE_PRECISION (TREE_TYPE (@0)) <= TYPE_PRECISION (type)
&& TYPE_PRECISION (TREE_TYPE (@1)) <= TYPE_PRECISION (type))
/* Or sign conversions for the comparison. */
|| (types_match (type, TREE_TYPE (@0))
&& types_match (type, TREE_TYPE (@1)))))
(switch
(if (cmp == EQ_EXPR)
(if (VECTOR_TYPE_P (type))
(view_convert @c1)
(convert @c1)))
(if (cmp == NE_EXPR)
(if (VECTOR_TYPE_P (type))
(view_convert @c0)
(convert @c0)))
(if (cmp == LE_EXPR || cmp == UNLE_EXPR || cmp == LT_EXPR || cmp ==
UNLT_EXPR)
(if (!HONOR_NANS (type))
(if (VECTOR_TYPE_P (type))
(view_convert (min @c0 @c1))
(convert (min @c0 @c1)))))
(if (cmp == GE_EXPR || cmp == UNGE_EXPR || cmp == GT_EXPR || cmp ==
UNGT_EXPR)
(if (!HONOR_NANS (type))
(if (VECTOR_TYPE_P (type))
(view_convert (max @c0 @c1))
(convert (max @c0 @c1)))))
(if (cmp == UNEQ_EXPR)
(if (!HONOR_NANS (type))
(if (VECTOR_TYPE_P (type))
(view_convert @c1)
(convert @c1))))
(if (cmp == LTGT_EXPR)
(if (!HONOR_NANS (type))
(if (VECTOR_TYPE_P (type))
(view_convert @c0)
(convert @c0))))))))
```
I wonder if we could change `HONOR_NANS (type)` to be `!can_be_nan (@0) &&
!can_be_nan (@1)`.