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

Andrew Stubbs ams@codesourcery.com
Tue Jul 12 14:10:00 GMT 2011


On 04/07/11 15:26, Andrew Stubbs wrote:
> On 28/06/11 15:14, Andrew Stubbs wrote:
>> On 28/06/11 13:33, Andrew Stubbs wrote:
>>> 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.
>>
>> And this one fixes up the wmul-5.c testcase also. The patch has changed
>> the correct result.
>
> Here's an update for the context changed by the update to patch 3.
>
> The content of the patch has not changed.

This update does the same thing as before, but updated for the changes 
earlier in the patch series. In particular, the build_and_insert_cast 
function and find_widening_optab_handler_and_mode changes have been 
moved up to patch 2.

OK?

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


More information about the Gcc-patches mailing list