On Wed, 2025-09-24 at 08:30 +0200, Richard Biener via Gcc wrote:
>
>
> > 2. Implement mulv2di3 for this specific target (which does exactly
> > what
> > scalar code would do), and let expand pass (expand_mult) take care
> > of
> > converting mult to shift/add/sub.
>
> The expand pass wouldn't do this when the target implements mulv2di3.
>
Actually I tried it by just defining a dummy mulv3di3 define_expand.
But this part of expand_mult
3550 {
3551 int shift = wi::exact_log2 (rtx_mode_t (scalar_op1,
mode));
3552 /* Perfect power of 2 (other than 1, which is handled
above). */
3553 if (shift > 0)
3554 return expand_shift (LSHIFT_EXPR, mode, op0,
3555 shift, target, unsignedp);
3556 else
3557 goto skip_synth;
converts it to a shift, and there are several other things done if
operand 1 is a constant.
So instead of rewriting the similar things in expand_vector_operations,
I was thinking of reusing optimizations done in expand pass by adding a
define_expand for mulv2di3 which does what scalar code does.
Thanks and regards,
Avinash Jayakar