From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 107f24,6f568a2e6507575 X-Google-Attributes: gid107f24,public X-Google-Thread: f891f,6f568a2e6507575 X-Google-Attributes: gidf891f,public X-Google-Thread: 103376,6f568a2e6507575 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-04-25 05:12:32 PST Path: newsfeed.google.com!newsfeed.stanford.edu!news.ems.psu.edu!news.litech.org!not-for-mail From: jmv16@cornell.edu (Jeffrey M. Vinocur) Newsgroups: comp.lang.ada,comp.lang.functional,comp.lang.misc Subject: Re: Thoughts and Opinions or something like that Date: Wed, 25 Apr 2001 12:12:32 +0000 (UTC) Organization: Cornell University Sender: jeff@litech.org Message-ID: <9c6evg$em1$1@marduk.litech.org> References: <9c642e$of323@news.kvaerner.com> NNTP-Posting-Host: marduk.litech.org X-Trace: marduk.litech.org 988200752 15041 128.84.154.54 (25 Apr 2001 12:12:32 GMT) X-Complaints-To: usenet@litech.org NNTP-Posting-Date: Wed, 25 Apr 2001 12:12:32 +0000 (UTC) X-Newsreader: trn 4.0-test76 (Apr 2, 2001) Originator: jeff@litech.org (Jeffrey M. Vinocur) Xref: newsfeed.google.com comp.lang.ada:6919 comp.lang.functional:5286 comp.lang.misc:1128 Date: 2001-04-25T12:12:32+00:00 List-Id: In article <9c642e$of323@news.kvaerner.com>, Tarjei T. Jensen wrote: > >As far as instructions are concerned I always fancied deviding branch >instructions into two groups: Those who branch most of the time and those >who seldom branch. The idea was that one could skimp on branch prediction on >the CPU. For a while or for loop one would use the former type of >instructions. Since I have heard of nobody who have done this I assume that >the idea is not particularly good. Well, the goal isn't to lessen branch prediction -- the silicon is there either way -- but rather to reduce mispredicted branches. The most basic approach, I guess, is assume all backwards branches will be taken -- this gets loops. One not-very-complicated approach is to cache whether a branch was taken last time through and predict the same. This approach, however, does exactly what you suggest; it gets loop iterations 2,3,4,...,n-1 all correct.