This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: long long performance
- To: gcc at gcc dot gnu dot org
- Subject: Re: long long performance
- From: Rob Willis <rob at e-critical dot com>
- Date: Wed, 13 Dec 2000 14:02:21 -0800
- Organization: eCritical
Thanks for the info. Assuming the longlong multiply isnt too much more
complex, it still does not explain the 13x slower performance over that
of just a normal long mulitply. The timing on my P3/600 gave the
following (i've already subtracted out the overhead for the loop and
variable assignment):
All times are for 1 billion operations to complete.
long long mult: 33 secs
long mult: 2.4 secs
Which just seems wrong. And even worse is casting from a double to a
long or casting from a double to a long long, both give me the following
(again - i subtracted out the overhead times):
double cast to longlong: 87 secs
double cast to long: 87 secs
longlong cast to double: 3 secs
Something has to be broken here...
Has anyone else tried running the test case i attached in my original
email?
-Rob
"Josh M. Osborne" wrote:
>
> I didn't see any answers to this, so I'll take a stab at it.
>
> A 64 bit add can be built with two 32 bit adds, and a conditonal
> branch over an incrment.
>
> A 32 by 64 bit multiply can be done with two 32 bit multiplies and
> a 64 bit add.
>
> A 64 bit multiply is not as simple. I don't know the best algo for it
> off the top of my head (I havn't had to code an extened multiply for
> almost 10 years).
>
> >I was considering taking advantage of the "long long" type, but now i'm
> >not sure if that is a good idea.
>
> If you need 64 bit values, you probbably won't do any faster then the
> compiler.