This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: long long performance
- To: rob at e-critical dot com (Rob Willis)
- Subject: Re: long long performance
- From: Joe Buck <jbuck at racerx dot synopsys dot com>
- Date: Wed, 13 Dec 2000 14:40:51 -0800 (PST)
- Cc: gcc at gcc dot gnu dot org
> 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.
To do a long long multiply you have to do four 32x32->64 bit multiplies
(perhaps only 3 if you're doing 64x64->64, because you could then ignore
the hi_a*hi_b term) then you have to combine all of the terms, correctly
handling carries, signs, etc. Furthermore, a single multiply instruction
is going to get pipelined much better than a call that uses lots of
registers to hold all the partial results. A 13x penalty is about what to
expect. If critical, this penalty could probably be shaved back, and if
you know that your numbers are positive, the unsigned long long routine is
probably a bit faster (no special testing to deal with the sign), though
not by much.