[Bug target/87555] There is no need for UNSPEC_FMADDSUB

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Jun 18 07:32:42 GMT 2021


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

--- Comment #14 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Hongtao.liu from comment #13)
> (In reply to Richard Biener from comment #12)
> > (In reply to Hongtao.liu from comment #10)
> > > > Note I'm not sure that doing fmaddsub as merge of fma and fms will be
> > > > optimal since that most definitely will preclude combine from recognizing
> > > > fmaddsub from (addsub (mul ..) x) which would be another goal to support
> > > > (PR81904)
> > > 
> > > I guess you're talking about 
> > > 
> > > #include <x86intrin.h>
> > > __m128d f(__m128d x, __m128d y, __m128d z){
> > >   return _mm_addsub_pd(_mm_mul_pd(x,y),z);
> > > }
> > > 
> > > which pass_combine tries
> > >  
> > > Failed to match this instruction:
> > > (set (reg:V2DF 88)
> > >     (vec_merge:V2DF (minus:V2DF (mult:V2DF (reg:V2DF 90)
> > >                 (reg:V2DF 91))
> > >             (reg:V2DF 92))
> > >         (plus:V2DF (mult:V2DF (reg:V2DF 90)
> > >                 (reg:V2DF 91))
> > >             (reg:V2DF 92))
> > >         (const_int 1 [0x1])))
> > > 
> > > but doesn't realize fisrt merge operand is fms and second is fma.
> > 
> > Yes.  This situation will happen when I push the SLP pattern detection
> > for addsub - we then no longer detect FMA on the GIMPLE level (we might
> > want to improve that as well, of course, exposing standard pattern names
> > for fmaddsub and fmsubadd).
> 
> if fm{a,s}_optab is supported in the backend, can we always simplify (minus
> A (mult B C)) to (fma B C (neg A)) and (plus A (mult B C)) to (fma B C A)?

I suppose we could within the appropriate constraints (FP contraction allowed).


More information about the Gcc-bugs mailing list