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

Andrew Stubbs ams@codesourcery.com
Tue Jun 28 13:28:00 GMT 2011

On 23/06/11 15:41, Andrew Stubbs wrote:
> 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).
> OK?

This update fixes the testsuite issue Janis pointed out.

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

More information about the Gcc-patches mailing list