On Thu, 8 Jul 2021, Richard Biener via Gcc-patches wrote:
> You made me lookup idiv and I figured we're not optimally
> handling
>
> int foo (long x, int y)
> {
> return x / y;
> }
>
> by using a 32:32 / 32 bit divide. combine manages to
> see enough to eventually do this though.We cannot do that in general because idiv will cause an exception if the signed result is not representable in 32 bits, but GCC defines signed conversions to truncate without trapping. Alexander
