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]
Other format: [Raw text]

Re: Choosing the best multiplication


On 09/24/2010 10:10 AM, Paulo J. Matos wrote:
The rules currently take the shape:
,----
| (define_expand "umulqihi3"
`----

These rules were created in gcc42 and the idea was that we can use smult
instead of umult whenever RAH (MSW of the result) is not used
afterwards. The 2nd argument of make_mulqihi3 determines if we emit an
smult instead of an umult.

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?

Paolo


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