https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114539
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |pinskia at gcc dot
gnu.org
Status|UNCONFIRMED |ASSIGNED
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=114538
Last reconfirmed| |2024-04-01
Ever confirmed|0 |1
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This is the current pattern that matches the non-CST case:
```
/* Testing for overflow is unnecessary if we already know the result. */
/* A - B > A */
(for cmp (gt le)
out (ne eq)
(simplify
(cmp:c (realpart (IFN_SUB_OVERFLOW@2 @0 @1)) @0)
(if (TYPE_UNSIGNED (TREE_TYPE (@0))
&& types_match (TREE_TYPE (@0), TREE_TYPE (@1)))
(out (imagpart @2) { build_zero_cst (TREE_TYPE (@0)); }))))
/* A + B < A */
(for cmp (lt ge)
out (ne eq)
(simplify
(cmp:c (realpart (IFN_ADD_OVERFLOW:c@2 @0 @1)) @0)
(if (TYPE_UNSIGNED (TREE_TYPE (@0))
&& types_match (TREE_TYPE (@0), TREE_TYPE (@1)))
(out (imagpart @2) { build_zero_cst (TREE_TYPE (@0)); }))))
```
Mine for GCC 15.