Hi, Florian.

>>>There is a movement to replace table-driven stack unwinding with a 
>>>conditional branch after most function calls...
I am sorry I don't understand its meaning, forgive my poor knowledge
of dynamic prediction, I am reading relative materials these days,
could you explain a little more for this sentence, or give me some
keywords for google ?

>>> programmers tend to misuse __builtin_expect ..
I believe you must have strong factual basis saying such words,  I can
quite accept  the CPU manufacturer's ignoring branch prediction hints
for some reasons, but not this,  One somewhat contrived example: if
most people of a country are blind, then the government forbid the car
to provide a safe road, may a better choice is asking the blind people
go to hospital to cure the eye.

Thanks again.







2018-08-15 17:26 GMT+08:00, Florian Weimer <fwei...@redhat.com>:
> On 08/14/2018 03:36 PM, 2016 quekong wrote:
>
>> And Intel seems don't want to talk about it any more, because the latest
>> material I found within Intel Document was written about ten years ago.
>
> Since branch prediction is nowadays a security feature, I doubt you will
> see detailed public documentation from any processor manufacturer.
>
>> I know static branch prediction is (far?) less important than dynamic,
>> but
>> in quite a few situations, CPU will be completely lost and
>> programmers(with
>> compiler) are usually the best guide. Of course these situations are
>> usually not performance bottleneck, because once a branch is frequently
>> executed, the dynamic predictor will capture it.
>
> There is a movement to replace table-driven stack unwinding with a
> conditional branch after most function calls, and those branches should
> predict really well statically.  (And so would return value checks for
> almost all POSIX functions.)  Statically predicting those branches as
> not taken may free up branch prediction resources for other uses.
>
> On the other hand, programmers tend to misuse __builtin_expect to say
> that something is unlikely to happen, while it can happen quite
> regularly during certain executions of the program.  So if
> __builtin_expect results in static hints from the compiler, the CPU will
> be better off ignoring those hints in most cases.
>
> Thanks,
> Florian
>

Reply via email to