Sujet : Re: branch guessing, Microarchitectural support for counting
De : johnl (at) *nospam* taugh.com (John Levine)
Groupes : comp.archDate : 26. Dec 2024, 20:11:01
Autres entêtes
Organisation : Taughannock Networks
Message-ID : <vkk9o5$25bs$1@gal.iecc.com>
References : 1 2 3 4
User-Agent : trn 4.0-test77 (Sep 1, 2010)
According to Michael S <
already5chosen@yahoo.com>:
Yes, compilers often generate such code.
When coding in asm, I typically know at least something about
probability of branches, so I tend to code it differently:
The first version of FORTRAN had a FREQUENCY statement which let you tell it the
relative likelihood of each of the results of a three-way IF, and the expected number of
iterations of a DO loop. It turned out to be useless, because programmers usually
guessed wrong.
The final straw was a compiler where they realized FREQUENCY was implemented
backward and nobody noticed.
Unless you've profiled the code and you data to support your branch guesses,
just write it in the clearest way you can.
-- Regards,John Levine, johnl@taugh.com, Primary Perpetrator of "The Internet for Dummies",Please consider the environment before reading this e-mail. https://jl.ly