Path: utzoo!mnetor!uunet!seismo!sundc!pitstop!sun!amdcad!ames!hao!gatech!bloom-beacon!mit-eddie!uw-beaver!cornell!rochester!PT.CS.CMU.EDU!sei!sei.cmu.edu!firth From: firth@sei.cmu.edu (Robert Firth) Newsgroups: comp.arch Subject: Re: conditional branches Message-ID: <4252@aw.sei.cmu.edu> Date: 18 Feb 88 14:36:21 GMT References: <191@telesoft.UUCP> <1556@gumby.mips.COM> <375@imagine.PAWL.RPI.EDU> <1610@gumby.mips.COM> Sender: netnews@sei.cmu.edu Reply-To: firth@bd.sei.cmu.edu.UUCP (Robert Firth) Organization: Carnegie-Mellon University, SEI, Pgh, Pa Lines: 28 Some of our work here confirms the view that condition codes are not a very good idea. Compiling the same code for MIPS M/500 and Vax-11, using the same compiler technology, gave the result MIPS: 6.1% of instructions were conditional branches 1.2% were 'set condition' instructions VAX: 10.0% conditional branches 8.9% tests or comparisons MIPS provides only comparison against zero in the conditional branch This took care of about 80% of branches; the other 20% required a prior set condition instruction. Vax branches against the condition codes, but loses because nearly all the branches then required a prior instruction to set them. Here is an extract from our report, discussing the Vax statistics: "The code generator slaves the condition codes religiously, both through linear code and across control transfers. Nevertheless, of 415 conditional branches, 371 (almost 90%) required a prior test or compare to set the condition codes; of 2169 normal instructions that set the condition codes, only 44 (about 2%) did so to any purpose. It is hard to avoid the conclusion that condition codes are a waste of time, effort, and silicon."