On Thu, Jul 8, 2021 at 10:25 AM Roger Sayle wrote:
>
>
> This patch tweaks the way GCC handles 32-bit integer division on
> x86_64, when the numerator is constant. Currently the function
>
> int foo (int x) {
> return 100/x;
> }
>
> generates the code:
> foo:movl$100, %eax
> clt
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 d
On Thu, Jul 8, 2021 at 10:25 AM Roger Sayle wrote:
>
>
> This patch tweaks the way GCC handles 32-bit integer division on
> x86_64, when the numerator is constant. Currently the function
>
> int foo (int x) {
> return 100/x;
> }
>
> generates the code:
> foo:movl$100, %eax
> clt
This patch tweaks the way GCC handles 32-bit integer division on
x86_64, when the numerator is constant. Currently the function
int foo (int x) {
return 100/x;
}
generates the code:
foo:movl$100, %eax
cltd
idivl %edi
ret
where the sign-extension instruction