Hi!

On Thu, Dec 17, 2020 at 02:15:51PM +0530, Senthil Kumar Selvaraj via 
Gcc-patches wrote:
> The work on my github branch was not complete - I'd blindly followed
> whatever the CC0 Transition wiki mentioned (the first three steps of
> case #2), and fixed any regression fallout (for ATmega128).
> 
> I intend to try out a define_subst/early clobber of reg_cc based
> approach (inspired by the cris port) and see if that can help avoid the
> proliferation of define_insn_and_splits. Will update how that works out.

Yeah, case #2 does not necessarily give the best result, but it usually
is the least work to do, so certainly a good choice under time pressure.

> > 1) Most inline asm will now clobber cc.  Is this handled automatically,
> > or why is there no addition to target asm clobbers? There is already
> > code out there that clobbers "cc", hence that should still work / be
> > recognized.
> 
> The wiki suggests using TARGET_MD_ASM_ADJUST hook to do that, that is
> not yet done.

This is really easy to do.  Look at examples from other ports (i386 does
its flags register as well I believe).  This is pretty important to get
right, so it would be good if you could include it.

> > 4) Many insns don't have reloads and don't need to be turned into a
> > splitter + yet another insns, it should be all right to clobber
> > reg_cc from the very start.  Or am I missing something?  I think
> > I marked all places, but it should be easy enough to spot them.

That works if you only ever generate it at instruction stream locations
where it is not yet live.  We do this for the CA (carry) register (bit)
on powerpc: this works because we generate new insns using it during
expand only.

> > 5) Combine now sees cbranch instead of compare as outer insn, and
> > hence will query respective costs.  I'd expect to see some extensions
> > to cost hooks to adjust for that?
> >
> > You can have a look at the combine dumps to see whether respective
> > patterns are still generated, or if they are rejected.  (No test case
> > will tell you that, you must know what you are doing).

Use -dp to inspect the costs in the generated asm file ("c=X", it also
shows the name of the MD pattern used), and -fdump-rtl-combine-all to
have the combine dump say a lot about costs as well (just use -dap if
you don't mind the over a hundred debug files that generates).

> > 7) Attribute cc is no more used.  It should be removed.

Well, is there code "in the wild" using it still?

> AFAICT, modes other than CCmode are required only when adding support for
> setting specific condition code bits.

When some instruction sets the condition mode bits in a different way /
with a different meaning than normal comparison instructions do, more
generally.


Segher

Reply via email to