On Fri, Mar 22, 2019 at 11:02 AM Jakub Jelinek <ja...@redhat.com> wrote:
>
> On Fri, Mar 22, 2019 at 10:35:45AM +0100, Uros Bizjak wrote:
> > On Fri, Mar 22, 2019 at 9:41 AM Jakub Jelinek <ja...@redhat.com> wrote:
> > > The following patch adds forgotten avx512f fma instrinsics for masked 
> > > scalar
> > > operations.
> > >
> > > Bootstrapped/regtested on x86_64-linux and i686-linux (on skylake-avx512),
> > > ok for trunk?
> >
> > There are several possibilities to mark the 1st and the 2nd operand of
> > fma pattern as commutative ("%"). However, there are already existing
> > patterns without commutative operand, so this improvement could be
> > eventually submitted as a follow-on patch.
>
> I actually don't know where it would be safe to use % in these masked
> patterns, except perhaps avx512f_vmfm{add,sub}_<mode>_mask3<round_name>.
>
> For FMA, naturally only the two operands that are multiplied should be
> commutative, but in most patterns one of those two uses "0" or "0,0"

This should be safe, we have had "*add<mode>_1" for decades that does
just the above.

> constraint and there is one or two match_dup 1 for it, so it really
> isn't commutative.

Hm, this situation involving match_dup needs some more thinking...

> Which leaves us with the 4 mask3 patterns only, as I said above, for
> the first two where neither of those are negated I think % should be ok.
> For the .*fnm{add,sub}.*mask3.* ones I'm not sure, because one of them
> is negated.  On the other side, seems various other existing fnm*
> patterns use % even on those.

It is safe to use even if one of the first two operands is negated.
According to the documentation, the negation represents negation of
the intermediate product, so it doesn't matter which operand is
negated.

Uros.

Reply via email to