Hi!

On Fri, Aug 14, 2020 at 05:47:02PM +0000, Pip Cet wrote:
> On Fri, Aug 14, 2020 at 4:24 PM Segher Boessenkool
> <seg...@kernel.crashing.org> wrote:
> > On Fri, Aug 14, 2020 at 04:46:59PM +0530, Senthil Kumar Selvaraj via Gcc 
> > wrote:
> > > (define_insn "*mov<mode>_insn_noclobber_flags"
> > >   [(set (match_operand:ALL1 0 "nonimmediate_operand" "=r,d   ,q,r")
> > >         (match_operand:ALL1 1 "nox_general_operand"   "r,n Ynn,r,q"))
> > >    (clobber (const_int 0))]
> >
> > This is not correct, clobbers like that are not defined RTL, and are
> > actually used internally (by combine at least), so this will confuse
> > that.
> >
> > If you want to say some alternative does not clobber anything, just use
> > the constraint "X" for that alternative.
> 
> Just to clarify, such clobbers would still show up in RTL, right?

Yes, as

  (clobber (scratch:CC))

(or whatever the mode is).  No register will be allocated to it.  You
can do a define_split splitting it into the form without clobber, if
you want?  (You can "split" to just one insn fine.)  It's neatest when
written as a define_insn_and_split.

> Because some passes, such as cmpelim, do not currently appear to deal
> very well with extra clobbers, so that might be a problem.

Not sure if it would mind here...  It is not a clobber of a reg.

> What I'm currently doing is this:
> 
> (define_split
>   [(set (match_operand 0 "nonimmediate_operand")
>     (match_operand 1 "nox_general_operand"))]
>   "reload_completed && mov_clobbers_cc (insn, operands)"
>   [(parallel [(set (match_dup 0) (match_dup 1))
>           (clobber (reg:CC REG_CC))])])
> 
> which, if I understand correctly, introduces the parallel-clobber
> expression only when necessary, at the same time as post-reload
> splitters introduce REG_CC references. Is that correct?

Yes.  And this will work correctly if somehow you ensure that REG_CC
isn't live anywhere you introduce such a clobber.


Segher

Reply via email to