https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110490
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- I was wrong about where the problem was but not wrong about the missed optimization. Anyways the issue is in expression_expensive_p where the issue of clzdi2 and not having clzsi2 ... expression_expensive_p should check if you can do a widening of the mode ...