Path: utzoo!mnetor!uunet!lll-winken!lll-lcc!lll-crg.llnl.gov!brooks From: brooks@lll-crg.llnl.gov (Eugene D. Brooks III) Newsgroups: comp.arch Subject: Re: taken -vs- untaken branches Message-ID: <1410@lll-lcc.aRpA> Date: 3 Jan 88 01:12:44 GMT References: <496@cresswell.quintus.UUCP> <638@l.cc.purdue.edu> Sender: usenet@lll-lcc.aRpA Reply-To: brooks@lll-crg.llnl.gov.UUCP (Eugene D. Brooks III) Organization: Lawrence Livermore National Laboratory Lines: 15 In article <496@cresswell.quintus.UUCP>, ok@quintus.UUCP (Richard A. O'Keefe) writes: > I thought that taken branches were always more costly than untaken > branches, so that one should try to arrange branches so that the > not-taken case was the commonest. There were some messages in this > group a while back which seems to suggest that in some newer RISCs > this was no longer the case. To cite an example, the Ridge 32 manufactured by Ridge Computers of Santa Clara has a branch prediction bit for conditional branches. The bit predicts whether or not the branch is taken or not. If correct the branch takes one clock, if not correct the branch takes 4 clocks while a pipeline in the processor refills. This branch prediction bit is static. One could consider dynamic branch prediction bits which get changed by the processor to suit what happened the last time through. One need only change the bit in the "code cache" not the bit out in main memory.