This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author loewis
Recipients christian.heimes, collinwinter, gregory.p.smith, jyasskin, loewis, mark.dickinson, pitrou, schuppenies, vstinner
Date 2009-02-17.20:23:46
SpamBayes Score 0.0046495437
Marked as misclassified No
Message-id <1234902228.78.0.120446455865.issue4258@psf.upfronthosting.co.za>
In-reply-to
Content
Has any conclusion been reached wrt. overhead of 30-bit multiplication
on 32-bit systems? IIUC, the single-digit multiplication is equivalent
to the C program

unsigned long long m(unsigned long long a, unsigned long b)
{
        return a*b;
}

(i.e. one digit is cast into two digits, and multiplied with the other
one). gcc 4.3.3, on x86, compiles this into

        movl    12(%esp), %eax
        movl    8(%esp), %ecx
        imull   %eax, %ecx
        mull    4(%esp)
        leal    (%ecx,%edx), %edx
        ret

In pseudo-code, this is

        tmp = high_a * b;
        high_res:low_res = low_a * b;
        high_res += tmp

So it does use two multiply instructions (plus an add), since one
argument got cast into 64 bits.

VS2008 compiles it into

	push	eax
	push	ecx
	push	0
	push	edx
	call	__allmu

i.e. it widens both arguments to 64 bits, then calls a library routine.
History
Date User Action Args
2009-02-17 20:23:49loewissetrecipients: + loewis, collinwinter, gregory.p.smith, mark.dickinson, pitrou, vstinner, christian.heimes, jyasskin, schuppenies
2009-02-17 20:23:48loewissetmessageid: <1234902228.78.0.120446455865.issue4258@psf.upfronthosting.co.za>
2009-02-17 20:23:47loewislinkissue4258 messages
2009-02-17 20:23:47loewiscreate