[PATCH (4/7)] Unsigned multiplies using wider signed multiplies

Andrew Stubbs andrew.stubbs@linaro.org
Thu Jun 23 14:43:00 GMT 2011

If one or both of the inputs to a widening multiply are of unsigned type 
then the compiler will attempt to use usmul_widen_optab or 
umul_widen_optab, respectively.

That works fine, but only if the target supports those operations 
directly. Otherwise, it just bombs out and reverts to the normal 
inefficient non-widening multiply.

This patch attempts to catch these cases and use an alternative signed 
widening multiply instruction, if one of those is available.

I believe this should be legal as long as the top bit of both inputs is 
guaranteed to be zero. The code achieves this guarantee by 
zero-extending the inputs to a wider mode (which must still be narrower 
than the output mode).



-------------- next part --------------
A non-text attachment was scrubbed...
Name: widening-multiplies-4.patch
Type: text/x-patch
Size: 7324 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20110623/68dbb7df/attachment.bin>

More information about the Gcc-patches mailing list