This is the mail archive of the
mailing list for the libstdc++ project.
Re: long long performance
- To: Rob Willis <rob at e-critical dot com>
- Subject: Re: long long performance
- From: Benjamin Kosnik <bkoz at redhat dot com>
- Date: Wed, 13 Dec 2000 14:14:52 -0800 (PST)
- cc: "Josh M. Osborne" <stripes at eng dot us dot uu dot net>, libstdc++ at sources dot redhat dot com, rth at cygnus dot com
sorry for the delay. This thread came up in a private discussion between
various maintainers, and the I believe the resulting discussion ended
with "known problem with codegen" and "want to teach compiler to return
in multiple registers" being the wish list.
> 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
> "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.
> Rob Willis