https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98169
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- I guess the question is if we should consider == or ord as canonical form for the self-comparisons in GIMPLE, or shouldn't canonicalize at all. Ditto for != and unord. And depending whatever we choose make sure the targets emit optimal instructions for that. In match.pd we have: /* Simplify comparison of something with itself. For IEEE floating-point, we can only do some of these simplifications. */ (for cmp (eq ge le) (simplify (cmp @0 @0) (if (! FLOAT_TYPE_P (TREE_TYPE (@0)) || ! HONOR_NANS (@0)) { constant_boolean_node (true, type); } (if (cmp != EQ_EXPR) (eq @0 @0))))) (for cmp (ne gt lt) (simplify (cmp @0 @0) (if (cmp != NE_EXPR || ! FLOAT_TYPE_P (TREE_TYPE (@0)) || ! HONOR_NANS (@0)) { constant_boolean_node (false, type); }))) etc. rules, so if we e.g. decide that a ord a is canonical form of a == a, we'd need to add a (simplify (eq @0 @0) (if (FLOAT_TYPE_P (TREE_TYPE (@0)) && HONOR_NANS (@0)) (ordered @0 @0))). Note that we already canonicalize the ge and le to eq, which I'm not sure is correct, because a <= a should signal on qNaN but a == a will not.