This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [GCC] x86 optimizer suggestion


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~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]