https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108787

--- Comment #8 from Segher Boessenkool <segher at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #6)
> we used to emit in GCC 12 4/4/4/5 instructions:
>         mulld 9,3,4
>         mulhdu 4,3,4
>         addc 3,9,5
>         adde 4,4,6
> and
>         mulld 9,3,4
>         mulhd 4,3,4
>         addc 3,9,5
>         adde 4,4,6
> and
>         mulld 9,3,4
>         mulhdu 4,3,4
>         addc 3,9,5
>         addze 4,4
> and
>         mulld 9,3,4
>         mulhd 4,3,4
>         sradi 10,5,63
>         addc 3,9,5
>         adde 4,4,10

And it was 2/2/2/2 insns deep.

> Now, with the patch we get 3/5/3/6 instructions:
>         maddhdu 9,3,4,5
>         maddld 3,3,4,5
>         add 4,9,6
> and
>         maddhd 9,3,4,5
>         srdi 10,5,63
>         maddld 3,3,4,5
>         add 9,9,10
>         add 4,9,6
> and
>         mr 9,3
>         maddld 3,3,4,5
>         maddhdu 4,9,4,5
> and
>         maddhd 9,3,4,5
>         srdi 8,5,63
>         sradi 10,5,63
>         maddld 3,3,4,5
>         add 9,9,8
>         add 4,9,10

And this is 2/3/2/3 so the signed are worse than what we had.

> So, unless we can somehow check for the sign extended operands[3], we
> shouldn't define maddditi3 or FAIL in it or expand it to equivalent of what
> we used to emit before.

I wouldn't define the signed version at all, we have no good way of
generating it.  We still can generate maddhd (and maddld of course), but
we shouldn't do this for maddditi4, just if e.g. combine comes up with the
correct RTL for it (there is no machine insn for it, it would require four
registers in, that is very expensive to do).

Reply via email to