This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Projects for beginners


On Wed, Jan 31, 2001 at 11:44:12AM -0500, Michael Meissner wrote:
> On Tue, Jan 30, 2001 at 11:49:24PM -0800, Zack Weinberg wrote:
> > This is where I admit that I have never been able to understand any of
> > the multiple different ways of handling condition codes in GCC.
> > There's the pure cc0 approach, the every-insn's-a-parallel approach
> > taken by the x86 back end, the cbranch stuff which I totally agree
> > needs more documentation, and the pure flag registers approach which
> > apparently only works on machines where that is the hardware.
> 
> 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):
[...]

Thank you, that makes a lot more sense than the stuff in the manual.

This is too big for a beginner project, but what do you think of
restructuring the named comparison insns so they all do
compare-and-whatever in one go?  So instead of

(insn ### {cmpsi} (set (reg flags) (compare (reg:SI A) (reg:SI B))))
(insn ### {bgt} (set (pc) (if_then_else
			(gt (reg flags) (const_int 0))
			(label_ref 23)
			(pc)))

you'd initially generate

(insn ### {bsicc} (set (pc) (if_then_else
			(gt:SI (reg:SI A) (reg:SI B))
			(label_ref 23)
			(bc)))

Machines that need two instructions to do that, could handle it with a
splitter or an expander.  The save-operands-on-compare hack would go away.

It looks like the movMcc insns already work like this.  I'm not sure
what the consequences are for if-conversion.  Also there are some
weird insns, like cmpstrsi, that would have to be dealt with
carefully.

zw

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]