[GCC] x86 optimizer suggestion

Richard Henderson rth@redhat.com
Tue Jun 17 09:11:00 GMT 2003


On Mon, Jun 16, 2003 at 10:35:34PM -0400, Tom St Denis wrote:
> unsigned long long t, w;
> unsigned long b;
> 
>        t = w / b;
>        w = w % b;
...
> If I am not mistaken the x86 series [from 80386 and up] has a 64x32 
> division instruction DIV which will divide EDX:EAX by another regmem 
> value.

Yes, but it produces a 32-bit result, not a 64-bit result as
indicated here.  Which means you'd get the wrong result for

	0x4_0000_0000 / 2


r~



More information about the Gcc mailing list