https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127239
Drea Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Keywords| |easyhack
Status|UNCONFIRMED |NEW
Last reconfirmed| |2026-09-07
--- Comment #1 from Drea Pinski <pinskia at gcc dot gnu.org> ---
The pattern is:
```
/* X % Y < Y -> Y >= 0
X % Y >= Y -> Y < 0 */
(for ltge (lt ge)
gelt (ge lt)
(simplify
(ltge:c (trunc_mod @0 @1) @1)
(gelt @1 { build_zero_cst (TREE_TYPE (@1)); })))
```
So for this it needs to becomes:
(ltge:c (nop_convert? (trunc_mod @0 (convert1?@2 @1))) (convert2?@3 @1))
if there is a nop conversion, then inner type of @1 needs to be unsigned and
extending.