This is the mail archive of the gcc-help@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]
Other format: [Raw text]

Re: 32 x 32 -> 64 bit widening multiply on x86_64


"Mark Dickinson" <dickinsm@gmail.com> writes:

> If I'm not mistaken, that imulq is a 64 x 64 -> 64 bit multiply; this
> seems inefficient, when a 32 x 32 -> 64 bit multiply ought to be
> good enough.  Is there a good reason for having a 64-bit multiply
> here?  Or is gcc just not in a good position to make this kind
> of optimization?

The problem with the 32 x 32 -> 64 bit widening multiply in 64-bit
mode is that it generates the result as two separate 32-bit values in
different registers.  In order to use the 64-bit value, gcc would have
to generate code to reassemble the two registers into one.  On balance
it's normally preferable to simply use the 64 x 64 -> 64 multiply.

Ian


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