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]

Re: long long performance



> 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.






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