https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126956
Bug ID: 126956
Summary: cond_carry_add and cond_carry_add_neg could use :c on
the comparison
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Keywords: internal-improvement
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
Currently these does:
```
(if (INTEGRAL_TYPE_P (type)
&& TYPE_UNSIGNED (type)
&& type_has_mode_precision_p (type))
(match (cond_carry_add @0 @1 @2 @3)
(cond^ (gt @0 @1) (plus @2 integer_pow2p@3) @2))
(match (cond_carry_add @0 @1 @2 @3)
(cond^ (lt @1 @0) (plus @2 integer_pow2p@3) @2))
(match (cond_carry_add_neg @0 @1 @2 @3)
(cond^ (le @0 @1) @2 (plus @2 integer_pow2p@3)))
(match (cond_carry_add_neg @0 @1 @2 @3)
(cond^ (ge @1 @0) @2 (plus @2 integer_pow2p@3))))
```
But this simplifies to just:
```
(if (INTEGRAL_TYPE_P (type)
&& TYPE_UNSIGNED (type)
&& type_has_mode_precision_p (type))
(match (cond_carry_add @0 @1 @2 @3)
(cond^ (gt:c @0 @1) (plus @2 integer_pow2p@3) @2))
(match (cond_carry_add_neg @0 @1 @2 @3)
(cond^ (le:c @0 @1) @2 (plus @2 integer_pow2p@3)))
```