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

--- Comment #22 from Oleg Endo <olegendo at gcc dot gnu.org> ---
(In reply to Oleg Endo from comment #21)
> (In reply to Oleg Endo from comment #17)
> > 
> > In the 'addsf3_i' pattern, I've tried replacing the
> > 
> >     (use (match_operand:PSI 3 "fpscr_operand" "c"))
> > 
> > with
> > 
> >     (set (match_operand:PSI 3 "fpscr_operand" "=&c")
> >          (unspec:PSI [(match_dup 3)] UNSPEC_FPSCR_SET))]
> > 
> > 
> > I haven't checked all the other side effects it could have, but at least the
> > FMA combine patterns still seem work after that change.
> 
> With those changes above applied to all the other FP insns, the FMA tests in
> gcc.target/sh fail.

As well as some of the FSCA tests.  E.g. 'return sinf (x) + cosf (x)' would
expand into two sincos patterns and normally combine would fold them into one. 
However, it doesn't understand the unspec:PSI stuff and tries to nest it such
as:
Failed to match this instruction:
(parallel [
        (set (reg:SI 174)
            (fix:SI (reg:SF 167)))
        (set (reg/v:PSI 151 )
            (unspec:PSI [
                    (unspec:PSI [
                            (reg/v:PSI 151 )
                        ] UNSPEC_FPSCR)
                ] UNSPEC_FPSCR))
    ])

I've tried adding a predicate that recursively matches those nested unspec:PSI
things, which makes combine happy, but then reload would bail out for some
reason.  Moreover, fp insns that do this

 (set (match_operand:PSI 3 "fpscr_operand" "=&c")
      (unspec:PSI [(match_dup 3)] UNSPEC_FPSCR_SET))]

won't get eliminated even if their results are unused/dead.
I'm trying to come up with some alternative approach.

Reply via email to