Projects for beginners

Hans-Peter Nilsson hans-peter.nilsson@axis.com
Wed Jan 31 10:36:00 GMT 2001


> Date: Wed, 31 Jan 2001 11:44:12 -0500
> From: Michael Meissner <meissner@cygnus.com>

> My quick view of the history is (note some of this predates my involvement with
> GCC) is (using a branch if register is > 2 as an example):

That's a very nice summary, something to put into md.texi at some time.

> Cbranch was added for the thumb subport of the arm, and it allows the
> comparison and branch to be folded together early on.  I personally haven't
> hacked one of these machines yet.
> 
> 	(set (pc)
> 	     (if_then_else (gt (reg:CC n) (const_int 0))
> 			   (label_ref ...)
> 			   (pc)))

If this insn example is supposed to be the cbranch insn, then I
believe it's slightly wrong; a cbranch insn seems to use the
original operands.  I think it should say (using your reg > 2
example):

	(set (pc)
	     (if_then_else (gt (reg:SI n) (const_int 2))
			   (label_ref ...)
			   (pc)))

> All (almost all?) machines set this up via the compare named insns just storing
> the arguments, and the appropriate branch or scc instruction actually
> generating the appropriate code.

All non-cc0 machines, it seems.  I don't know whether this is
also necessary for cbranch-machines.  There is a comment in
optabs.c that says that "a target is still required to implement
all of the normal bcc operations".  Maybe that isn't true anymore.

> > > I guess this is actually a call for documentation of that
> > > appraised "cbranch" stuff.  Maybe an item for the GCC-related
> > > projects, unless the cbranch author or equivalent steps forward.
> > 
> > Emphatic agreement.
> 
> Bernd is probably the person to talk to about cbranch.

Bernd, if this isn't a good time to update md.texi, could you
please give hints, thoughts or mumbles :-) on how to use
cbranch/cset/cstore, perhaps even with focus on rewriting
cc0-ports?  Does this allow a port to *not* use any of the
classic non-cc0 store-the-arguments, expand-compare-in-branch as
seen in e.g. sparc.md (just to say something else than arm.md)?

brgds, H-P


More information about the Gcc mailing list