Patch: Consistently generate widening multiplies

Richard Guenther richard.guenther@gmail.com
Wed Feb 17 10:24:00 GMT 2010


On Wed, Feb 17, 2010 at 12:18 AM, Steven Bosscher <stevenb.gcc@gmail.com> wrote:
> On Wed, Feb 17, 2010 at 12:00 AM, Bernd Schmidt <bernds_cb1@t-online.de> wrote:
>> Tree-SSA introduced a regression with widening multiplications;
>> extension operations are often separated from the MULT_EXPR they feed.
>> There has been a patch last year to address this in expand_expr_real_2,
>> but it's still rather more miss than hit as shown by the testcases
>> included in the patch below.
>
> Could this be http://gcc.gnu.org/PR29274 ? Would be a reason to push
> the patch for gcc 4.5.

Please not.  I think the patch goes in the right direction - basically
it's lowering gimple to simplify the task of expansion.  A similar
trick could be applied to detect FMAs.

>> This patch adds a new mini-pass to tree-ssa-math-opts.c.
>
> *sigh* another mini-pass.  There are a handful of them now, and they
> all cost a full traversal of the function for very local, very special
> pattern matching things (bswap, etc.) They should be grouped somehow
> :-(  I suppose there is no way to fold this into one of the existing
> passes?

I think this sort of stuff (and also possible FMA detection) fits
in a re-association framework (not necessarily that we have right now,
that needs some TLC anyway ...).  That might also expose
more opportunities like for ((long) x) * y * ((long) z).

As you use WIDEN_MULT_EXPR, can you add/adjust gimple
checking code in tree-cfg.c:verify_gimple_assign_binary?
It seems you would allow different width operands?

I'll have a more detailed look at the patch once we go into stage1
(yes, that's definitely 4.6 material).

Thanks,
Richard.

>
>> +static unsigned int
>> +execute_optimize_widening_mul (void)
> (...)
>> +             if (rhs1_code != CONVERT_EXPR && rhs1_code != NOP_EXPR)
>> +               continue;
>
> if (CONVERT_EXPR_CODE_P (rhs1_code)
>
> Ciao!
> Steven
>



More information about the Gcc-patches mailing list