Choosing the best multiplication
Paulo J. Matos
pocmatos@gmail.com
Sat Sep 25 14:43:00 GMT 2010
Paolo Bonzini <bonzini@gnu.org> writes:
> On 09/24/2010 10:10 AM, Paulo J. Matos wrote:
>
> You can use mul<mode>3 for non-widening multiplication, which would
> always use smult, and {u,}mul<mode1><mode2>3 for widening
> multiplication which has to use smult or umult for correctness.
> That's how i386 chooses between multi-operand imul (non-widening),
> single-operand imul (widening signed) and single-operand mul (widening
> unsigned). Note that the i386 ISA lacks a non-widening unsigned
> multiplication exactly because it's pointless.
>
> Or are you already doing that?
>
No, I am not actually. I initially thought it wouldn't work.
However, it makes sense. I just implemented it and it doesn work.
Thanks!
--
PMatos
More information about the Gcc
mailing list