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

--- Comment #5 from Oleg Endo <olegendo at gcc dot gnu.org> ---
(In reply to Oleg Endo from comment #4)
> (In reply to celeriyacon from comment #3)
> > The T flag calculation part of the "subc" insn in sh.md looks wrong:
> > 
> >     (gtu:SI (minus:SI (minus:SI (match_dup 1) (match_dup 2))
> >                       (reg:SI T_REG))
> >             (match_dup 1)))]
> > 
> > 
> > I think it should instead be something like:
> > 
> >     (gtu:SI (plus:DI (zero_extend:DI (match_dup:SI 2))
> >                      (zero_extend:DI (reg:SI T_REG)))
> >             (zero_extend:DI (match_dup:SI 1))))]
> 
> Thanks for reporting this.
> 
> Have you tried to change the pattern to see if it fixes the problem?
> 
> I would be surprised if the T-bit calculation expression of "subc" (or of
> addc) is actually used.

OK, for a moment I was surprised.

I can confirm that the wrong T flag calculation in the "subc" insn pattern is
the culprit.  Using your suggestion seems the correct thing to do.

In fact, I've noticed this already a while ago.  See PR 67459.
But it never got fixed because it didn't do any harm.

Reply via email to