https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103855
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2021-12-29 Ever confirmed|0 |1 Severity|normal |enhancement --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- convert.c (convert_to_integer_1 <case TRUNC_DIV_EXPR>) is where it is done for the optimized case. You might be able to something similar in match.pd Something like: (simplify (convert1 (trunc_div (convert2 @0) (convert2 @1))) (if (.....